예제 #1
0
 /**
  * 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));
     }
 }
예제 #2
0
 /**
  * Run the task.
  *
  * @param array &$options Additional options.
  *
  * @return NULL
  */
 public function run(&$options)
 {
     $changes_version = $this->getComponent()->getVersion();
     $application_version = Components_Helper_Version::pearToHordeWithBranch($this->getComponent()->getVersion(), $this->getNotes()->getBranch());
     $result = $this->getComponent()->currentSentinel($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);
         }
     }
 }
예제 #3
0
파일: NextVersion.php 프로젝트: horde/horde
 /**
  * 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);
     }
 }
예제 #4
0
파일: Package.php 프로젝트: raz0rsdge/horde
 /**
  * Validate the preconditions required for this release task.
  *
  * @param array $options Additional options.
  *
  * @return array An empty array if all preconditions are met and a list of
  *               error messages otherwise.
  */
 public function validate($options)
 {
     $errors = array();
     $testpkg = Horde_Util::getTempFile();
     $archive = new Archive_Tar($testpkg, 'gz');
     $archive->addString('a', 'a');
     $archive->addString('b', 'b');
     $results = exec('tar tzvf ' . $testpkg . ' 2>&1');
     // MacOS tar doesn't error out, but only returns the first string (ending in 'a');
     if (strpos($results, 'lone zero block') !== false || substr($results, -1, 1) == 'a') {
         $errors[] = 'Broken Archive_Tar, upgrade first.';
     }
     $remote = new Horde_Pear_Remote();
     try {
         $exists = $remote->releaseExists($this->getComponent()->getName(), $this->getComponent()->getVersion());
         if ($exists) {
             $errors[] = sprintf('The remote server already has version "%s" for component "%s".', $this->getComponent()->getVersion(), $this->getComponent()->getName());
         }
     } catch (Horde_Http_Exception $e) {
         $errors[] = 'Failed accessing the remote PEAR server.';
     }
     try {
         Components_Helper_Version::validateReleaseStability($this->getComponent()->getVersion(), $this->getComponent()->getState('release'));
     } catch (Components_Exception $e) {
         $errors[] = $e->getMessage();
     }
     try {
         Components_Helper_Version::validateApiStability($this->getComponent()->getVersion(), $this->getComponent()->getState('api'));
     } catch (Components_Exception $e) {
         $errors[] = $e->getMessage();
     }
     if (empty($options['releaseserver'])) {
         $errors[] = 'The "releaseserver" option has no value. Where should the release be uploaded?';
     }
     if (empty($options['releasedir'])) {
         $errors[] = 'The "releasedir" option has no value. Where is the remote pirum install located?';
     }
     return $errors;
 }
예제 #5
0
파일: Update.php 프로젝트: horde/horde
 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;
         }
     }
 }
예제 #6
0
 /**
  * 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);
         }
     }
 }
예제 #7
0
 public function testInvalidApiStable()
 {
     try {
         Components_Helper_Version::validateApiStability('4.0.0', 'beta');
         $this->fail('No exception!');
     } catch (Components_Exception $e) {
         $this->assertEquals('Stable version "4.0.0" marked with invalid api stability "beta"!', $e->getMessage());
     }
 }
예제 #8
0
 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'));
 }
예제 #9
0
 public function testFiveTwoOhRc2()
 {
     $this->assertEquals('5.2.0 Release Candidate 2', Components_Helper_Version::pearToTicketDescription('5.2.0RC2'));
 }
예제 #10
0
파일: Bugs.php 프로젝트: horde/horde
 /**
  * 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()));
     }
 }
예제 #11
0
파일: Notes.php 프로젝트: horde/horde
    /**
     * Populates the release information for the current component.
     */
    protected function _setReleaseNotes()
    {
        if (!($file = $this->_component->getReleaseNotesPath())) {
            return;
        }
        if (basename($file) == 'release.yml') {
            $version = Components_Helper_Version::parsePearVersion($this->_component->getVersion());
            $description = Horde_String::lower($version->description);
            if (strpos($description, 'release') === false) {
                $description .= ' release';
            }
            $infofile = dirname($file) . '/horde.yml';
            try {
                $info = Horde_Yaml::loadFile($infofile);
            } catch (Horde_Yaml_Exception $e) {
                throw new Components_Exception($e);
            }
            $this->_notes['name'] = $info['name'];
            if (isset($info['list'])) {
                $this->_notes['list'] = $info['list'];
            }
            try {
                $release = Horde_Yaml::loadFile($file);
            } catch (Horde_Yaml_Exception $e) {
                throw new Components_Exception($e);
            }
            if (isset($release['branch'])) {
                $this->_notes['branch'] = $release['branch'];
            }
            $this->_notes['security'] = $release['security'];
            if (is_array($release['changes'])) {
                if (!is_array(reset($release['changes']))) {
                    $release['changes'] = array($release['changes']);
                }
            } else {
                $release['changes'] = array();
            }
            $currentSection = null;
            $changes = '';
            foreach ($release['changes'] as $section => $sectionChanges) {
                if ($section != $currentSection) {
                    $changes .= "\n\n" . $section . ':';
                    $currentSection = $section;
                }
                foreach ($sectionChanges as $change) {
                    $changes .= "\n    * " . $change;
                }
            }
            switch ($version->description) {
                case 'Final':
                    $prerelease = '';
                    break;
                case 'Alpha':
                case 'Beta':
                    $prerelease = '
This is a preview version that should not be used on production systems. This version is considered feature complete but there might still be a few bugs. You should not use this preview version over existing production data.

We encourage widespread testing and feedback via the mailing lists or our bug tracking system. Updated translations are very welcome, though some strings might still change before the final release.
';
                    break;
                case 'Release Candidate':
                    $prerelease = sprintf('
Barring any problems, this code will be released as %s %s.
Testing is requested and comments are encouraged. Updated translations would also be great.
', $info['name'], $version->version);
                    break;
            }
            $this->_notes['changes'] = sprintf('The Horde Team is pleased to announce the %s%s of the %s version %s.

%s
%s
For upgrading instructions, please see
http://www.horde.org/apps/%s/docs/UPGRADING

For detailed installation and configuration instructions, please see
http://www.horde.org/apps/%s/docs/INSTALL
%s
The major changes compared to the %s version %s are:%s', $version->subversion ? NumberFormatter::create('en_US', NumberFormatter::ORDINAL)->format($version->subversion) . ' ' : '', $description, $info['full'], $version->version, $info['description'], $prerelease, $info['id'], $info['id'], !empty($release['additional']) ? "\n" . implode("\n\n", $release['additional']) . "\n" : '', $info['name'], $this->_component->getPreviousVersion(), $changes);
        } else {
            $this->_notes = (include $file);
        }
    }