Exemplo n.º 1
0
 /**
  * @param string $name
  * @param array  $arguments
  *
  * @throws GulpBadTaskConfigurationException
  * @throws GulpUndefinedTaskException
  */
 public static function __callStatic($name, $arguments)
 {
     $taskName = Inflector::camelCaseToDaseCase($name);
     /** @var Event $event */
     list($event) = $arguments;
     $gulpTasks = self::getOption('gulp-tasks', $event);
     if (!isset($gulpTasks[$taskName])) {
         throw new GulpUndefinedTaskException(sprintf('Gulp %s task is not defined.', $taskName));
     }
     // get gulp options
     $gulpBin = self::getOption('gulp-bin', $event);
     $logPrepend = self::getOption('gulp-log-prepend', $event);
     // get task options
     $taskOptions = $gulpTasks[$taskName];
     if (empty($taskOptions['command'])) {
         throw new GulpBadTaskConfigurationException(sprintf('Gulp %s task command option must be defined.', $taskName));
     }
     $command = [$gulpBin, $taskOptions['command'], isset($taskOptions['params']) ? $taskOptions['params'] : ''];
     $failOnError = empty($taskOptions['fail-on-error']) ? false : $taskOptions['fail-on-error'];
     if (!$failOnError) {
         $command[] = '|| true';
     }
     // execute process
     $process = new Process(implode(' ', $command), null, null, null, null, []);
     $process->mustRun(function ($type, $buffer) use($event, $logPrepend) {
         self::writeProcessBuffer($type, $buffer, $event, $logPrepend);
     });
 }
Exemplo n.º 2
0
 /**
  * @param string $name
  * @param array  $arguments
  *
  * @throws \Exception
  */
 public static function __callStatic($name, $arguments)
 {
     $taskName = Inflector::camelCaseToDaseCase($name);
     /** @var Event $event */
     list($event) = $arguments;
     $bin = self::getOption('phpunit-bin', $event);
     $configs = self::getOption('phpunit-tasks', $event);
     $config = isset($configs[$taskName]) ? $configs[$taskName] : [];
     $logPrepend = self::getOption('phpunit-log-prepend', $event);
     $command = array($bin);
     if (!empty($config['config'])) {
         $command[] = '-c ' . $config['config'];
     }
     $process = new Process(implode(' ', $command), null, null, null, null, []);
     $process->mustRun(function ($type, $buffer) use($event, $logPrepend) {
         self::writeProcessBuffer($type, $buffer, $event, $logPrepend);
     });
 }