示例#1
0
 /**
  * @param  string                   $taskConfigPath path to the tasks configuration in the conveyor.yml config
  * @param  TaskFactory              $taskFactory
  * @param  YamlConfig               $config
  * @param  IOInterface              $io
  * @param  EventDispatcherInterface $dispatcher
  * @return TaskRunner
  */
 public static function get($taskConfigPath, TaskFactory $taskFactory, YamlConfig $config, IOInterface $io, EventDispatcherInterface $dispatcher = null)
 {
     $_config = $config->getConfig();
     $taskRunner = new TaskRunner($io, $dispatcher);
     foreach ((array) self::getTasksConfig($_config, $taskConfigPath) as $t => $taskConfig) {
         $task = $taskFactory->get($taskConfig['type'], $taskConfig);
         $taskRunner->addTask($task);
     }
     return $taskRunner;
 }
示例#2
0
 /**
  * Filters the tasks for given target
  *
  * @param  string                                 $target
  * @param  \Webcreate\Conveyor\Repository\Version $version
  * @return \Webcreate\Conveyor\Task\Task[]        task for the specific target
  */
 protected function getSupportedTasks($target, Version $version)
 {
     $tasks = array_filter($this->taskRunner->getTasks(), function ($task) use($target, $version) {
         return true === $task->supports($target, $version);
     });
     // reindex
     $tasks = array_values($tasks);
     return $tasks;
 }