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;
}
}
}