| @@ 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 | * Returns instance of Install class which defines initializing runner chain. |
|
| 39 | * |
|
| 40 | * {@inheritdoc} |
|
| 41 | */ |
|
| 42 | protected function getInitializerInstance(Container $container) |
|
| 43 | { |
|
| 44 | return $container->make('app.installer'); |
|
| 45 | } |
|
| 46 | ||
| 47 | protected function title(): string |
|
| 48 | { |
|
| 49 | return 'Application installation'; |
|
| 50 | } |
|
| 51 | ||
| 52 | protected function getOptionsConfig(Container $container) |
|
| 53 | { |
|
| 54 | $config = $container->make('config'); |
|
| 55 | $options = $config->get($config->get('initializer.options.install')); |
|
| 56 | ||
| 57 | $options = array_keys($options); |
|
| 58 | ||
| 59 | if(count($options) > 0) { |
|
| 60 | return '. Allowed options:[' . implode(', ', $options) . ']'; |
|
| 61 | } |
|
| 62 | } |
|
| 63 | } |
|
| 64 | ||
| @@ 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 | ||