/** * Execute the command. * * @param \Symfony\Component\Console\Input\InputInterface $input * @param \Symfony\Component\Console\Output\OutputInterface $output * @return void */ public function execute(InputInterface $input, OutputInterface $output) { $command = $this->executable() . ' ' . homestead_path() . '/Homestead.yaml'; $process = new Process($command, realpath(__DIR__ . '/../'), array_merge($_SERVER, $_ENV), null, null); $process->run(function ($type, $line) use($output) { $output->write($line); }); }
/** * Execute the command. * * @param \Symfony\Component\Console\Input\InputInterface $input * @param \Symfony\Component\Console\Output\OutputInterface $output * @return void */ public function execute(InputInterface $input, OutputInterface $output) { if (is_dir(homestead_path())) { throw new \InvalidArgumentException("Homestead has already been initialized."); } mkdir(homestead_path()); copy(__DIR__ . '/stubs/Homestead.yaml', homestead_path() . '/Homestead.yaml'); copy(__DIR__ . '/stubs/after.sh', homestead_path() . '/after.sh'); copy(__DIR__ . '/stubs/aliases', homestead_path() . '/aliases'); $output->writeln('<comment>Creating Homestead.yaml file...</comment> <info>✔</info>'); $output->writeln('<comment>Homestead.yaml file created at:</comment> ' . homestead_path() . '/Homestead.yaml'); }
/** * Execute the command. * * @param \Symfony\Component\Console\Input\InputInterface $input * @param \Symfony\Component\Console\Output\OutputInterface $output * @return void */ public function execute(InputInterface $input, OutputInterface $output) { $file = 'Homestead.yaml'; if ($input->getArgument('file') === 'aliases') { $file = 'aliases'; } $command = $this->executable() . ' ' . homestead_path() . '/' . $file; $process = new Process($command, realpath(__DIR__ . '/../'), array_merge($_SERVER, $_ENV), null, null); $process->run(function ($type, $line) use($output) { $output->write($line); }); }
/** * Execute the command. * * @param \Symfony\Component\Console\Input\InputInterface $input * @param \Symfony\Component\Console\Output\OutputInterface $output * @return void */ public function execute(InputInterface $input, OutputInterface $output) { $file = homestead_path() . '/Homestead.yaml'; $parse = new Parser(); $value = $parse->parse(file_get_contents($file)); $value['sites'][] = ['map' => $input->getArgument('map'), 'to' => $input->getArgument('to')]; $dumper = new Dumper(); $yaml = $dumper->dump($value, 3); file_put_contents($file, $yaml); file_put_contents('/etc/hosts', '192.168.10.10 ' . $input->getArgument('map'), FILE_APPEND); $provision = new ProvisionCommand(); $provision->execute($input, $output); }