Converts the PEAR package version number to a descriptive tag used on
bugs.horde.org.
public static pearToTicketDescription ( string $version ) : string | ||
$version | string | The PEAR package version. |
Результат | string | The description for bugs.horde.org. |
public function testFiveTwoOhRc2() { $this->assertEquals('5.2.0 Release Candidate 2', Components_Helper_Version::pearToTicketDescription('5.2.0RC2')); }
/** * Run the task. * * @param array &$options Additional options. * * @return NULL */ public function run(&$options) { if (!$this->_qid) { $this->getOutput()->warn('No queue on bugs.horde.org available. The new version will not be added to the bug tracker!'); return; } $ticket_version = $this->getComponent()->getVersion(); $ticket_description = Components_Helper_Version::pearToTicketDescription($this->getComponent()->getVersion()); $branch = $this->getNotes()->getBranch(); if (!empty($branch)) { $ticket_description = $branch . preg_replace('/([^ ]+) (.*)/', ' (\\1) \\2', $ticket_description); } $ticket_description = $this->getNotes()->getName() . ' ' . $ticket_description; if (!$this->getTasks()->pretend()) { try { $this->_getBugs($options)->addNewVersion($this->getComponent()->getName(), $ticket_version, $ticket_description); } catch (Horde_Exception $e) { $this->getOutput()->warn('Cannot update version on bugs.horde.org.'); $this->getOutput()->warn($e->getMessage()); } } else { $this->getOutput()->info(sprintf('Would add new version "%s: %s" to queue "%s".', $ticket_version, $ticket_description, $this->getComponent()->getName())); } }