Also attaches -git suffix and increments only if the old version is a
stable version.
public static nextVersion ( string $version ) : string | ||
$version | string | A version number. |
return | 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::nextVersion($options['old_version']); } else { $next_version = $options['next_version']; } $changes_version = $next_version; $application_version = Components_Helper_Version::pearToHordeWithBranch($next_version, $this->getNotes()->getBranch()); $result = $this->getComponent()->nextSentinel($changes_version, $application_version, $options); if (!$this->getTasks()->pretend()) { foreach ($result as $message) { $this->getOutput()->ok($message); } } else { foreach ($result as $message) { $this->getOutput()->info($message); } } }
public function testNextVersion() { $this->assertEquals('5.0.1-git', Components_Helper_Version::nextVersion('5.0.0')); $this->assertEquals('5.0.0-git', Components_Helper_Version::nextVersion('5.0.0RC1')); $this->assertEquals('5.0.0-git', Components_Helper_Version::nextVersion('5.0.0alpha1')); }