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; } } }
/** * Set the component this task should act upon. * * @param Components_Component $component The component to be released. * * @return NULL */ public function setComponent(Components_Component $component) { $this->_component = $component; $this->_notes->setComponent($component); }