1
0
Fork 0

added --dev to create-project command (closes #645)

pull/723/head
Johannes M. Schmitt 2012-05-21 20:57:10 -05:00
parent 5567820beb
commit 305b9cee9a
1 changed files with 8 additions and 3 deletions

View File

@ -44,6 +44,7 @@ class CreateProjectCommand extends Command
new InputArgument('version', InputArgument::OPTIONAL, 'Version, will defaults to latest'), new InputArgument('version', InputArgument::OPTIONAL, 'Version, will defaults to latest'),
new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'), new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
new InputOption('repository-url', null, InputOption::VALUE_REQUIRED, 'Pick a different repository url to look for the package.'), new InputOption('repository-url', null, InputOption::VALUE_REQUIRED, 'Pick a different repository url to look for the package.'),
new InputOption('dev', null, InputOption::VALUE_NONE, 'Whether to install dependencies for development.')
)) ))
->setHelp(<<<EOT ->setHelp(<<<EOT
The <info>create-project</info> command creates a new project from a given The <info>create-project</info> command creates a new project from a given
@ -54,7 +55,9 @@ for developers of your project.
<info>php composer.phar create-project vendor/project target-directory [version]</info> <info>php composer.phar create-project vendor/project target-directory [version]</info>
To setup a developer workable version you should create the project using the source To setup a developer workable version you should create the project using the source
controlled code by appending the <info>'--prefer-source'</info> flag. controlled code by appending the <info>'--prefer-source'</info> flag. Also, it is
advisable to install all dependencies required for development by appending the
<info>'--dev'</info> flag.
To install a package from another repository repository than the default one you To install a package from another repository repository than the default one you
can pass the <info>'--repository-url=http://myrepository.org'</info> flag. can pass the <info>'--repository-url=http://myrepository.org'</info> flag.
@ -71,12 +74,13 @@ EOT
$input->getArgument('package'), $input->getArgument('package'),
$input->getArgument('directory'), $input->getArgument('directory'),
$input->getArgument('version'), $input->getArgument('version'),
(Boolean) $input->getOption('prefer-source'), $input->hasOption('prefer-source'),
$input->hasOption('dev'),
$input->getOption('repository-url') $input->getOption('repository-url')
); );
} }
public function installProject(IOInterface $io, $packageName, $directory = null, $version = null, $preferSource = false, $repositoryUrl = null) public function installProject(IOInterface $io, $packageName, $directory = null, $version = null, $preferSource = false, $installDevPackages = false, $repositoryUrl = null)
{ {
$dm = $this->createDownloadManager($io); $dm = $this->createDownloadManager($io);
if ($preferSource) { if ($preferSource) {
@ -124,6 +128,7 @@ EOT
$installer $installer
->setPreferSource($preferSource) ->setPreferSource($preferSource)
->setDevMode($installDevPackages)
->run(); ->run();
} }