Example #1
0
 /**
  * Return the named task.
  *
  * @param string                  $name      The name of the task.
  * @param Components_Component    $component The component to be released.
  *
  * @return Components_Release_Task The task.
  */
 public function getTask($name, Components_Component $component)
 {
     $task = $this->_dependencies->getInstance('Components_Release_Task_' . ucfirst($name));
     $task->setComponent($component);
     $task->setName($name);
     return $task;
 }
Example #2
0
 /**
  * Run a sequence of qc tasks.
  *
  * @param array                $sequence The task sequence.
  * @param Components_Component $component The component to be checked.
  * @param array                $options  Additional options.
  *
  * @return NULL
  */
 public function run(array $sequence, Components_Component $component, $options = array())
 {
     $this->_options = $options;
     $this->_sequence = $sequence;
     $task_sequence = array();
     foreach ($sequence as $name) {
         $task_sequence[] = $this->getTask($name, $component);
     }
     $selected_tasks = array();
     foreach ($task_sequence as $task) {
         $task_errors = $task->validate($options);
         if (!empty($task_errors)) {
             $this->_dependencies->getOutput()->warn(sprintf("Deactivated task \"%s\":\n\n%s", $task->getName(), join("\n", $task_errors)));
         } else {
             $selected_tasks[] = $task;
         }
     }
     $output = $this->_dependencies->getInstance('Components_Output');
     foreach ($selected_tasks as $task) {
         $output->bold(str_repeat('-', 30));
         $output->ok('Running ' . $task->getName() . ' on ' . $component->getName() . "\n");
         $numErrors = $task->run($options);
         $output->plain('');
         if ($numErrors == 1) {
             $output->warn("{$numErrors} error!");
         } else {
             if ($numErrors) {
                 $output->warn("{$numErrors} errors!");
             } else {
                 $output->ok('No problems found.');
             }
         }
         $output->bold(str_repeat('-', 30) . "\n");
     }
 }