Skip to content

Commit

Permalink
[jan] Update website versions after releasing a package.
Browse files Browse the repository at this point in the history
  • Loading branch information
yunosh committed Mar 10, 2014
1 parent 0dbfcb9 commit e26c72d
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 5 deletions.
3 changes: 3 additions & 0 deletions components/config/conf.php.dist
Expand Up @@ -28,3 +28,6 @@ $conf['from'] = 'Full name <user@horde.org>';

/* This should be set to the developer's API token */
$conf['fm_token'] = '';

/* Path to a checkout of the horde-web repository. */
$conf['web_dir'] = '/var/www/horde-web';
9 changes: 9 additions & 0 deletions components/lib/Components/Module/Release.php
Expand Up @@ -122,6 +122,13 @@ public function getOptionGroupOptions()
'help' => 'The token for accessing freecode.com.'
)
),
new Horde_Argv_Option(
'--web_dir',
array(
'action' => 'store',
'help' => 'The directory of a horde-web checkout.'
)
),
);
}

Expand Down Expand Up @@ -171,6 +178,7 @@ public function getHelp($action)
- upload : Upload the package to pear.horde.org
- tag : Add a git release tag.
- announce : Announce the release on the mailing lists.
- website : Add the new release on www.horde.org
- bugs : Add the new release on bugs.horde.org
- freecode : Add the new release on freecode.com
- next : Update package.xml with the next version.
Expand Down Expand Up @@ -203,6 +211,7 @@ public function getContextOptionHelp()
'--horde_user' => '',
'--horde_pass' => '',
'--fm_token' => '',
'--web_dir' => '',
);
}

Expand Down
82 changes: 82 additions & 0 deletions components/lib/Components/Release/Task/Website.php
@@ -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,
));
}
}
}
4 changes: 4 additions & 0 deletions components/lib/Components/Runner/Release.php
Expand Up @@ -139,6 +139,10 @@ public function run()
$sequence[] = 'Announce';
}

if ($this->_doTask('website')) {
$sequence[] = 'Website';
}

