Files
boost-tasks/update-doc-list
2017-12-28 19:35:16 +00:00

60 lines
1.9 KiB
PHP
Executable File

#!/usr/bin/env php
<?php
require_once(__DIR__.'/vendor/autoload.php');
use GetOptionKit\OptionCollection;
use BoostTasks\Settings;
use BoostTasks\CommandLineOptions;
use BoostTasks\GitHubEvents;
use BoostTasks\WebsiteRepo;
use BoostTasks\SuperProject;
use BoostTasks\LocalMirror;
// use RuntimeException;
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);
if (is_numeric($options)) { exit($options); }
Settings::init($options);
// 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
GitHubEvents::downloadEvents();
$mirror = new LocalMirror();
$mirror->refresh();
$mirror->fetchDirty();
// Rebuild the in progress release notes
$website_repo = new WebsiteRepo();
$result = $website_repo->updateInProgressReleaseNotes();
if (!$result) {
// Don't want a hard failure because of a syntax error in the release
// notes.
echo "Rebuilding the in progress release notes failed.\n";
}
// 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 (Settings::branchRepos() as $x) {
$website_repo->updateSuperProject(new SuperProject($x));
}
}
main($_SERVER['argv']);