-
Notifications
You must be signed in to change notification settings - Fork 43
/
gush
executable file
·45 lines (36 loc) · 1.25 KB
/
gush
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
#!/usr/bin/env php
<?php
/*
* This file is part of Gush.
*
* (c) Luis Cordova <cordoval@gmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
require __DIR__.'/vendor/autoload.php';
use Gush\Application;
use Gush\ConfigFactory;
use Gush\Factory\AdapterFactory;
use Gush\ThirdParty\Bitbucket\BitbucketFactory;
use Gush\ThirdParty\Github\GitHubEnterpriseFactory;
use Gush\ThirdParty\Github\GitHubFactory;
use Gush\ThirdParty\Gitlab\GitLabFactory;
error_reporting(E_ALL);
ini_set('display_errors', 1);
$adapterFactory = new AdapterFactory();
$adapters = [
'github' => [GitHubFactory::class, 'GitHub'],
'github_enterprise' => [GitHubEnterpriseFactory::class, 'GitHub Enterprise'],
'bitbucket' => [BitbucketFactory::class, 'Bitbucket'],
'gitlab' => [GitLabFactory::class, 'GitLab']
];
foreach ($adapters as $adapterName => $adapter) {
$adapterFactory->register($adapterName, $adapter[1], $adapter[0]);
}
if (false !== getenv('GUSH_CONFIG')) {
$config = ConfigFactory::createConfig((string) getenv('GUSH_CONFIG'), (string) getenv('GUSH_LOCAL_CONFIG'));
} else {
$config = ConfigFactory::createConfig(null, getcwd());
}
(new Application($adapterFactory, $config))->run();