Files
boost-tasks/update-doc-list
Daniel James 29dedb001e Extract the common command line code into a class.
Should possible use it for everything, especially if I add more
functionality.
2015-10-10 12:31:53 +01:00

41 lines
1.3 KiB
PHP
Executable File

#!/usr/bin/php
<?php
require_once(__DIR__.'/vendor/autoload.php');
use GetOptionKit\OptionCollection;
function main($args) {
$specs = new OptionCollection;
$specs->add('version:', "Version of update (e.g. develop, 1.57.0)");
$options = CommandLineOptions::process($args,
'Update the documentation list',
$specs);
// TODO: For some reason 'hasArgument' is always true, even when
// there isn't a version. Am I misunderstanding it? Doesn't really
// matter as it ends up falsey.
$version = array_key_exists('version', $options) ? $options['version'] : null;
// Update the mirror
GitHubEventQueue::downloadEvents();
$mirror = new LocalMirror();
$mirror->refresh();
$mirror->fetchDirty();
// Update the website repo.
$website_repo = new WebsiteRepo();
$result = $website_repo->updateDocumentationList($mirror, $version);
if (!$result) {
// Want a hard failure here, so that we're not updating the
// super projects from data that isn't checked in.
throw new RuntimeException("Failed to update documentation list on website.");
}
// Update maintainer lists.
foreach (EvilGlobals::$branch_repos as $x) {
$website_repo->updateSuperProject(new SuperProject($x));
}
}
main($_SERVER['argv']);