@@ 7-63 (lines=57) @@ | ||
4 | ||
5 | use Illuminate\Contracts\Container\Container; |
|
6 | ||
7 | class InstallCommand extends AbstractInitializeCommand |
|
8 | { |
|
9 | /** |
|
10 | * The console command name. |
|
11 | * |
|
12 | * @var string |
|
13 | */ |
|
14 | protected $name = 'app:install'; |
|
15 | ||
16 | /** |
|
17 | * The console command description. |
|
18 | * |
|
19 | * @var string |
|
20 | */ |
|
21 | protected $description = 'Install the application according to current environment'; |
|
22 | ||
23 | /** |
|
24 | * Create a new command instance. |
|
25 | * |
|
26 | * @param Illuminate\Contracts\Container\Container $container |
|
27 | * @return void |
|
28 | */ |
|
29 | public function __construct(Container $container) |
|
30 | { |
|
31 | $this->signature = 'app:install |
|
32 | {--root : Run commands which requires root privileges} |
|
33 | {--o|options=* : Run commands for custom options'.$this->getOptionsConfig($container).'}'; |
|
34 | ||
35 | parent::__construct(); |
|
36 | } |
|
37 | ||
38 | /** |
|
39 | * Returns instance of Install class which defines initializing runner chain. |
|
40 | * |
|
41 | * {@inheritdoc} |
|
42 | */ |
|
43 | protected function getInitializerInstance(Container $container) |
|
44 | { |
|
45 | return $container->make('app.installer'); |
|
46 | } |
|
47 | ||
48 | protected function title(): string |
|
49 | { |
|
50 | return 'Application installation'; |
|
51 | } |
|
52 | ||
53 | protected function getOptionsConfig(Container $container) |
|
54 | { |
|
55 | $config = $container->make('config'); |
|
56 | $options = $config->get($config->get('initializer.options.install')); |
|
57 | ||
58 | $options = array_keys($options); |
|
59 | ||
60 | if (count($options) > 0) { |
|
61 | return '. Allowed options:['.implode(', ', $options).']'; |
|
62 | } |
|
63 | } |
|
64 | } |
|
65 |
@@ 7-69 (lines=63) @@ | ||
4 | ||
5 | use Illuminate\Contracts\Container\Container; |
|
6 | ||
7 | class UpdateCommand extends AbstractInitializeCommand |
|
8 | { |
|
9 | /** |
|
10 | * The console command name. |
|
11 | * |
|
12 | * @var string |
|
13 | */ |
|
14 | protected $name = 'app:update'; |
|
15 | ||
16 | /** |
|
17 | * The console command description. |
|
18 | * |
|
19 | * @var string |
|
20 | */ |
|
21 | protected $description = 'Update the application according to current environment'; |
|
22 | ||
23 | /** |
|
24 | * Create a new command instance. |
|
25 | * |
|
26 | * @param Illuminate\Contracts\Container\Container $container |
|
27 | * @return void |
|
28 | */ |
|
29 | public function __construct(Container $container) |
|
30 | { |
|
31 | $this->signature = 'app:update |
|
32 | {--root : Run commands which requires root privileges} |
|
33 | {--o|options=* : Run commands for custom options'.$this->getOptionsConfig($container).'}'; |
|
34 | ||
35 | parent::__construct(); |
|
36 | } |
|
37 | ||
38 | /** |
|
39 | * Returns instance of Update class which defines initializing runner chain. |
|
40 | * |
|
41 | * {@inheritdoc} |
|
42 | */ |
|
43 | protected function getInitializerInstance(Container $container) |
|
44 | { |
|
45 | return $container->make('app.updater'); |
|
46 | } |
|
47 | ||
48 | protected function title(): string |
|
49 | { |
|
50 | return 'Application update'; |
|
51 | } |
|
52 | ||
53 | /** |
|
54 | * Returns allowed options. |
|
55 | * |
|
56 | * @return string |
|
57 | */ |
|
58 | protected function getOptionsConfig(Container $container) |
|
59 | { |
|
60 | $config = $container->make('config'); |
|
61 | $options = $config->get($config->get('initializer.options.update')); |
|
62 | ||
63 | $options = array_keys($options); |
|
64 | ||
65 | if (count($options) > 0) { |
|
66 | return '. Allowed options:['.implode(', ', $options).']'; |
|
67 | } |
|
68 | } |
|
69 | } |
|
70 |