Пример #1
0
 /**
  * Get the twig environment
  *
  * @return \Twig_Environment
  */
 protected function getTwig()
 {
     if (null === $this->twig) {
         $templatePath = realpath(breeze_app_path() . DIRECTORY_SEPARATOR . 'templates');
         $loader = new \Twig_Loader_Filesystem($templatePath);
         $this->twig = new \Twig_Environment($loader);
     }
     return $this->twig;
 }
Пример #2
0
 /**
  * Run the input and output through the vagrant machine
  *
  * @param  \Symfony\Component\Console\Input\InputInterface  $input
  * @param  \Symfony\Component\Console\Output\OutputInterface  $output
  * @return integer
  */
 public function run(InputInterface $input, OutputInterface $output)
 {
     $builder = new ProcessBuilder();
     $builder->setPrefix('breeze');
     $builder->setArguments(array_slice($_SERVER['argv'], 1));
     $script = $builder->getProcess()->getCommandLine();
     // change to the root directory
     chdir(breeze_app_path());
     // build the ssh command
     $ssh = $this->setEnvironmentCommand() . " vagrant ssh -c \"cat <<PROXY | sh" . PHP_EOL . $script . PHP_EOL . "PROXY\" -- -o StrictHostKeyChecking=no -o ForwardAgent=yes";
     return passthru($ssh);
 }
Пример #3
0
 /**
  * Run the given vagrant command
  *
  * @param  string $script
  * @param  \Symfony\Component\Console\Output\OutputInterface $output
  * @return integer
  */
 public function run($command, OutputInterface $output)
 {
     // define segments of output from typical vagrant commands that should
     // be replaced with the breeze equivalent
     $replaceLines = ['vagrant halt' => 'breeze halt', 'vagrant suspend' => 'breeze suspend', 'vagrant up' => 'breeze up', 'vagrant destroy' => 'breeze destroy', 'vagrant reload' => 'breeze reload', 'vagrant status' => 'breeze status', 'vagrant provision' => 'breeze provision'];
     $process = new Process($this->setEnvironmentCommand() . ' vagrant ' . $command, breeze_app_path(), array_merge($_SERVER, $_ENV), null, null);
     return $process->run(function ($type, $buffer) use($output, $replaceLines) {
         foreach ($replaceLines as $search => $replace) {
             if (strpos($buffer, $search) !== false) {
                 $buffer = str_replace($search, $replace, $buffer);
             }
         }
         $output->write($buffer);
     });
 }
Пример #4
0
 /**
  * Execute the command.
  *
  * @return void
  */
 public function fire()
 {
     $basePath = breeze_config_path();
     if (is_dir($basePath)) {
         $this->output->writeln(sprintf('Breeze directory %s already exists. Skipping...', $basePath));
     } else {
         $this->output->writeln(sprintf('Creating breeze configuration directory %s... <info>✔</info>', $basePath));
         mkdir($basePath);
     }
     $sitesPath = $basePath . DIRECTORY_SEPARATOR . 'sites-available';
     if (is_dir($sitesPath)) {
         $this->output->writeln('Breeze sites directory already exists. Skipping...');
     } else {
         $this->output->writeln('Creating breeze sites directory... <info>✔</info>');
         mkdir($sitesPath);
     }
     $configFile = $basePath . DIRECTORY_SEPARATOR . 'Breeze.yaml';
     if (file_exists($configFile)) {
         $this->output->writeln('Breeze.yaml file already exists. Skipping...');
     } else {
         $this->output->writeln('Creating Breeze.yaml file... <info>✔</info>');
         copy(breeze_app_path() . '/stubs/Breeze.yaml', $configFile);
     }
 }
Пример #5
0
 /**
  * Execute the command.
  *
  * @return void
  */
 public function fire()
 {
     chdir(breeze_app_path());
     passthru($this->setEnvironmentCommand() . ' vagrant ssh');
 }