Esempio n. 1
0
 protected function runTasks(InputInterface $input, OutputInterface $output)
 {
     $output->writeDebug("Starting Task Runner...");
     $runner = new TaskRunner($this, $input, $output);
     $runner->addTask(new InitialSetupTask());
     $runner->addTask(new InitTask());
     $runner->addTask(new ConfigDefaultsTask());
     $runner->addTask(new ConfigSyncTask());
     $runner->addTask(new PackagesTask());
     $runner->addTask(new PhpTask());
     $runner->addTask(new ProjectsInitTask());
     $runner->addTask(new ProjectsProcessTask());
     $runner->addTask(new ProjectsEndTask());
     $runner->addTask(new ServiceRestartTask());
     $runner->addTask(new ConfigDefaultsTask());
     $runner->addTask(new ConfigSyncTask());
     $runner->addTask(new EndTask());
     $runner->run();
 }
Esempio n. 2
0
 /**
  * @param string $command
  * @param OutputInterface $output
  * @param array $options Process options, includes:
  *  bool logfile
  *  bool stderr
  *  bool stdout
  *  int timeout
  *  string input
  *  array env
  *  string cwd
  * @return Process
  */
 public static function process(OutputInterface $output, $command, array $options = [])
 {
     $options = array_merge(['stderr' => true, 'stdout' => $output->isDebug(), 'timeout' => 60, 'input' => null, 'env' => null, 'cwd' => null, 'logfile' => null], $options);
     $output->writeDebug(str_repeat('-', 55));
     $output->writeDebug("Executing command: {$command}");
     $output->writeDebug(str_repeat('-', 55));
     $process = new Process($command, $options['cwd'], $options['env'], $options['input'], $options['timeout']);
     $process->run(function ($type, $buffer) use($output, $options) {
         if ($type === Process::ERR) {
             if ($options['stderr']) {
                 $output->writeStderr($buffer);
             }
             return;
         }
         if (!$options['stdout']) {
             return;
         }
         $buffer = trim($buffer, "\n");
         if (empty($buffer)) {
             return;
         }
         $output->writeStdout($buffer);
     });
     $output->writeDebug(str_repeat('-', 55));
     return $process;
 }