getArguments() public method

Return the arguments provided by the configuration handlers.
public getArguments ( ) : array
return array An array of arguments.
示例#1
0
 public function run()
 {
     $arguments = $this->_config->getArguments();
     $options = array_merge(array('new_version' => false, 'new_api' => false, 'new_state' => false, 'new_apistate' => false), $this->_config->getOptions());
     if (!empty($options['updatexml']) || isset($arguments[0]) && $arguments[0] == 'update') {
         $action = !empty($options['action']) ? $options['action'] : 'update';
         if (!empty($options['pretend']) && $action == 'update') {
             $action = 'diff';
         }
         if (!empty($options['commit'])) {
             $options['commit'] = new Components_Helper_Commit($this->_output, $options);
         }
         $result = $this->_config->getComponent()->updatePackageXml($action, $options);
         if (!empty($options['new_version']) || !empty($options['new_api'])) {
             $this->_config->getComponent()->setVersion($options['new_version'], $options['new_api'], $options);
         }
         if (!empty($options['new_state']) || !empty($options['new_apistate'])) {
             $this->_config->getComponent()->setState($options['new_state'], $options['new_apistate'], $options);
         }
         if (!empty($options['commit'])) {
             $options['commit']->commit('Components updated the package.xml.');
         }
         if ($result === true) {
             $this->_output->ok('Successfully updated package.xml of ' . $this->_config->getComponent()->getName() . '.');
         } else {
             print $result;
         }
     }
 }
示例#2
0
 /**
  * Inject the component selected based on the command arguments into the
  * configuration.
  *
  * @return NULL.
  */
 public function setComponentInConfiguration()
 {
     $arguments = $this->_config->getArguments();
     if (list($component, $path) = $this->_determineComponent($arguments)) {
         $this->_config->setComponent($component);
         $this->_config->setPath($path);
     }
 }
示例#3
0
文件: Qc.php 项目: jubinpatel/horde
 /**
  * Did the user activate the given task?
  *
  * @param string $task The task name.
  *
  * @return boolean True if the task is active.
  */
 private function _doTask($task)
 {
     $arguments = $this->_config->getArguments();
     if (count($arguments) == 1 && $arguments[0] == 'qc' || in_array($task, $arguments)) {
         return true;
     }
     return false;
 }
示例#4
0
 public function run()
 {
     $options = $this->_config->getOptions();
     $arguments = $this->_config->getArguments();
     if (count($arguments) > 1 && $arguments[0] == 'changed') {
         $log = $arguments[1];
     } else {
         throw new Components_Exception('Please provide a change log entry as additional argument!');
     }
     if (!empty($options['commit'])) {
         $options['commit'] = new Components_Helper_Commit($this->_output, $options);
     }
     $this->_config->getComponent()->changed($log, $this->_helper, $options);
     if (!empty($options['commit'])) {
         $options['commit']->commit($log);
     }
 }
示例#5
0
文件: Update.php 项目: horde/horde
 public function run()
 {
     $arguments = $this->_config->getArguments();
     $options = array_merge(array('new_version' => false, 'new_api' => false, 'new_state' => false, 'new_apistate' => false), $this->_config->getOptions());
     if (!empty($options['updatexml']) || isset($arguments[0]) && $arguments[0] == 'update') {
         $action = !empty($options['action']) ? $options['action'] : 'update';
         if (!empty($options['pretend']) && $action == 'update') {
             $action = 'diff';
         }
         if (!empty($options['commit'])) {
             $options['commit'] = new Components_Helper_Commit($this->_output, $options);
         }
         $result = $this->_config->getComponent()->updatePackageXml($action, $options);
         if (!empty($options['new_version']) || !empty($options['new_api'])) {
             $this->_config->getComponent()->setVersion($options['new_version'], $options['new_api'], $options);
             if (!empty($options['new_version']) && !empty($options['sentinel'])) {
                 $notes = new Components_Release_Notes($this->_output);
                 $notes->setComponent($this->_config->getComponent());
                 $application_version = Components_Helper_Version::pearToHordeWithBranch($options['new_version'] . '-git', $notes->getBranch());
                 $sentinel_result = $this->_config->getComponent()->currentSentinel($options['new_version'] . '-git', $application_version, $options);
                 foreach ($sentinel_result as $file) {
                     $this->_output->ok($file);
                 }
             }
         }
         if (!empty($options['new_state']) || !empty($options['new_apistate'])) {
             $this->_config->getComponent()->setState($options['new_state'], $options['new_apistate'], $options);
         }
         if (!empty($options['commit'])) {
             $options['commit']->commit('Components updated the package.xml.');
         }
         if ($result === true) {
             $this->_output->ok('Successfully updated package.xml of ' . $this->_config->getComponent()->getName() . '.');
         } else {
             print $result;
         }
     }
 }
示例#6
0
文件: Help.php 项目: jubinpatel/horde
 /**
  * Determine if this module should act. Run all required actions if it has
  * been instructed to do so.
  *
  * @param Components_Config $config The configuration.
  *
  * @return boolean True if the module performed some action.
  */
 public function handle(Components_Config $config)
 {
     $arguments = $config->getArguments();
     if (isset($arguments[0]) && $arguments[0] == 'help') {
         if (isset($arguments[1])) {
             $action = $arguments[1];
         } else {
             $action = '';
         }
         $modules = $this->_dependencies->getModules();
         foreach ($modules->getModules()->listModules() as $module) {
             $element = $modules->getProvider()->getModule($module);
             if (in_array($action, $element->getActions())) {
                 $title = "ACTION \"" . $action . "\"";
                 $sub = str_repeat('-', strlen($title));
                 $help = "\n" . $title . "\n" . $sub . "\n\n";
                 $help .= Horde_String::wordwrap($element->getHelp($action), 75, "\n", true);
                 $options = $element->getContextOptionHelp();
                 if (!empty($options)) {
                     $formatter = new Horde_Argv_IndentedHelpFormatter();
                     $parser = $this->_dependencies->getParser();
                     $title = "OPTIONS for \"" . $action . "\"";
                     $sub = str_repeat('-', strlen($title));
                     $help .= "\n\n\n" . $title . "\n" . $sub . "";
                     foreach ($options as $option => $help_text) {
                         $argv_option = $parser->getOption($option);
                         $help .= "\n\n    " . $formatter->formatOptionStrings($argv_option) . "\n\n      ";
                         if (empty($help_text)) {
                             $help .= Horde_String::wordwrap($argv_option->help, 75, "\n      ", true);
                         } else {
                             $help .= Horde_String::wordwrap($help_text, 75, "\n      ", true);
                         }
                     }
                 }
                 $help .= "\n";
                 $this->_dependencies->getOutput()->help($help);
                 return true;
             }
         }
         return false;
     }
 }
示例#7
0
 /**
  * Determine if this module should act. Run all required actions if it has
  * been instructed to do so.
  *
  * @param Components_Config $config The configuration.
  *
  * @return boolean True if the module performed some action.
  */
 public function handle(Components_Config $config)
 {
     $options = $config->getOptions();
     $arguments = $config->getArguments();
     if (!empty($options['webdocs']) || isset($arguments[0]) && $arguments[0] == 'webdocs') {
         $this->_dependencies->getRunnerWebdocs()->run();
         return true;
     }
 }