forked from auraphp/system
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstatus.php
61 lines (52 loc) · 1.42 KB
/
status.php
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
60
61
<?php
/**
*
* This file is part of the Aura project for PHP.
*
* @license http://opensource.org/licenses/bsd-license.php BSD
*
*/
/**
* Show status of the system as a whole.
*/
echo '------------------------------' . PHP_EOL . PHP_EOL;
echo 'system' . PHP_EOL . PHP_EOL;
passthru('git status');
/**
* Show status of the library packages.
*/
// the package directory
$dir = __DIR__ . DIRECTORY_SEPARATOR . 'package';
// get the list of available repositories
$url = 'https://api.github.com/orgs/auraphp/repos';
$context = stream_context_create([
'http' => [
'method' => "GET",
'header' => "Accept: application/json"
],
]);
$json = file_get_contents($url, FALSE, $context);
$data = json_decode($json);
// sort the repos
$repos = [];
foreach ($data as $repo) {
$repos[$repo->name] = $repo;
}
ksort($repos);
// for each of the repositories ...
foreach ($repos as $repo) {
// only use 'Aura.Package' repositories as packages
if (! preg_match('/Aura\.[A-Z0-9_]+/', $repo->name)) {
continue;
}
// does the package exist locally ?
$sub = $dir . DIRECTORY_SEPARATOR . $repo->name;
if (is_dir($sub)) {
echo PHP_EOL . '------------------------------' . PHP_EOL . PHP_EOL;
echo $repo->name . PHP_EOL . PHP_EOL;
passthru("cd $sub; git status");
}
}
// done!
echo PHP_EOL . '------------------------------' . PHP_EOL . PHP_EOL;
echo 'Done!' . PHP_EOL;