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;
|
||||
|
||||
use Composer\Factory;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
@ -57,21 +58,15 @@ EOT
|
|||
// init repos
|
||||
$platformRepo = new PlatformRepository;
|
||||
$io = $this->getIO();
|
||||
if ($composer = $this->getComposer(false)) {
|
||||
$localRepo = $composer->getRepositoryManager()->getLocalRepository();
|
||||
$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));
|
||||
if (!($composer = $this->getComposer(false))) {
|
||||
$composer = Factory::create($this->getIO(), array());
|
||||
}
|
||||
$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);
|
||||
$composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
|
||||
}
|
||||
$commandEvent = new CommandEvent(PluginEvents::COMMAND, 'search', $input, $output);
|
||||
$composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
|
||||
|
||||
$onlyName = $input->getOption('only-name');
|
||||
|
||||
|
|
Loading…
Reference in New Issue