1
0
Fork 0

Remove all occurrences of getLocalDevRepository and getLocalRepositories calls

pull/1644/head
Jordi Boggiano 2013-03-03 01:54:14 +01:00
parent caf26ac37c
commit 542d10d8fd
5 changed files with 21 additions and 39 deletions

View File

@ -50,13 +50,11 @@ EOT
protected function execute(InputInterface $input, OutputInterface $output)
{
$repos = $this->getComposer()->getRepositoryManager()->getLocalRepositories();
$repo = $this->getComposer()->getRepositoryManager()->getLocalRepository();
$needle = $input->getArgument('package');
$pool = new Pool();
foreach ($repos as $repo) {
$pool->addRepository($repo);
}
$packages = $pool->whatProvides($needle);
if (empty($packages)) {
@ -75,7 +73,6 @@ EOT
}, $input->getOption('link-type'));
$messages = array();
foreach ($repos as $repo) {
$repo->filterPackages(function ($package) use ($needle, $types, $linkTypes, &$messages) {
static $outputPackages = array();
@ -90,7 +87,6 @@ EOT
}
}
});
}
if ($messages) {
sort($messages);

View File

@ -45,10 +45,10 @@ EOT
$composer = $this->getComposer();
$installationManager = $composer->getInstallationManager();
$localRepos = new CompositeRepository($composer->getRepositoryManager()->getLocalRepositories());
$localRepo = $composer->getRepositoryManager()->getLocalRepository();
$package = $composer->getPackage();
$config = $composer->getConfig();
$composer->getAutoloadGenerator()->dump($config, $localRepos, $package, $installationManager, 'composer', $input->getOption('optimize'));
$composer->getAutoloadGenerator()->dump($config, $localRepo, $package, $installationManager, 'composer', $input->getOption('optimize'));
}
}

View File

@ -45,7 +45,6 @@ class ShowCommand extends Command
new InputOption('platform', 'p', InputOption::VALUE_NONE, 'List platform packages only'),
new InputOption('available', 'a', InputOption::VALUE_NONE, 'List available packages only'),
new InputOption('self', 's', InputOption::VALUE_NONE, 'Show the root package information'),
new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables display of dev-require packages.'),
new InputOption('name-only', 'N', InputOption::VALUE_NONE, 'List package names only'),
))
->setHelp(<<<EOT
@ -63,15 +62,6 @@ EOT
// init repos
$platformRepo = new PlatformRepository;
$getRepositories = function (Composer $composer, $dev) {
$manager = $composer->getRepositoryManager();
$repos = new CompositeRepository(array($manager->getLocalRepository()));
if ($dev) {
$repos->addRepository($manager->getLocalDevRepository());
}
return $repos;
};
if ($input->getOption('self')) {
$package = $this->getComposer(false)->getPackage();
@ -79,7 +69,7 @@ EOT
} elseif ($input->getOption('platform')) {
$repos = $installedRepo = $platformRepo;
} elseif ($input->getOption('installed')) {
$repos = $installedRepo = $getRepositories($this->getComposer(), $input->getOption('dev'));
$repos = $installedRepo = $this->getComposer()->getRepositoryManager()->getLocalRepository();
} elseif ($input->getOption('available')) {
$installedRepo = $platformRepo;
if ($composer = $this->getComposer(false)) {
@ -90,7 +80,7 @@ EOT
$output->writeln('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
}
} elseif ($composer = $this->getComposer(false)) {
$localRepo = $getRepositories($composer, $input->getOption('dev'));
$localRepo = $composer = $this->getComposer()->getRepositoryManager()->getLocalRepository();
$installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
$repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
} else {

View File

@ -41,14 +41,13 @@ class InstallerInstaller extends LibraryInstaller
parent::__construct($io, $composer, 'composer-installer');
$this->installationManager = $composer->getInstallationManager();
foreach ($composer->getRepositoryManager()->getLocalRepositories() as $repo) {
$repo = $composer->getRepositoryManager()->getLocalRepository();
foreach ($repo->getPackages() as $package) {
if ('composer-installer' === $package->getType()) {
$this->registerInstaller($package);
}
}
}
}
/**
* {@inheritDoc}

View File

@ -155,10 +155,7 @@ class EventDispatcher
}
$generator = $this->composer->getAutoloadGenerator();
$packages = array_merge(
$this->composer->getRepositoryManager()->getLocalRepository()->getPackages(),
$this->composer->getRepositoryManager()->getLocalDevRepository()->getPackages()
);
$packages = $this->composer->getRepositoryManager()->getLocalRepository()->getPackages();
$packageMap = $generator->buildPackageMap($this->composer->getInstallationManager(), $package, $packages);
$map = $generator->parseAutoloads($packageMap, $package);
$this->loader = $generator->createLoader($map);