Only increments if the old version is a stable version. Increments the
release state suffix instead otherwise.
public static nextPearVersion ( string $version ) : string | ||
$version | string | A version number. |
Результат | string | The incremented version number. |
/** * Run the task. * * @param array &$options Additional options. * * @return NULL */ public function run(&$options) { if (empty($options['next_version'])) { if (empty($options['old_version'])) { $options['old_version'] = $this->getComponent()->getVersion(); } $next_version = Components_Helper_Version::nextPearVersion($options['old_version']); } else { $next_version = $options['next_version']; } if (isset($options['commit'])) { $options['commit']->commit('Development mode for ' . $this->getComponent()->getName() . '-' . Components_Helper_Version::validatePear($next_version)); } }
/** * Run the task. * * @param array &$options Additional options. * * @return NULL */ public function run(&$options) { $api_state = isset($options['next_apistate']) ? $options['next_apistate'] : null; $rel_state = isset($options['next_relstate']) ? $options['next_relstate'] : null; if (empty($options['next_version'])) { if (empty($options['old_version'])) { $options['old_version'] = $this->getComponent()->getVersion(); } $next_version = Components_Helper_Version::nextPearVersion($options['old_version']); } else { $next_version = $options['next_version']; } $result = $this->getComponent()->nextVersion(Components_Helper_Version::validatePear($next_version), $options['next_note'], $api_state, $rel_state, $options); if (!$this->getTasks()->pretend()) { $this->getOutput()->ok($result); } else { $this->getOutput()->info($result); } }
public function testNextPearVersion() { $this->assertEquals('5.0.1', Components_Helper_Version::nextPearVersion('5.0.0')); $this->assertEquals('5.0.0RC2', Components_Helper_Version::nextPearVersion('5.0.0RC1')); $this->assertEquals('5.0.0alpha2', Components_Helper_Version::nextPearVersion('5.0.0alpha1')); }