-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbootstrap.php
86 lines (77 loc) · 2.89 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
76
77
78
79
80
81
82
83
84
85
86
<?php
declare(strict_types=1);
/*
* This file is part of the package t3g/elasticorn.
* For the full copyright and license information, please read the
* LICENSE file that was distributed with this source code.
*/
use Dotenv\Dotenv;
use SelfUpdate\SelfUpdateCommand;
use T3G\Elasticorn\Commands\Index\CornifyCommand;
use T3G\Elasticorn\Commands\Index\InitCommand;
use T3G\Elasticorn\Commands\Index\RemapCommand;
use T3G\Elasticorn\Commands\Mapping\CompareCommand;
use T3G\Elasticorn\Commands\Mapping\ShowCommand;
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.dist')) {
$dotenvDist = new Dotenv($directory, '.env.dist');
$dotenvDist->load();
}
if (file_exists($directory . DIRECTORY_SEPARATOR . '.env')) {
$dotenv = new Dotenv($directory, '.env');
$dotenv->overload();
}
if (file_exists($directory . DIRECTORY_SEPARATOR . '.env.local')) {
$dotenv = new Dotenv($directory, '.env.local');
$dotenv->overload();
}
}
// 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 SelfUpdateCommand('Elasticorn', '7.0.0', 'TYPO3GmbH/elasticorn'));
}
$application->setName(
<<<ASCIIART
Elasticorn!
\
\
\\
\\
>\/7
_.-(6' \
(=___._/` \
) \ |
/ / |
/ > /
j < _\
_.-' : ``.
\ r=._\ `.
<`\\_ \ .`-.
\ r-7 `-. ._ ' . `\
\`, `-.`7 7) )
\/ \| \' / `-._
|| .'
\\ (
>\ >
,.-' >.'
<.'_.''
<'
ASCIIART
);
$application->run();