Directly install dependencies
parent
24de082fd5
commit
36ccd38aa7
|
@ -15,6 +15,7 @@ namespace Composer\Command;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
|
use Symfony\Component\Console\Input\ArrayInput;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Composer\IO\IOInterface;
|
use Composer\IO\IOInterface;
|
||||||
use Composer\Factory;
|
use Composer\Factory;
|
||||||
|
@ -66,6 +67,7 @@ EOT
|
||||||
|
|
||||||
return $this->installProject(
|
return $this->installProject(
|
||||||
$io,
|
$io,
|
||||||
|
$this->getInstallCommand($input, $output),
|
||||||
$input->getArgument('package'),
|
$input->getArgument('package'),
|
||||||
$input->getArgument('directory'),
|
$input->getArgument('directory'),
|
||||||
$input->getArgument('version'),
|
$input->getArgument('version'),
|
||||||
|
@ -74,7 +76,16 @@ EOT
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function installProject(IOInterface $io, $packageName, $directory = null, $version = null, $preferSource = false, $repositoryUrl = null)
|
protected function getInstallCommand($input, $output)
|
||||||
|
{
|
||||||
|
$app = $this->getApplication();
|
||||||
|
return function() use ($app, $input, $output) {
|
||||||
|
$newInput = new ArrayInput(array('command' => 'install'));
|
||||||
|
$app->doRUn($newInput, $output);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public function installProject(IOInterface $io, $installCommand, $packageName, $directory = null, $version = null, $preferSource = false, $repositoryUrl = null)
|
||||||
{
|
{
|
||||||
$dm = $this->createDownloadManager($io);
|
$dm = $this->createDownloadManager($io);
|
||||||
if ($preferSource) {
|
if ($preferSource) {
|
||||||
|
@ -101,13 +112,13 @@ EOT
|
||||||
$directory = getcwd() . DIRECTORY_SEPARATOR . array_pop($parts);
|
$directory = getcwd() . DIRECTORY_SEPARATOR . array_pop($parts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$io->write('<info>Installing ' . $package->getName() . ' as new project.</info>', true);
|
||||||
$projectInstaller = new ProjectInstaller($directory, $dm);
|
$projectInstaller = new ProjectInstaller($directory, $dm);
|
||||||
$projectInstaller->install($package);
|
$projectInstaller->install($package);
|
||||||
|
|
||||||
$io->write('Created new project directory for ' . $package->getName(), true);
|
$io->write('<info>Created project into directory ' . $directory . '</info>', true);
|
||||||
$io->write('Next steps:', true);
|
chdir($directory);
|
||||||
$io->write('1. cd ' . $directory, true);
|
$installCommand();
|
||||||
$io->write('2. composer install', true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function createDownloadManager(IOInterface $io)
|
protected function createDownloadManager(IOInterface $io)
|
||||||
|
|
Loading…
Reference in New Issue