validateReleaseStability() public static method

Validates the version and release stability tuple.
public static validateReleaseStability ( string $version, string $stability )
$version string A version string.
$stability string Release stability information.
Exemplo n.º 1
0
 /**
  * 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;
 }
Exemplo n.º 2
0
 public function testInvalidDev()
 {
     try {
         Components_Helper_Version::validateReleaseStability('4.0.0dev1', 'stable');
         $this->fail('No exception!');
     } catch (Components_Exception $e) {
         $this->assertEquals('devel version "4.0.0dev1" marked with invalid release stability "stable"!', $e->getMessage());
     }
 }