1
0
Fork 0

Check for homepages in local repo first if available to make the home command faster

pull/3588/merge
Jordi Boggiano 2015-02-24 13:07:28 +00:00
parent 01476214da
commit 3cff4a3bb9
1 changed files with 19 additions and 9 deletions

View File

@ -57,10 +57,16 @@ EOT
*/ */
protected function execute(InputInterface $input, OutputInterface $output) protected function execute(InputInterface $input, OutputInterface $output)
{ {
$repo = $this->initializeRepo(); $repos = $this->initializeRepos();
$return = 0; $return = 0;
foreach ($input->getArgument('packages') as $packageName) { foreach ($input->getArgument('packages') as $packageName) {
foreach ($repos as $repo) {
$package = $this->getPackage($repo, $packageName);
if ($package instanceof CompletePackageInterface) {
break;
}
}
$package = $this->getPackage($repo, $packageName); $package = $this->getPackage($repo, $packageName);
if (!$package instanceof CompletePackageInterface) { if (!$package instanceof CompletePackageInterface) {
@ -144,21 +150,25 @@ EOT
} }
/** /**
* Initializes the repo * Initializes repositories
* *
* @return CompositeRepository * Returns an array of repos in order they should be checked in
*
* @return RepositoryInterface[]
*/ */
private function initializeRepo() private function initializeRepos()
{ {
$composer = $this->getComposer(false); $composer = $this->getComposer(false);
if ($composer) { if ($composer) {
$repo = new CompositeRepository($composer->getRepositoryManager()->getRepositories()); return array(
} else { $composer->getRepositoryManager()->getLocalRepository(),
$defaultRepos = Factory::createDefaultRepositories($this->getIO()); new CompositeRepository($composer->getRepositoryManager()->getRepositories())
$repo = new CompositeRepository($defaultRepos); );
} }
return $repo; $defaultRepos = Factory::createDefaultRepositories($this->getIO());
return array(new CompositeRepository($defaultRepos));
} }
} }