Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[jan] Update website versions after releasing a package.
- Loading branch information
Showing
5 changed files
with
126 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<?php | ||
/** | ||
* Copyright 2014 Horde LLC (http://www.horde.org/) | ||
* | ||
* See the enclosed file COPYING for license information (LGPL). If you | ||
* did not receive this file, see http://www.horde.org/licenses/lgpl21. | ||
* | ||
* @category Horde | ||
* @package Components | ||
* @author Jan Schneider <jan@pardus.de> | ||
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 | ||
* @link http://pear.horde.org/index.php?package=Components | ||
*/ | ||
|
||
/** | ||
* Components_Release_Task_Website adds the new release to the Horde website. | ||
* | ||
* @category Horde | ||
* @package Components | ||
* @author Jan Schneider <jan@pardus.de> | ||
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 | ||
* @link http://pear.horde.org/index.php?package=Components | ||
*/ | ||
class Components_Release_Task_Website extends Components_Release_Task_Base | ||
{ | ||
/** | ||
* Database handle. | ||
* | ||
* @var PDO | ||
*/ | ||
protected $_db; | ||
|
||
/** | ||
* 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(); | ||
if (empty($options['web_dir'])) { | ||
$errors[] = 'The "web" option has no value. Where is the local checkout of the horde-web repository?'; | ||
} | ||
if (!file_exists($options['web_dir'] . '/config/versions.sqlite') || | ||
!is_writable($options['web_dir'] . '/config/versions.sqlite')) { | ||
$errors[] = 'The database at ' . $options['web_dir'] . '/config/versions.sqlite doesn\'t exist or is not writable'; | ||
} else { | ||
$this->_db = new PDO('sqlite:' . $options['web_dir'] . '/config/versions.sqlite'); | ||
} | ||
return $errors; | ||
} | ||
|
||
/** | ||
* Run the task. | ||
* | ||
* @param array &$options Additional options. | ||
*/ | ||
public function run(&$options) | ||
{ | ||
$module = $this->getComponent()->getName(); | ||
$version = $this->getComponent()->getVersion(); | ||
|
||
if ($this->getTasks()->pretend()) { | ||
$this->getOutput()->info( | ||
sprintf( | ||
'Would add new version "%s" to module "%s".', | ||
$version, | ||
$module | ||
) | ||
); | ||
} else { | ||
$website = new Horde_Release_Website($this->_db); | ||
$website->addNewVersion(array( | ||
'application' => $module, | ||
'version' => $version, | ||
)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters