1 | <?php |
||
11 | class InstallCommand extends Command |
||
12 | { |
||
13 | /** |
||
14 | * The console command name. |
||
15 | * |
||
16 | * @var string |
||
17 | */ |
||
18 | protected $name = 'module:install'; |
||
19 | |||
20 | /** |
||
21 | * The console command description. |
||
22 | * |
||
23 | * @var string |
||
24 | */ |
||
25 | protected $description = 'Install the specified module by given package name (vendor/name).'; |
||
26 | |||
27 | /** |
||
28 | * Create a new command instance. |
||
29 | */ |
||
30 | 99 | public function __construct() |
|
34 | |||
35 | /** |
||
36 | * Execute the console command. |
||
37 | */ |
||
38 | public function handle() |
||
53 | |||
54 | /** |
||
55 | * Install modules from modules.json file. |
||
56 | */ |
||
57 | protected function installFromFile() |
||
79 | |||
80 | /** |
||
81 | * Install the specified module. |
||
82 | * |
||
83 | * @param string $name |
||
84 | * @param string $version |
||
85 | * @param string $type |
||
86 | * @param bool $tree |
||
87 | */ |
||
88 | protected function install($name, $version = 'dev-master', $type = 'composer', $tree = false) |
||
89 | { |
||
90 | $installer = new Installer( |
||
91 | $name, |
||
92 | $version, |
||
93 | $type ?: $this->option('type'), |
||
94 | $tree ?: $this->option('tree') |
||
95 | ); |
||
96 | |||
97 | $installer->setRepository($this->laravel['modules']); |
||
98 | |||
99 | $installer->setConsole($this); |
||
100 | |||
101 | if ($timeout = $this->option('timeout')) { |
||
102 | $installer->setTimeout($timeout); |
||
103 | } |
||
104 | |||
105 | if ($path = $this->option('path')) { |
||
106 | $installer->setPath($path); |
||
107 | } |
||
108 | |||
109 | $installer->run(); |
||
110 | |||
111 | if (!$this->option('no-update')) { |
||
112 | $this->call('module:update', [ |
||
113 | 'module' => $installer->getModuleName(), |
||
114 | ]); |
||
115 | } |
||
116 | } |
||
117 | |||
118 | /** |
||
119 | * Get the console command arguments. |
||
120 | * |
||
121 | * @return array |
||
122 | */ |
||
123 | 99 | protected function getArguments() |
|
130 | |||
131 | /** |
||
132 | * Get the console command options. |
||
133 | * |
||
134 | * @return array |
||
135 | */ |
||
136 | 99 | protected function getOptions() |
|
146 | } |
||
147 |