equal
deleted
inserted
replaced
|
1 <?php namespace Laravel\Homestead; |
|
2 |
|
3 use Symfony\Component\Process\Process; |
|
4 use Symfony\Component\Console\Command\Command; |
|
5 use Symfony\Component\Console\Input\InputOption; |
|
6 use Symfony\Component\Console\Input\InputInterface; |
|
7 use Symfony\Component\Console\Output\OutputInterface; |
|
8 |
|
9 class UpCommand extends Command { |
|
10 |
|
11 /** |
|
12 * Configure the command options. |
|
13 * |
|
14 * @return void |
|
15 */ |
|
16 protected function configure() |
|
17 { |
|
18 $this->setName('up') |
|
19 ->setDescription('Start the Homestead machine') |
|
20 ->addOption('provision', null, InputOption::VALUE_NONE, 'Run the provisioners on the box.'); |
|
21 } |
|
22 |
|
23 /** |
|
24 * Execute the command. |
|
25 * |
|
26 * @param \Symfony\Component\Console\Input\InputInterface $input |
|
27 * @param \Symfony\Component\Console\Output\OutputInterface $output |
|
28 * @return void |
|
29 */ |
|
30 public function execute(InputInterface $input, OutputInterface $output) |
|
31 { |
|
32 $command = 'vagrant up'; |
|
33 |
|
34 if ($input->getOption('provision')) |
|
35 $command .= ' --provision'; |
|
36 |
|
37 $process = new Process($command, realpath(__DIR__.'/../'), array_merge($_SERVER, $_ENV), null, null); |
|
38 |
|
39 $process->run(function($type, $line) use ($output) |
|
40 { |
|
41 $output->write($line); |
|
42 }); |
|
43 } |
|
44 |
|
45 } |