-
Notifications
You must be signed in to change notification settings - Fork 190
/
terminus.php
executable file
·46 lines (40 loc) · 1.54 KB
/
terminus.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
#!/usr/bin/env php
<?php
$phar_path = \Phar::running(true);
if ($phar_path) {
include_once "$phar_path/vendor/autoload.php";
} else {
if (file_exists(__DIR__ . '/../vendor/autoload.php')) {
include_once __DIR__ . '/../vendor/autoload.php';
} elseif (file_exists(__DIR__ . '/../../autoload.php')) {
include_once __DIR__ . '/../../autoload.php';
}
}
use League\Container\Container;
use Pantheon\Terminus\Config;
use Pantheon\Terminus\Runner;
use Pantheon\Terminus\Session\Session;
use Pantheon\Terminus\Session\SessionAwareInterface;
use Pantheon\Terminus\Terminus;
use Robo\Robo;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Output\ConsoleOutput;
use Terminus\Caches\FileCache;
// Initializing the Terminus application
$config = new Config();
$application = new Terminus('Terminus', $config->get('version'), $config);
// Configuring the dependency-injection container
$container = new Container();
$input = new ArgvInput($_SERVER['argv']);
$output = new ConsoleOutput();
$roboConfig = new \Robo\Config(); // TODO: make Terminus Config extend \Robo\Config and use $config here
Robo::configureContainer($container, $roboConfig, $input, $output, $application);
$container->share('fileCache', FileCache::class);
$container->share('session', Session::class)
->withArgument('fileCache');
$container->inflector(SessionAwareInterface::class)
->invokeMethod('setSession', ['session']);
// Running Terminus
$runner = new Runner($container);
$status_code = $runner->run($input, $output);
exit($status_code);