1
0
Fork 0

Code cleanup

pull/498/merge
Jordi Boggiano 2012-04-09 16:07:10 +02:00
parent 8654c43c62
commit 61708a1bb1
1 changed files with 4 additions and 6 deletions

View File

@ -65,14 +65,12 @@ EOT
protected function execute(InputInterface $input, OutputInterface $output) protected function execute(InputInterface $input, OutputInterface $output)
{ {
$io = $this->getIO();
return $this->installProject( return $this->installProject(
$io, $this->getIO(),
$input->getArgument('package'), $input->getArgument('package'),
$input->getArgument('directory'), $input->getArgument('directory'),
$input->getArgument('version'), $input->getArgument('version'),
(Boolean)$input->getOption('prefer-source'), (Boolean) $input->getOption('prefer-source'),
$input->getOption('repository-url') $input->getOption('repository-url')
); );
} }
@ -85,11 +83,11 @@ EOT
} }
if (null === $repositoryUrl) { if (null === $repositoryUrl) {
$sourceRepo = new ComposerRepository(array('url' => 'http://packagist.org'), $this->getIO()); $sourceRepo = new ComposerRepository(array('url' => 'http://packagist.org'), $io);
} elseif (".json" === substr($repositoryUrl, -5)) { } elseif (".json" === substr($repositoryUrl, -5)) {
$sourceRepo = new FilesystemRepository(new JsonFile($repositoryUrl, new RemoteFilesystem($io))); $sourceRepo = new FilesystemRepository(new JsonFile($repositoryUrl, new RemoteFilesystem($io)));
} elseif (0 === strpos($repositoryUrl, 'http')) { } elseif (0 === strpos($repositoryUrl, 'http')) {
$sourceRepo = new ComposerRepository(array('url' => $repositoryUrl), $this->getIO()); $sourceRepo = new ComposerRepository(array('url' => $repositoryUrl), $io);
} else { } else {
throw new \InvalidArgumentException("Invalid repository url given. Has to be a .json file or an http url."); throw new \InvalidArgumentException("Invalid repository url given. Has to be a .json file or an http url.");
} }