-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconsole
executable file
·69 lines (59 loc) · 1.95 KB
/
console
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
63
64
65
66
67
68
69
#!/usr/bin/env php
<?php
/**
* Created by PhpStorm.
* User: janhuang
* Date: 15/3/19
* Time: 下午8:03
* Github: https://www.github.com/janhuang
* Coding: https://www.coding.net/janhuang
* SegmentFault: http://segmentfault.com/u/janhuang
* Blog: http://segmentfault.com/blog/janhuang
* Gmail: [email protected]
*/
set_time_limit(0);
date_default_timezone_set('PRC');
// autoload composer
foreach ([
__DIR__ . '/../../autoload.php',
__DIR__ . '/../vendor/autoload.php',
__DIR__ . '/vendor/autoload.php'
] as $value) {
if (file_exists($value)) {
define('FASTD_COMPOSER_INSTALL', $value);
break;
}
}
if (!defined('FASTD_COMPOSER_INSTALL')) {
fwrite(STDERR,
'You need to set up the project dependencies using the following commands:' . PHP_EOL .
'wget http://getcomposer.org/composer.phar' . PHP_EOL .
'php composer.phar install' . PHP_EOL
);
}
include FASTD_COMPOSER_INSTALL;
if (!class_exists('Application')) {
foreach ([
__DIR__ . '/application.php',
__DIR__ . '/app/application.php',
__DIR__ . '/../application.php',
__DIR__ . '/../app/application.php',
__DIR__ . '/../../application.php',
__DIR__ . '/../../app/application.php',
__DIR__ . '/../../../application.php',
__DIR__ . '/../../../app/application.php',
] as $value) {
if (file_exists($value)) {
include $value;
break;
}
}
}
use FastD\Console\Input\ArgvInput;
use FastD\Framework\Kernel\AppConsole;
use FastD\Framework\Kernel\AppKernel;
use FastD\Console\Input\InputDefinition;
$argvInput = new ArgvInput(null, new InputDefinition);
$env = $argvInput->hasOption(['env', 'e']) ? $argvInput->getOption(['env', 'e']) : AppKernel::ENV_DEV;
$console = new AppConsole(new Application($env));
$console->run($argvInput);