From 8e8e9d3719eb81cbecb913b68efa321a535477ad Mon Sep 17 00:00:00 2001 From: Renan de Lima Date: Mon, 22 Jul 2013 10:42:48 -0300 Subject: [PATCH 1/4] Factory uses "prefered-install" configuration when creating DownloadManager --- src/Composer/Factory.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Composer/Factory.php b/src/Composer/Factory.php index c8e854e3e..645f93bf9 100644 --- a/src/Composer/Factory.php +++ b/src/Composer/Factory.php @@ -316,6 +316,19 @@ class Factory } $dm = new Downloader\DownloadManager(); + switch ($config->get('preferred-install')) { + case 'dist': + $dm->setPreferDist(true); + break; + case 'source': + $dm->setPreferSource(true); + break; + case 'auto': + default: + // noop + break; + } + $dm->setDownloader('git', new Downloader\GitDownloader($io, $config)); $dm->setDownloader('svn', new Downloader\SvnDownloader($io, $config)); $dm->setDownloader('hg', new Downloader\HgDownloader($io, $config)); From d17935acd2951a7869375704fef51f672b34888a Mon Sep 17 00:00:00 2001 From: Renan de Lima Date: Mon, 22 Jul 2013 10:43:36 -0300 Subject: [PATCH 2/4] attach IO to DownloadManager in "package" command --- src/Composer/Command/ArchiveCommand.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Composer/Command/ArchiveCommand.php b/src/Composer/Command/ArchiveCommand.php index d7ed722df..cd1a4c3ac 100644 --- a/src/Composer/Command/ArchiveCommand.php +++ b/src/Composer/Command/ArchiveCommand.php @@ -68,7 +68,8 @@ EOT { $config = Factory::createConfig(); $factory = new Factory; - $archiveManager = $factory->createArchiveManager($config); + $downloadManager = $factory->createDownloadManager($this->getIO(), $config); + $archiveManager = $factory->createArchiveManager($config, $downloadManager); if ($packageName) { $package = $this->selectPackage($io, $packageName, $version); From e06f0f123328497869bb8f6bace12a4b0eba41b1 Mon Sep 17 00:00:00 2001 From: Renan de Lima Date: Mon, 22 Jul 2013 10:43:47 -0300 Subject: [PATCH 3/4] removes hardcoded "prefer-source" in ArchiveManage when calling DownloadManager --- src/Composer/Package/Archiver/ArchiveManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Composer/Package/Archiver/ArchiveManager.php b/src/Composer/Package/Archiver/ArchiveManager.php index 383f83b72..6c6be7fda 100644 --- a/src/Composer/Package/Archiver/ArchiveManager.php +++ b/src/Composer/Package/Archiver/ArchiveManager.php @@ -138,7 +138,7 @@ class ArchiveManager $filesystem->ensureDirectoryExists($sourcePath); // Download sources - $this->downloadManager->download($package, $sourcePath, true); + $this->downloadManager->download($package, $sourcePath); } // Create the archive From 610e272faaeceef33ef93f96eab5f93d433e26bf Mon Sep 17 00:00:00 2001 From: Renan de Lima Date: Mon, 22 Jul 2013 11:27:08 -0300 Subject: [PATCH 4/4] use available $io in archive https://github.com/composer/composer/pull/2099#pullrequestreviewcomment-5318806 --- src/Composer/Command/ArchiveCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Composer/Command/ArchiveCommand.php b/src/Composer/Command/ArchiveCommand.php index cd1a4c3ac..03e8600fa 100644 --- a/src/Composer/Command/ArchiveCommand.php +++ b/src/Composer/Command/ArchiveCommand.php @@ -68,7 +68,7 @@ EOT { $config = Factory::createConfig(); $factory = new Factory; - $downloadManager = $factory->createDownloadManager($this->getIO(), $config); + $downloadManager = $factory->createDownloadManager($io, $config); $archiveManager = $factory->createArchiveManager($config, $downloadManager); if ($packageName) {