mirror of
https://github.com/boostorg/boost-tasks.git
synced 2026-01-19 04:02:13 +00:00
37 lines
928 B
PHP
Executable File
37 lines
928 B
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\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']);
|