Merge pull request #5026 from curry684/issue-4392
Simulate dummy Composer when searching in uninitialized folderpull/4737/head
commit
e8abc90b92
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
namespace Composer\Command;
|
namespace Composer\Command;
|
||||||
|
|
||||||
|
use Composer\Factory;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
|
@ -57,21 +58,15 @@ EOT
|
||||||
// init repos
|
// init repos
|
||||||
$platformRepo = new PlatformRepository;
|
$platformRepo = new PlatformRepository;
|
||||||
$io = $this->getIO();
|
$io = $this->getIO();
|
||||||
if ($composer = $this->getComposer(false)) {
|
if (!($composer = $this->getComposer(false))) {
|
||||||
$localRepo = $composer->getRepositoryManager()->getLocalRepository();
|
$composer = Factory::create($this->getIO(), array());
|
||||||
$installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
|
|
||||||
$repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
|
|
||||||
} else {
|
|
||||||
$defaultRepos = RepositoryFactory::defaultRepos($io);
|
|
||||||
$io->writeError('No composer.json found in the current directory, showing packages from ' . implode(', ', array_keys($defaultRepos)));
|
|
||||||
$installedRepo = $platformRepo;
|
|
||||||
$repos = new CompositeRepository(array_merge(array($installedRepo), $defaultRepos));
|
|
||||||
}
|
}
|
||||||
|
$localRepo = $composer->getRepositoryManager()->getLocalRepository();
|
||||||
|
$installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
|
||||||
|
$repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
|
||||||
|
|
||||||
if ($composer) {
|
$commandEvent = new CommandEvent(PluginEvents::COMMAND, 'search', $input, $output);
|
||||||
$commandEvent = new CommandEvent(PluginEvents::COMMAND, 'search', $input, $output);
|
$composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
|
||||||
$composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
|
|
||||||
}
|
|
||||||
|
|
||||||
$onlyName = $input->getOption('only-name');
|
$onlyName = $input->getOption('only-name');
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue