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\InputInterface; |
|
6 use Symfony\Component\Console\Output\OutputInterface; |
|
7 |
|
8 class InitCommand extends Command { |
|
9 |
|
10 /** |
|
11 * Configure the command options. |
|
12 * |
|
13 * @return void |
|
14 */ |
|
15 protected function configure() |
|
16 { |
|
17 $this->setName('init') |
|
18 ->setDescription('Create a stub Homestead.yaml file'); |
|
19 } |
|
20 |
|
21 /** |
|
22 * Execute the command. |
|
23 * |
|
24 * @param \Symfony\Component\Console\Input\InputInterface $input |
|
25 * @param \Symfony\Component\Console\Output\OutputInterface $output |
|
26 * @return void |
|
27 */ |
|
28 public function execute(InputInterface $input, OutputInterface $output) |
|
29 { |
|
30 if (is_dir(homestead_path())) |
|
31 { |
|
32 throw new \InvalidArgumentException("Homestead has already been initialized."); |
|
33 } |
|
34 |
|
35 mkdir(homestead_path()); |
|
36 |
|
37 copy(__DIR__.'/stubs/Homestead.yaml', homestead_path().'/Homestead.yaml'); |
|
38 copy(__DIR__.'/stubs/after.sh', homestead_path().'/after.sh'); |
|
39 copy(__DIR__.'/stubs/aliases', homestead_path().'/aliases'); |
|
40 |
|
41 $output->writeln('<comment>Creating Homestead.yaml file...</comment> <info>✔</info>'); |
|
42 $output->writeln('<comment>Homestead.yaml file created at:</comment> '.homestead_path().'/Homestead.yaml'); |
|
43 } |
|
44 |
|
45 } |