Copyright 2010-2016 Horde LLC (http://www.horde.org/) See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
저자: Gunnar Wrobel (wrobel@pardus.de)
예제 #1
0
파일: Tasks.php 프로젝트: jubinpatel/horde
 /**
  * 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");
     }
 }
예제 #2
0
파일: Tasks.php 프로젝트: raz0rsdge/horde
 /**
  * Run a sequence of release tasks.
  *
  * @param array                $sequence The task sequence.
  * @param Components_Component $component The component to be released.
  * @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);
     }
     $errors = array();
     $selected_tasks = array();
     foreach ($task_sequence as $task) {
         $task_errors = $task->validate($options);
         if (!empty($task_errors)) {
             if ($task->skip($options)) {
                 $this->_dependencies->getOutput()->warn(sprintf("Deactivated task \"%s\":\n\n%s", $task->getName(), join("\n", $task_errors)));
             } else {
                 $errors = array_merge($errors, $task_errors);
             }
         } else {
             $selected_tasks[] = $task;
         }
     }
     if (!empty($errors)) {
         throw new Components_Exception("Unable to release:\n\n" . join("\n", $errors));
     }
     foreach ($selected_tasks as $task) {
         $task->run($options);
     }
 }
예제 #3
0
 /**
  * Determine the requested component.
  *
  * @param array $arguments The arguments.
  *
  * @return array Two elements: The selected component as
  *               Components_Component instance and optionally a string
  *               representing the path to the specified source component.
  */
 private function _determineComponent($arguments)
 {
     if (isset($arguments[0])) {
         if (in_array($arguments[0], $this->_actions['missing_argument'])) {
             return;
         }
         if ($this->_isPackageXml($arguments[0])) {
             $this->_config->shiftArgument();
             return array($this->_dependencies->getComponentFactory()->createSource(dirname($arguments[0])), dirname($arguments[0]));
         }
         if (!in_array($arguments[0], $this->_actions['list'])) {
             if ($this->_isDirectory($arguments[0])) {
                 $this->_config->shiftArgument();
                 return array($this->_dependencies->getComponentFactory()->createSource($arguments[0]), $arguments[0]);
             }
             $options = $this->_config->getOptions();
             if (!empty($options['allow_remote'])) {
                 $result = $this->_dependencies->getComponentFactory()->getResolver()->resolveName($arguments[0], 'pear.horde.org', $options);
                 if ($result !== false) {
                     $this->_config->shiftArgument();
                     return array($result, '');
                 }
             }
             throw new Components_Exception(sprintf(Components::ERROR_NO_ACTION_OR_COMPONENT, $arguments[0]));
         }
     }
     $cwd = getcwd();
     if ($this->_isDirectory($cwd) && $this->_containsPackageXml($cwd)) {
         return array($this->_dependencies->getComponentFactory()->createSource($cwd), $cwd);
     }
     throw new Components_Exception(Components::ERROR_NO_COMPONENT);
 }
예제 #4
0
파일: Components.php 프로젝트: horde/horde
    private static function _prepareModular(Components_Dependencies $dependencies, array $parameters = array())
    {
        $modular = new Horde_Cli_Modular(array('parser' => array('class' => empty($parameters['parser']['class']) ? 'Horde_Argv_Parser' : $parameters['parser']['class'], 'usage' => '[options] [COMPONENT_PATH] [ACTION] [ARGUMENTS]

COMPONENT_PATH

Specifies the path to the component you want to work with. This argument is optional in case your current working directory is the base directory of a component and contains a package.xml file.

ACTION

Selects the action to perform. Most actions can also be selected with an option switch.

This is a list of available actions (use "help ACTION" to get additional information on the specified ACTION):

'), 'modules' => array('directory' => __DIR__ . '/Components/Module', 'exclude' => 'Base'), 'provider' => array('prefix' => 'Components_Module_', 'dependencies' => $dependencies)));
        $dependencies->setModules($modular);
        return $modular;
    }