if ($this->_doTask('bugs')) {
$sequence[] = 'Bugs';
}
Expand Down
33 changes: 28 additions & 5 deletions components/package.xml
Expand Up @@ -10,8 +10,7 @@
<email>p@rdus.de</email>
<active>yes</active>
</lead>
<date>2013-02-13</date>
<time>02:22:53</time>
<date>2014-03-10</date>
<version>
<release>0.99.1</release>
<api>1.0</api>
Expand All @@ -22,6 +21,7 @@
</stability>
<license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license>
<notes>
* [jan] Update website versions after releasing a package.
* [mms] Run unit tests before releasing a package.
* [mms] Composer file is now generated/updated before releasing.
* [mms] Add PHP Composer generator.
Expand Down Expand Up @@ -58,7 +58,6 @@
<file name="changelog" role="data" />
<file name="compat" role="data" />
<file name="control" role="data" />
<file name="pearrc" role="data" />
<file name="rules" role="data" />
<file name="watch" role="data" />
</dir> <!-- /data/distribute/debian/templates -->
Expand Down Expand Up @@ -101,6 +100,12 @@
<dir name="templates-php-horde-passwd">
<file name="rules" role="data" />
</dir> <!-- /data/distribute/debian/templates-php-horde-passwd -->
<dir name="templates-php-horde-role">
<dir name="patches">
<file name="0001-Set-default-horde_dir-to-usr-share-horde.patch" role="horde" />
<file name="series" role="horde" />
</dir> <!-- /data/distribute/debian/templates-php-horde-role/patches -->
</dir> <!-- /data/distribute/debian/templates-php-horde-role -->
<dir name="templates-php-horde-sesha">
<file name="rules" role="horde" />
</dir> <!-- /data/distribute/debian/templates-php-horde-sesha -->
Expand Down Expand Up @@ -185,6 +190,7 @@
</dir> <!-- /lib/Components/Helper/Templates -->
<file name="ChangeLog.php" role="php" />
<file name="Commit.php" role="php" />
<file name="Composer.php" role="horde" />
<file name="Dependencies.php" role="php" />
<file name="DocsOrigin.php" role="php" />
<file name="Installer.php" role="php" />
Expand All @@ -198,6 +204,7 @@
<file name="Base.php" role="php" />
<file name="Change.php" role="php" />
<file name="CiSetup.php" role="php" />
<file name="Composer.php" role="horde" />
<file name="Dependencies.php" role="php" />
<file name="Distribute.php" role="php" />
<file name="Fetchdocs.php" role="php" />
Expand Down Expand Up @@ -234,6 +241,7 @@
<file name="Bugs.php" role="php" />
<file name="CommitPostRelease.php" role="php" />
<file name="CommitPreRelease.php" role="php" />
<file name="Composer.php" role="horde" />
<file name="CurrentSentinel.php" role="php" />
<file name="Freecode.php" role="horde" />
<file name="NextSentinel.php" role="php" />
Expand All @@ -242,6 +250,7 @@
<file name="Sentinel.php" role="php" />
<file name="TagRelease.php" role="php" />
<file name="Timestamp.php" role="php" />
<file name="Website.php" role="horde" />
</dir> <!-- /lib/Components/Release/Task -->
<file name="Notes.php" role="php" />
<file name="Tasks.php" role="php" />
Expand All @@ -250,6 +259,7 @@
<file name="Change.php" role="php" />
<file name="CiPrebuild.php" role="php" />
<file name="CiSetup.php" role="php" />
<file name="Composer.php" role="horde" />
<file name="Dependencies.php" role="php" />
<file name="Distribute.php" role="php" />
<file name="Fetchdocs.php" role="php" />
Expand All @@ -272,6 +282,10 @@
<file name="Module.php" role="php" />
<file name="Output.php" role="php" />
</dir> <!-- /lib/Components -->
<dir name="Conductor">
<file name="Package2XmlToComposer.php" role="horde" />
<file name="PEARPackageFilev2.php" role="horde" />
</dir> <!-- /lib/Conductor -->
<file name="Components.php" role="php" />
</dir> <!-- /lib -->
<dir name="test">
Expand Down Expand Up @@ -608,7 +622,6 @@
<install as="distribute/debian/templates/changelog" name="data/distribute/debian/templates/changelog" />
<install as="distribute/debian/templates/compat" name="data/distribute/debian/templates/compat" />
<install as="distribute/debian/templates/control" name="data/distribute/debian/templates/control" />
<install as="distribute/debian/templates/pearrc" name="data/distribute/debian/templates/pearrc" />
<install as="distribute/debian/templates/rules" name="data/distribute/debian/templates/rules" />
<install as="distribute/debian/templates/watch" name="data/distribute/debian/templates/watch" />
<install as="distribute/debian/templates/source/format" name="data/distribute/debian/templates/source/format" />
Expand All @@ -625,6 +638,8 @@
<install as="distribute/debian/templates-php-horde-mnemo/rules" name="data/distribute/debian/templates-php-horde-mnemo/rules" />
<install as="distribute/debian/templates-php-horde-nag/rules" name="data/distribute/debian/templates-php-horde-nag/rules" />
<install as="distribute/debian/templates-php-horde-passwd/rules" name="data/distribute/debian/templates-php-horde-passwd/rules" />
<install as="distribute/debian/templates-php-horde-role/patches/0001-Set-default-horde_dir-to-usr-share-horde.patch" name="data/distribute/debian/templates-php-horde-role/patches/0001-Set-default-horde_dir-to-usr-share-horde.patch" />
<install as="distribute/debian/templates-php-horde-role/patches/series" name="data/distribute/debian/templates-php-horde-role/patches/series" />
<install as="distribute/debian/templates-php-horde-sesha/rules" name="data/distribute/debian/templates-php-horde-sesha/rules" />
<install as="distribute/debian/templates-php-horde-turba/rules" name="data/distribute/debian/templates-php-horde-turba/rules" />
<install as="distribute/debian/templates-php-horde-ulaform/rules" name="data/distribute/debian/templates-php-horde-ulaform/rules" />
Expand Down Expand Up @@ -671,6 +686,7 @@
<install as="Components/Exception/Pear.php" name="lib/Components/Exception/Pear.php" />
<install as="Components/Helper/ChangeLog.php" name="lib/Components/Helper/ChangeLog.php" />
<install as="Components/Helper/Commit.php" name="lib/Components/Helper/Commit.php" />
<install as="Components/Helper/Composer.php" name="lib/Components/Helper/Composer.php" />
<install as="Components/Helper/Dependencies.php" name="lib/Components/Helper/Dependencies.php" />
<install as="Components/Helper/DocsOrigin.php" name="lib/Components/Helper/DocsOrigin.php" />
<install as="Components/Helper/Installer.php" name="lib/Components/Helper/Installer.php" />
Expand All @@ -685,6 +701,7 @@
<install as="Components/Module/Base.php" name="lib/Components/Module/Base.php" />
<install as="Components/Module/Change.php" name="lib/Components/Module/Change.php" />
<install as="Components/Module/CiSetup.php" name="lib/Components/Module/CiSetup.php" />
<install as="Components/Module/Composer.php" name="lib/Components/Module/Composer.php" />
<install as="Components/Module/Dependencies.php" name="lib/Components/Module/Dependencies.php" />
<install as="Components/Module/Distribute.php" name="lib/Components/Module/Distribute.php" />
<install as="Components/Module/Fetchdocs.php" name="lib/Components/Module/Fetchdocs.php" />
Expand Down Expand Up @@ -713,6 +730,7 @@
<install as="Components/Release/Task/Bugs.php" name="lib/Components/Release/Task/Bugs.php" />
<install as="Components/Release/Task/CommitPostRelease.php" name="lib/Components/Release/Task/CommitPostRelease.php" />
<install as="Components/Release/Task/CommitPreRelease.php" name="lib/Components/Release/Task/CommitPreRelease.php" />
<install as="Components/Release/Task/Composer.php" name="lib/Components/Release/Task/Composer.php" />
<install as="Components/Release/Task/CurrentSentinel.php" name="lib/Components/Release/Task/CurrentSentinel.php" />
<install as="Components/Release/Task/Freecode.php" name="lib/Components/Release/Task/Freecode.php" />
<install as="Components/Release/Task/NextSentinel.php" name="lib/Components/Release/Task/NextSentinel.php" />
Expand All @@ -721,9 +739,11 @@
<install as="Components/Release/Task/Sentinel.php" name="lib/Components/Release/Task/Sentinel.php" />
<install as="Components/Release/Task/TagRelease.php" name="lib/Components/Release/Task/TagRelease.php" />
<install as="Components/Release/Task/Timestamp.php" name="lib/Components/Release/Task/Timestamp.php" />
<install as="Components/Release/Task/Website.php" name="lib/Components/Release/Task/Website.php" />
<install as="Components/Runner/Change.php" name="lib/Components/Runner/Change.php" />
<install as="Components/Runner/CiPrebuild.php" name="lib/Components/Runner/CiPrebuild.php" />
<install as="Components/Runner/CiSetup.php" name="lib/Components/Runner/CiSetup.php" />
<install as="Components/Runner/Composer.php" name="lib/Components/Runner/Composer.php" />
<install as="Components/Runner/Dependencies.php" name="lib/Components/Runner/Dependencies.php" />
<install as="Components/Runner/Distribute.php" name="lib/Components/Runner/Distribute.php" />
<install as="Components/Runner/Fetchdocs.php" name="lib/Components/Runner/Fetchdocs.php" />
Expand All @@ -733,6 +753,8 @@
<install as="Components/Runner/Snapshot.php" name="lib/Components/Runner/Snapshot.php" />
<install as="Components/Runner/Update.php" name="lib/Components/Runner/Update.php" />
<install as="Components/Runner/Webdocs.php" name="lib/Components/Runner/Webdocs.php" />
<install as="Conductor/Package2XmlToComposer.php" name="lib/Conductor/Package2XmlToComposer.php" />
<install as="Conductor/PEARPackageFilev2.php" name="lib/Conductor/PEARPackageFilev2.php" />
<install as="Components/AllTests.php" name="test/Components/AllTests.php" />
<install as="Components/Autoload.php" name="test/Components/Autoload.php" />
<install as="Components/bootstrap.php" name="test/Components/bootstrap.php" />
Expand Down Expand Up @@ -867,9 +889,10 @@
<release>beta</release>
<api>beta</api>
</stability>
<date>2013-02-13</date>
<date>2014-03-10</date>
<license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license>
<notes>
* [jan] Update website versions after releasing a package.
* [mms] Run unit tests before releasing a package.
* [mms] Composer file is now generated/updated before releasing.
* [mms] Add PHP Composer generator.
Expand Down

0 comments on commit e26c72d

Please sign in to comment.