|
1
|
|
|
<?php namespace Modules\Core\Console; |
|
2
|
|
|
|
|
3
|
|
|
use Illuminate\Console\Command; |
|
4
|
|
|
use Modules\Core\Console\Installers\Installer; |
|
5
|
|
|
use Modules\Core\Console\Installers\Traits\BlockMessage; |
|
6
|
|
|
use Modules\Core\Console\Installers\Traits\SectionMessage; |
|
7
|
|
|
use Symfony\Component\Console\Input\InputOption; |
|
8
|
|
|
|
|
9
|
|
|
class InstallCommand extends Command |
|
10
|
|
|
{ |
|
11
|
|
|
use BlockMessage, SectionMessage; |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* The console command name. |
|
15
|
|
|
* |
|
16
|
|
|
* @var string |
|
17
|
|
|
*/ |
|
18
|
|
|
protected $name = 'asgard:install'; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* The console command description. |
|
22
|
|
|
* |
|
23
|
|
|
* @var string |
|
24
|
|
|
*/ |
|
25
|
|
|
protected $description = 'Install Asgard CMS'; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* @var Installer |
|
29
|
|
|
*/ |
|
30
|
|
|
private $installer; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Create a new command instance. |
|
34
|
|
|
* |
|
35
|
|
|
* @param Installer $installer |
|
36
|
|
|
* @internal param Filesystem $finder |
|
37
|
|
|
* @internal param Application $app |
|
38
|
|
|
* @internal param Composer $composer |
|
39
|
|
|
*/ |
|
40
|
|
|
public function __construct(Installer $installer) |
|
41
|
|
|
{ |
|
42
|
|
|
parent::__construct(); |
|
43
|
|
|
$this->getLaravel()['env'] = 'local'; |
|
44
|
|
|
$this->installer = $installer; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* Execute the actions |
|
49
|
|
|
* |
|
50
|
|
|
* @return mixed |
|
51
|
|
|
*/ |
|
52
|
|
|
public function fire() |
|
53
|
|
|
{ |
|
54
|
|
|
$this->blockMessage('Welcome!', 'Starting the installation process...', 'comment'); |
|
55
|
|
|
|
|
56
|
|
|
$success = $this->installer->stack([ |
|
57
|
|
|
'Modules\Core\Console\Installers\Scripts\ProtectInstaller', |
|
58
|
|
|
'Modules\Core\Console\Installers\Scripts\ConfigureDatabase', |
|
59
|
|
|
'Modules\Core\Console\Installers\Scripts\SetAppKey', |
|
60
|
|
|
'Modules\Core\Console\Installers\Scripts\ConfigureUserProvider', |
|
61
|
|
|
'Modules\Core\Console\Installers\Scripts\ModuleMigrator', |
|
62
|
|
|
'Modules\Core\Console\Installers\Scripts\ModuleSeeders', |
|
63
|
|
|
'Modules\Core\Console\Installers\Scripts\ModuleAssets', |
|
64
|
|
|
'Modules\Core\Console\Installers\Scripts\ThemeAssets', |
|
65
|
|
|
])->install($this); |
|
66
|
|
|
|
|
67
|
|
|
if ($success) { |
|
68
|
|
|
$this->info('Platform ready! You can now login with your username and password at /backend'); |
|
69
|
|
|
} |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
protected function getOptions() |
|
73
|
|
|
{ |
|
74
|
|
|
return [ |
|
75
|
|
|
['force', 'f', InputOption::VALUE_NONE, 'Force the installation, even if already installed'] |
|
76
|
|
|
]; |
|
77
|
|
|
} |
|
78
|
|
|
} |
|
79
|
|
|
|