-
Notifications
You must be signed in to change notification settings - Fork 7
/
update-doc-list
executable file
·59 lines (50 loc) · 1.88 KB
/
update-doc-list
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/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']);