2 namespace Robo\Task\Composer;
5 * Composer CreateProject
10 * $this->taskComposerCreateProject()->source('foo/bar')->target('myBar')->run();
14 class CreateProject extends Base
19 protected $action = 'create-project';
22 protected $target = '';
23 protected $version = '';
28 public function source($source)
30 $this->source = $source;
37 public function target($target)
39 $this->target = $target;
46 public function version($version)
48 $this->version = $version;
52 public function keepVcs($keep = true)
55 $this->option('--keep-vcs');
60 public function noInstall($noInstall = true)
63 $this->option('--no-install');
71 public function repository($repository)
73 if (!empty($repository)) {
74 $this->option('repository', $repository);
82 public function stability($stability)
84 if (!empty($stability)) {
85 $this->option('stability', $stability);
90 public function buildCommand()
92 $this->arg($this->source);
93 if (!empty($this->target)) {
94 $this->arg($this->target);
96 if (!empty($this->version)) {
97 $this->arg($this->version);
100 return parent::buildCommand();
106 public function run()
108 $command = $this->getCommand();
109 $this->printTaskInfo('Creating project: {command}', ['command' => $command]);
110 return $this->executeCommand($command);