From e71fcdc0f5c183997db40a6d40a5cef95ee4e0ea Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sun, 16 Oct 2011 20:10:50 +0200 Subject: [PATCH] [autoload] refactor getFullPackage into populateAutoloadInformation --- src/Composer/Autoload/AutoloadGenerator.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index be456d2bb..15373e148 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -88,8 +88,10 @@ EOF; { $installPaths = array(); foreach ($this->localRepo->getPackages() as $package) { + $this->populateAutoloadInformation($package); + $installPaths[] = array( - $this->getFullPackage($package), + $package, $this->installationManager->getInstallPath($package) ); } @@ -115,13 +117,18 @@ EOF; return $autoloads; } - private function getFullPackage(PackageInterface $package) + /** + * 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')); - return $fullPackage; + $package->setAutoload($fullPackage->getAutoload()); } }