From 3bed815b19791afff93abf76ce38af92f3e39040 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 17 Jan 2012 11:54:02 +0100 Subject: [PATCH] Restore bindir/vendordir behavior, fixes #216 --- src/Composer/Factory.php | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/Composer/Factory.php b/src/Composer/Factory.php index e9fa4c9d6..d364ae4af 100644 --- a/src/Composer/Factory.php +++ b/src/Composer/Factory.php @@ -23,8 +23,6 @@ use Composer\Json\JsonFile; */ class Factory { - protected $vendorDir; - /** * Creates a Composer instance * @@ -48,8 +46,6 @@ class Factory throw new \InvalidArgumentException($message.PHP_EOL.$instructions); } - $baseDir = rtrim(dirname($composerFile), '/').'/'; - // Configuration defaults $composerConfig = array( 'vendor-dir' => 'vendor', @@ -69,9 +65,6 @@ class Factory } $binDir = getenv('COMPOSER_BIN_DIR') ?: $packageConfig['config']['bin-dir']; - $this->vendorDir = $baseDir.$vendorDir; - $this->binDir = $baseDir.$binDir; - // initialize repository manager $rm = $this->createRepositoryManager(); @@ -79,7 +72,7 @@ class Factory $dm = $this->createDownloadManager(); // initialize installation manager - $im = $this->createInstallationManager($rm, $dm); + $im = $this->createInstallationManager($rm, $dm, $vendorDir, $binDir); // load package $loader = new Package\Loader\RootPackageLoader($rm); @@ -105,10 +98,10 @@ class Factory return $composer; } - protected function createRepositoryManager() + protected function createRepositoryManager($vendorDir) { $rm = new Repository\RepositoryManager(); - $rm->setLocalRepository(new Repository\FilesystemRepository(new JsonFile($this->vendorDir.'/.composer/installed.json'))); + $rm->setLocalRepository(new Repository\FilesystemRepository(new JsonFile($vendorDir.'/.composer/installed.json'))); $rm->setRepositoryClass('composer', 'Composer\Repository\ComposerRepository'); $rm->setRepositoryClass('vcs', 'Composer\Repository\VcsRepository'); $rm->setRepositoryClass('pear', 'Composer\Repository\PearRepository'); @@ -129,11 +122,11 @@ class Factory return $dm; } - protected function createInstallationManager(Repository\RepositoryManager $rm, Downloader\DownloadManager $dm) + protected function createInstallationManager(Repository\RepositoryManager $rm, Downloader\DownloadManager $dm, $vendorDir, $binDir) { - $im = new Installer\InstallationManager($this->vendorDir); - $im->addInstaller(new Installer\LibraryInstaller($this->vendorDir, $this->binDir, $dm, $rm->getLocalRepository(), null)); - $im->addInstaller(new Installer\InstallerInstaller($this->vendorDir, $this->binDir, $dm, $rm->getLocalRepository(), $im)); + $im = new Installer\InstallationManager($vendorDir); + $im->addInstaller(new Installer\LibraryInstaller($vendorDir, $binDir, $dm, $rm->getLocalRepository(), null)); + $im->addInstaller(new Installer\InstallerInstaller($vendorDir, $binDir, $dm, $rm->getLocalRepository(), $im)); return $im; }