-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlion
99 lines (84 loc) · 3.09 KB
/
lion
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?php
declare(strict_types=1);
define('LION_START', microtime(true));
/**
* -----------------------------------------------------------------------------
* Register The Auto Loader
* -----------------------------------------------------------------------------
* Composer provides a convenient, automatically generated class loader for
* this application
* -----------------------------------------------------------------------------
**/
require_once(__DIR__ . '/vendor/autoload.php');
use Dotenv\Dotenv;
use Lion\Bundle\Commands\CommandHandler;
use Lion\Database\Driver;
use Lion\Files\Store;
define('IS_INDEX', false);
/**
* -----------------------------------------------------------------------------
* Register environment variable loader automatically
* -----------------------------------------------------------------------------
* .dotenv provides an easy way to access environment variables with $_ENV
* -----------------------------------------------------------------------------
**/
if (isSuccess((new Store())->exist(__DIR__ . '/.env'))) {
Dotenv::createImmutable(__DIR__)->load();
}
/**
* -----------------------------------------------------------------------------
* Database initialization
* -----------------------------------------------------------------------------
* */
Driver::run([
'default' => env('DB_NAME'),
'connections' => [
env('DB_NAME') => [
'type' => env('DB_TYPE'),
'host' => env('DB_HOST'),
'port' => env('DB_PORT'),
'dbname' => env('DB_NAME'),
'user' => env('DB_USER'),
'password' => env('DB_PASSWORD'),
],
env('DB_NAME_TEST') => [
'type' => env('DB_TYPE_TEST'),
'host' => env('DB_HOST_TEST'),
'port' => env('DB_PORT_TEST'),
'dbname' => env('DB_NAME'),
'user' => env('DB_USER_TEST'),
'password' => env('DB_PASSWORD_TEST'),
],
env('DB_NAME_TEST_POSTGRESQL') => [
'type' => env('DB_TYPE_TEST_POSTGRESQL'),
'host' => env('DB_HOST_TEST_POSTGRESQL'),
'port' => env('DB_PORT_TEST_POSTGRESQL'),
'dbname' => env('DB_NAME'),
'user' => env('DB_USER_TEST_POSTGRESQL'),
'password' => env('DB_PASSWORD_TEST_POSTGRESQL'),
],
],
]);
/**
* -----------------------------------------------------------------------------
* Run The lion Application
* -----------------------------------------------------------------------------
* This is where the commands for your application are executed
* -----------------------------------------------------------------------------
**/
$commandHandler = (new CommandHandler('Lion-Bundle'));
$commandHandler->registerCommands(
'./src/LionBundle/Commands/Lion/',
'Lion\\Bundle\\Commands\\Lion\\',
'Commands/Lion/'
);
if (isSuccess((new Store())->exist('./app/Console/Commands/'))) {
$commandHandler->registerCommands(
'./app/Console/Commands/',
'App\\Console\\Commands\\',
'Commands/'
);
}
$commandHandler
->getApplication()
->run();