-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathmirror
More file actions
executable file
·36 lines (31 loc) · 928 Bytes
/
mirror
File metadata and controls
executable file
·36 lines (31 loc) · 928 Bytes
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
#!/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\LocalMirror;
function main($args) {
$specs = new OptionCollection;
$specs->add('no-fetch', "Don't fetch events from GitHub")
->defaultValue(false);
$specs->add('all', "Update all repos in mirror")
->defaultValue(false);
$options = CommandLineOptions::process($args,
'Creates or updates the GitHub mirror',
$specs);
if (is_numeric($options)) { exit($options); }
Settings::init($options);
if (!$options['no-fetch']) {
GitHubEvents::downloadEvents();
}
$mirror = new LocalMirror();
if ($options['all']) {
$mirror->refreshAll();
} else {
$mirror->refresh();
}
$mirror->fetchDirty();
}
main($_SERVER['argv']);