diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index 3b094f416..55d581cde 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -90,14 +90,12 @@ EOF; { $installPaths = array(); foreach ($this->localRepo->getPackages() as $package) { - $this->populateAutoloadInformation($package); - $installPaths[] = array( $package, $this->installationManager->getInstallPath($package) ); } - $installPaths[] = array($package, ''); + $installPaths[] = array($this->package, ''); $autoloads = array(); foreach ($installPaths as $item) { @@ -108,7 +106,6 @@ EOF; } foreach ($package->getAutoload() as $type => $mapping) { - $autoloads[$type] = isset($autoloads[$type]) ? $autoloads[$type] : array(); $autoloads[$type][] = array( 'mapping' => $mapping, 'path' => $installPath, @@ -118,19 +115,4 @@ EOF; return $autoloads; } - - /** - * Because remote repos don't include the autoload data, - * we have to manually fetch it from the locally installed - * packages. - */ - private function populateAutoloadInformation(PackageInterface $package) - { - $path = $this->installationManager->getInstallPath($package); - - $loader = new JsonLoader(); - $fullPackage = $loader->load(new JsonFile($path.'/composer.json')); - - $package->setAutoload($fullPackage->getAutoload()); - } } diff --git a/src/Composer/Package/Dumper/ArrayDumper.php b/src/Composer/Package/Dumper/ArrayDumper.php index 370ab5000..58c7c3f50 100644 --- a/src/Composer/Package/Dumper/ArrayDumper.php +++ b/src/Composer/Package/Dumper/ArrayDumper.php @@ -44,7 +44,9 @@ class ArrayDumper $data = array(); $data['name'] = $package->getPrettyName(); - $data['target-dir'] = $package->getTargetDir(); + if ($package->getTargetDir()) { + $data['target-dir'] = $package->getTargetDir(); + } foreach ($keys as $key) { $getter = 'get'.ucfirst($key); $value = $package->$getter(); diff --git a/tests/Composer/Test/Installer/LibraryInstallerTest.php b/tests/Composer/Test/Installer/LibraryInstallerTest.php index 1255a70c9..c5be9cbb6 100644 --- a/tests/Composer/Test/Installer/LibraryInstallerTest.php +++ b/tests/Composer/Test/Installer/LibraryInstallerTest.php @@ -78,7 +78,7 @@ class LibraryInstallerTest extends \PHPUnit_Framework_TestCase $this->dm ->expects($this->once()) ->method('download') - ->with($package, $this->dir.DIRECTORY_SEPARATOR.'some/package'); + ->with($package, $this->dir.'/some/package'); $this->repository ->expects($this->once()) @@ -108,7 +108,7 @@ class LibraryInstallerTest extends \PHPUnit_Framework_TestCase $this->dm ->expects($this->once()) ->method('update') - ->with($initial, $target, $this->dir.DIRECTORY_SEPARATOR.'package1'); + ->with($initial, $target, $this->dir.'/package1'); $this->repository ->expects($this->once()) @@ -146,7 +146,7 @@ class LibraryInstallerTest extends \PHPUnit_Framework_TestCase $this->dm ->expects($this->once()) ->method('remove') - ->with($package, $this->dir.DIRECTORY_SEPARATOR.'pkg'); + ->with($package, $this->dir.'/pkg'); $this->repository ->expects($this->once())