diff -r 1a3fa80225b2 -r 5a0cbbe0922a authserver/homestead/src/EditCommand.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/authserver/homestead/src/EditCommand.php Wed May 27 15:34:06 2015 +0200 @@ -0,0 +1,59 @@ +setName('edit') + ->setDescription('Edit the Homestead.yaml file'); + } + + /** + * 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); + }); + } + + /** + * Find the correct executable to run depending on the OS. + * + * @return string + */ + protected function executable() + { + if (strpos(strtoupper(PHP_OS), 'WIN') === 0) + { + return 'start'; + } + elseif (strpos(strtoupper(PHP_OS), 'DARWIN') === 0) + { + return 'open'; + } + + return 'xdg-open'; + } + +}