From 7cdb793b405d6214599b8c8614323df2453ec8c2 Mon Sep 17 00:00:00 2001 From: digitalkaoz Date: Sat, 10 Mar 2012 10:24:14 +0100 Subject: [PATCH 1/3] added support section to composer.json --- res/composer-schema.json | 31 +++++++++++++++++++++ src/Composer/Command/ShowCommand.php | 7 +++++ src/Composer/Package/AliasPackage.php | 4 +++ src/Composer/Package/Loader/ArrayLoader.php | 4 +++ src/Composer/Package/MemoryPackage.php | 21 ++++++++++++++ 5 files changed, 67 insertions(+) diff --git a/res/composer-schema.json b/res/composer-schema.json index d35591a1c..322ccccd1 100644 --- a/res/composer-schema.json +++ b/res/composer-schema.json @@ -191,6 +191,37 @@ "description": "Occurs after a package has been uninstalled, contains one or more Class::method callables." } } + }, + "support": { + "type": "object", + "additionalProperties": true, + "properties": { + "email": { + "type": "string", + "description": "Email address of the community.", + "format": "email" + }, + "issues": { + "type": "string", + "description": "URL to the Issue Tracker.", + "format": "uri" + }, + "forum": { + "type": "string", + "description": "URL to the Forum.", + "format": "uri" + }, + "wiki": { + "type": "string", + "description": "URL to the Wiki.", + "format": "uri" + }, + "irc": { + "type": "string", + "description": "Irc support channel" + } + } } + } } diff --git a/src/Composer/Command/ShowCommand.php b/src/Composer/Command/ShowCommand.php index 042ff420b..786caab55 100644 --- a/src/Composer/Command/ShowCommand.php +++ b/src/Composer/Command/ShowCommand.php @@ -159,6 +159,13 @@ EOT $output->writeln('dist : ' . sprintf('[%s] %s %s', $package->getDistType(), $package->getDistUrl(), $package->getDistReference())); $output->writeln('names : ' . implode(', ', $package->getNames())); + if ($package->getSupport()) { + $output->writeln("\nsupport"); + foreach ($package->getSupport() as $type => $url) { + $output->writeln('' . $type . ' : '.$url); + } + } + if ($package->getAutoload()) { $output->writeln("\nautoload"); foreach ($package->getAutoload() as $type => $autoloads) { diff --git a/src/Composer/Package/AliasPackage.php b/src/Composer/Package/AliasPackage.php index 1b6481d8e..b94745582 100644 --- a/src/Composer/Package/AliasPackage.php +++ b/src/Composer/Package/AliasPackage.php @@ -266,6 +266,10 @@ class AliasPackage extends BasePackage { return $this->aliasOf->getAuthors(); } + public function getSupport() + { + return $this->aliasOf->getSupport(); + } public function __toString() { return parent::__toString().' (alias of '.$this->aliasOf->getVersion().')'; diff --git a/src/Composer/Package/Loader/ArrayLoader.php b/src/Composer/Package/Loader/ArrayLoader.php index 001fa2e25..2fe85048e 100644 --- a/src/Composer/Package/Loader/ArrayLoader.php +++ b/src/Composer/Package/Loader/ArrayLoader.php @@ -171,6 +171,10 @@ class ArrayLoader $package->setAutoload($config['autoload']); } + if (isset($config['support'])) { + $package->setSupport($config['support']); + } + return $package; } diff --git a/src/Composer/Package/MemoryPackage.php b/src/Composer/Package/MemoryPackage.php index 2c3502502..b8ad5a916 100644 --- a/src/Composer/Package/MemoryPackage.php +++ b/src/Composer/Package/MemoryPackage.php @@ -56,6 +56,7 @@ class MemoryPackage extends BasePackage protected $recommends = array(); protected $suggests = array(); protected $autoload = array(); + protected $support = array(); /** * Creates a new in memory package. @@ -623,4 +624,24 @@ class MemoryPackage extends BasePackage { return $this->autoload; } + + /** + * Set the support information + * + * @param array $support + */ + public function setSupport(array $support) + { + $this->support = $support; + } + + /** + * Returns the support information + * + * @return array + */ + public function getSupport() + { + return $this->support; + } } From 7bbe60459fbdee89a04394d05c04be612594826a Mon Sep 17 00:00:00 2001 From: digitalkaoz Date: Fri, 16 Mar 2012 08:44:36 +0100 Subject: [PATCH 2/3] added source key, and support section to arraydumper --- res/composer-schema.json | 4 ++++ src/Composer/Package/Dumper/ArrayDumper.php | 1 + 2 files changed, 5 insertions(+) diff --git a/res/composer-schema.json b/res/composer-schema.json index 322ccccd1..51687bbb5 100644 --- a/res/composer-schema.json +++ b/res/composer-schema.json @@ -219,6 +219,10 @@ "irc": { "type": "string", "description": "Irc support channel" + }, + "source": { + "type": "string", + "description": "URL to the sources" } } } diff --git a/src/Composer/Package/Dumper/ArrayDumper.php b/src/Composer/Package/Dumper/ArrayDumper.php index 188d55c5c..4ee414985 100644 --- a/src/Composer/Package/Dumper/ArrayDumper.php +++ b/src/Composer/Package/Dumper/ArrayDumper.php @@ -36,6 +36,7 @@ class ArrayDumper 'keywords', 'autoload', 'repositories', + 'support' ); $data = array(); From 20ae7efa2bce959c3b2778b911e29d7788d2a851 Mon Sep 17 00:00:00 2001 From: digitalkaoz Date: Sat, 17 Mar 2012 13:07:13 +0100 Subject: [PATCH 3/3] fixed CS --- res/composer-schema.json | 3 ++- src/Composer/Package/Dumper/ArrayDumper.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/res/composer-schema.json b/res/composer-schema.json index 51687bbb5..2508791a0 100644 --- a/res/composer-schema.json +++ b/res/composer-schema.json @@ -222,7 +222,8 @@ }, "source": { "type": "string", - "description": "URL to the sources" + "description": "URL to the sources", + "format": "uri" } } } diff --git a/src/Composer/Package/Dumper/ArrayDumper.php b/src/Composer/Package/Dumper/ArrayDumper.php index 4ee414985..d107f7aca 100644 --- a/src/Composer/Package/Dumper/ArrayDumper.php +++ b/src/Composer/Package/Dumper/ArrayDumper.php @@ -36,7 +36,7 @@ class ArrayDumper 'keywords', 'autoload', 'repositories', - 'support' + 'support', ); $data = array();