From bf080192929320ab5cb043dd3ee933a0b8c9d17c Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sat, 31 Aug 2013 16:20:38 +0200 Subject: [PATCH] Load plugins and installers prior to checking installed packages --- src/Composer/Factory.php | 8 ++++---- src/Composer/Plugin/PluginManager.php | 2 +- tests/Composer/Test/Plugin/PluginInstallerTest.php | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Composer/Factory.php b/src/Composer/Factory.php index a3736300c..a1d17232d 100644 --- a/src/Composer/Factory.php +++ b/src/Composer/Factory.php @@ -260,6 +260,10 @@ class Factory // add installers to the manager $this->createDefaultInstallers($im, $composer, $io); + if (!$disablePlugins) { + $pm->loadInstalledPlugins(); + } + // purge packages if they have been deleted on the filesystem $this->purgePackages($rm, $im); @@ -272,10 +276,6 @@ class Factory $composer->setLocker($locker); } - if (!$disablePlugins) { - $pm->loadInstalledPlugins(); - } - return $composer; } diff --git a/src/Composer/Plugin/PluginManager.php b/src/Composer/Plugin/PluginManager.php index f331337c0..c67ea9622 100644 --- a/src/Composer/Plugin/PluginManager.php +++ b/src/Composer/Plugin/PluginManager.php @@ -172,7 +172,7 @@ class PluginManager $generator = $this->composer->getAutoloadGenerator(); $autoloads = array(); foreach ($autoloadPackages as $autoloadPackage) { - $downloadPath = $this->getInstallPath($autoloadPackage, !$localRepo->hasPackage($autoloadPackage)); + $downloadPath = $this->getInstallPath($autoloadPackage, ($this->globalRepository && $this->globalRepository->hasPackage($autoloadPackage))); $autoloads[] = array($autoloadPackage, $downloadPath); } diff --git a/tests/Composer/Test/Plugin/PluginInstallerTest.php b/tests/Composer/Test/Plugin/PluginInstallerTest.php index 5d21f59db..1e67eafe1 100644 --- a/tests/Composer/Test/Plugin/PluginInstallerTest.php +++ b/tests/Composer/Test/Plugin/PluginInstallerTest.php @@ -69,6 +69,7 @@ class PluginInstallerTest extends \PHPUnit_Framework_TestCase $config->merge(array( 'config' => array( 'vendor-dir' => __DIR__.'/Fixtures/', + 'home' => __DIR__.'/Fixtures', 'bin-dir' => __DIR__.'/Fixtures/bin', ), ));