1
0
Fork 0

[autoload] refactor getFullPackage into populateAutoloadInformation

pull/44/head
Igor Wiedler 2011-10-16 20:10:50 +02:00
parent b5f1bffcfa
commit e71fcdc0f5
1 changed files with 10 additions and 3 deletions

View File

@ -88,8 +88,10 @@ EOF;
{ {
$installPaths = array(); $installPaths = array();
foreach ($this->localRepo->getPackages() as $package) { foreach ($this->localRepo->getPackages() as $package) {
$this->populateAutoloadInformation($package);
$installPaths[] = array( $installPaths[] = array(
$this->getFullPackage($package), $package,
$this->installationManager->getInstallPath($package) $this->installationManager->getInstallPath($package)
); );
} }
@ -115,13 +117,18 @@ EOF;
return $autoloads; 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); $path = $this->installationManager->getInstallPath($package);
$loader = new JsonLoader(); $loader = new JsonLoader();
$fullPackage = $loader->load(new JsonFile($path.'/composer.json')); $fullPackage = $loader->load(new JsonFile($path.'/composer.json'));
return $fullPackage; $package->setAutoload($fullPackage->getAutoload());
} }
} }