forked from TYPO3GmbH/elasticorn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.php
75 lines (66 loc) · 2.44 KB
/
bootstrap.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
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
<?php
declare(strict_types = 1);
use T3G\Elasticorn\Commands\Index\CornifyCommand;
use T3G\Elasticorn\Commands\Mapping\CompareCommand;
use T3G\Elasticorn\Commands\Index\InitCommand;
use T3G\Elasticorn\Commands\Index\RemapCommand;
use T3G\Elasticorn\Commands\Mapping\ShowCommand;
use T3G\Elasticorn\Commands\Self\RollbackCommand;
use T3G\Elasticorn\Commands\Self\UpdateCommand;
use T3G\Elasticorn\Commands\Type\TruncateCommand;
// env config
// Determine the .env file in package directory ($baseBath === __DIR__) and getcwd()
// this prevent path errors in case of global composer installation and package requirement
foreach ([$basePath, getcwd()] as $directory) {
if (file_exists($directory . DIRECTORY_SEPARATOR . '.env')) {
$dotenv = new Dotenv\Dotenv($directory);
$dotenv->load();
break;
}
}
// dependency injection initialization
$di = new \T3G\Elasticorn\Bootstrap\DependencyInjectionContainer();
$container = $di->init();
unset($di);
// application
$application = new \Symfony\Component\Console\Application();
// commands
$application->add(new InitCommand());
$application->add(new RemapCommand());
$application->add(new CompareCommand());
$application->add(new ShowCommand());
$application->add(new CornifyCommand());
$application->add(new TruncateCommand());
if (true === $phar) {
$application->add(new UpdateCommand());
$application->add(new RollbackCommand());
}
$application->setName(
<<<ASCIIART
Elasticorn!
\
\
\\
\\
>\/7
_.-(6' \
(=___._/` \
) \ |
/ / |
/ > /
j < _\
_.-' : ``.
\ r=._\ `.
<`\\_ \ .`-.
\ r-7 `-. ._ ' . `\
\`, `-.`7 7) )
\/ \| \' / `-._
|| .'
\\ (
>\ >
,.-' >.'
<.'_.''
<'
ASCIIART
);
$application->run();