diff --git a/src/Composer/Downloader/DownloadManager.php b/src/Composer/Downloader/DownloadManager.php index a4ac66006..5078a7f9a 100644 --- a/src/Composer/Downloader/DownloadManager.php +++ b/src/Composer/Downloader/DownloadManager.php @@ -68,7 +68,7 @@ class DownloadManager public function getDownloader($type) { if (!isset($this->downloaders[$type])) { - throw new \InvalidArgumentException('Unknown source type: '.$type); + throw new \InvalidArgumentException('Unknown downloader type: '.$type); } return $this->downloaders[$type]; diff --git a/src/Composer/Package/Dumper/ArrayDumper.php b/src/Composer/Package/Dumper/ArrayDumper.php index 66aad1606..d82b60f24 100644 --- a/src/Composer/Package/Dumper/ArrayDumper.php +++ b/src/Composer/Package/Dumper/ArrayDumper.php @@ -16,6 +16,7 @@ use Composer\Package\PackageInterface; /** * @author Konstantin Kudryashiv + * @author Jordi Boggiano */ class ArrayDumper { @@ -25,12 +26,7 @@ class ArrayDumper 'type', 'names', 'extra', - 'installationSource', - 'sourceType', - 'sourceUrl', - 'distType', - 'distUrl', - 'distSha1Checksum', + 'installationSource' => 'installation-source', 'version', 'license', 'requires', @@ -48,8 +44,26 @@ class ArrayDumper if ($package->getTargetDir()) { $data['target-dir'] = $package->getTargetDir(); } - foreach ($keys as $key) { - $getter = 'get'.ucfirst($key); + + if ($package->getSourceType()) { + $data['source']['type'] = $package->getSourceType(); + $data['source']['url'] = $package->getSourceUrl(); + $data['source']['reference'] = $package->getSourceReference(); + } + + if ($package->getDistType()) { + $data['dist']['type'] = $package->getDistType(); + $data['dist']['url'] = $package->getDistUrl(); + $data['dist']['reference'] = $package->getDistReference(); + $data['dist']['shasum'] = $package->getDistSha1Checksum(); + } + + foreach ($keys as $method => $key) { + if (is_numeric($method)) { + $method = $key; + } + + $getter = 'get'.ucfirst($method); $value = $package->$getter(); if (null !== $value && !(is_array($value) && 0 === count($value))) { diff --git a/src/Composer/Package/Loader/ArrayLoader.php b/src/Composer/Package/Loader/ArrayLoader.php index 7479572e5..961544d23 100644 --- a/src/Composer/Package/Loader/ArrayLoader.php +++ b/src/Composer/Package/Loader/ArrayLoader.php @@ -73,6 +73,10 @@ class ArrayLoader $package->setLicense($config['license']); } + if (isset($config['installation-source'])) { + $package->setInstallationSource($config['installation-source']); + } + if (isset($config['source'])) { if (!isset($config['source']['type']) || !isset($config['source']['url'])) { throw new \UnexpectedValueException(sprintf(