-
Notifications
You must be signed in to change notification settings - Fork 0
/
start-kanata
executable file
·53 lines (44 loc) · 1.45 KB
/
start-kanata
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
#!/usr/bin/env php
<?php
foreach ([
__DIR__ . '/../../../',
__DIR__ . '/../../',
__DIR__ . '/../',
] as $file) {
if (file_exists($file . 'config')) {
define('ROOT_FOLDER', $file);
break;
}
}
define('PHPUNIT_COMPOSER_INSTALL', ROOT_FOLDER . 'vendor/autoload.php');
if (!defined('PHPUNIT_COMPOSER_INSTALL')) {
fwrite(
STDERR,
'You need to set up the project dependencies using Composer:' . PHP_EOL . PHP_EOL .
' composer install' . PHP_EOL . PHP_EOL .
'You can learn all about Composer on https://getcomposer.org/.' . PHP_EOL
);
die(1);
}
require PHPUNIT_COMPOSER_INSTALL;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputOption;
use voku\helper\Hooks;
use Kanata\Services\Bootstrap;
Bootstrap::processCore(['skip_plugins' => true]);
// prepare console inputs
$definition = new InputDefinition([
new InputOption(FRESH_CONSOLE_OPTION, null, InputOption::VALUE_NONE),
new InputOption(FRESH_PLUGINS_CONSOLE_OPTION, null, InputOption::VALUE_NONE),
]);
$input = get_input(null, $definition);
$fresh = $input->getOption(FRESH_CONSOLE_OPTION);
$fresh_plugins = $input->getOption(FRESH_PLUGINS_CONSOLE_OPTION);
// migrate
Bootstrap::migrateBase($fresh_plugins, $fresh);
// execute plugins migrations
Bootstrap::startPlugins();
if ($fresh) {
Hooks::getInstance()->do_action('rollback_migrations');
}
Hooks::getInstance()->do_action('migrations');