-
-
Notifications
You must be signed in to change notification settings - Fork 78
/
github
executable file
·62 lines (53 loc) · 2.03 KB
/
github
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
62
#!/usr/bin/env php
<?php
/*
* This file is part of the DevShop package.
*
* (c) Jon Pugh <[email protected]
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Runs the github command.
*
* @author Jon Pugh <[email protected]
*/
// If we're running from phar load the phar autoload file.
$pharPath = \Phar::running(true);
if ($pharPath) {
$autoloaderPath = "$pharPath/vendor/autoload.php";
} else {
if (file_exists(__DIR__.'/vendor/autoload.php')) {
$autoloaderPath = __DIR__.'/vendor/autoload.php';
} elseif (file_exists(__DIR__.'/../../autoload.php')) {
$autoloaderPath = __DIR__ . '/../../autoload.php';
// The path to autoloader when used in side the main devshop repo.
} elseif (file_exists(__DIR__.'/../../../../vendor/autoload.php')) {
$autoloaderPath = __DIR__ . '/../../../../vendor/autoload.php';
} else {
echo ("Could not find autoloader. Run 'composer install'.");
exit(1);
}
}
$classLoader = require $autoloaderPath;
// Customization variables
$argv = $_SERVER['argv'];
$appName = "DevShop GitHub CLI";
$appVersion = trim(file_get_contents(__DIR__ . '/VERSION'));
$commandClasses[] = \DevShop\Component\GitHubApiCli\Commands\GitHubCommands::class;
$commandClasses[] = \DevShop\Component\GitHubApiCli\Commands\DeploymentsCommands::class;
$selfUpdateRepository = 'devshop-packages/github-api-cli';
$configPrefix = 'DEVSHOP_GITHUB_CLI';
$configFilePath = getenv($configPrefix . '_CONFIG') ?: getenv('HOME') . '/.devshop/github-api-cli.yml';
// Define our Runner, and pass it the command classes we provide.
$runner = new \Robo\Runner($commandClasses);
$runner
->setSelfUpdateRepository($selfUpdateRepository)
->setConfigurationFilename($configFilePath)
->setEnvConfigPrefix($configPrefix)
->setClassLoader($classLoader);
// Execute the command and return the result.
$output = new \Symfony\Component\Console\Output\ConsoleOutput();
$statusCode = $runner->execute($argv, $appName, $appVersion, $output);
exit($statusCode);