1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Larrock\Core\Commands; |
4
|
|
|
|
5
|
|
|
use Illuminate\Console\Command; |
6
|
|
|
|
7
|
|
|
class LarrockManagerCommand extends Command |
8
|
|
|
{ |
9
|
|
|
/** |
10
|
|
|
* The name and signature of the console command. |
11
|
|
|
* |
12
|
|
|
* @var string |
13
|
|
|
*/ |
14
|
|
|
protected $signature = 'larrock:manager'; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* The console command description. |
18
|
|
|
* |
19
|
|
|
* @var string |
20
|
|
|
*/ |
21
|
|
|
protected $description = 'Package manager for LarrockCMS'; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Execute the console command. |
25
|
|
|
* |
26
|
|
|
* @return mixed |
27
|
|
|
*/ |
28
|
|
|
public function handle() |
29
|
|
|
{ |
30
|
|
|
$this->info('=== LarrockCMS Package manager ==='); |
31
|
|
|
|
32
|
|
|
$packages = [ |
33
|
|
|
'fanamurov/larrock-catalog', 'fanamurov/larrock-cart', 'fanamurov/larrock-wizard', |
34
|
|
|
'fanamurov/larrock-discount', 'fanamurov/larrock-feed', 'fanamurov/larrock-category', |
35
|
|
|
'fanamurov/larrock-reviews', 'fanamurov/larrock-smartbanners', 'fanamurov/larrock-menu', |
36
|
|
|
'fanamurov/larrock-users', 'fanamurov/larrock-pages', 'fanamurov/larrock-blocks', |
37
|
|
|
'fanamurov/larrock-contact', 'fanamurov/larrock-admin-seo', 'fanamurov/larrock-search', |
38
|
|
|
'fanamurov/larrock-yandex-kassa', 'fanamurov/larrock-vscale', |
39
|
|
|
]; |
40
|
|
|
|
41
|
|
|
$question = array_prepend($packages, 'All'); |
42
|
|
|
$question[] = 'Do not install other packages'; |
43
|
|
|
|
44
|
|
|
$name = $this->choice('What to install/update?', $question); |
45
|
|
|
|
46
|
|
|
if ($name === 'All') { |
47
|
|
|
$this->info('Install all packages LarrockCMS'); |
48
|
|
|
echo shell_exec('composer require '.implode(':^1.* ', $packages).' --prefer-dist'); |
49
|
|
|
} elseif ($name !== 'Do not install other packages') { |
50
|
|
|
$this->info('composer require fanamurov/'.$name.':^1.* --prefer-dist'); |
51
|
|
|
echo shell_exec('composer require fanamurov/'.$name.':^1.* --prefer-dist'); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
if ($name !== 'Do not install other packages') { |
55
|
|
|
$this->call('vendor:publish'); |
56
|
|
|
$this->call('migrate'); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
$this->info('The task is completed! Thank you for using LarrockCMS'); |
60
|
|
|
} |
61
|
|
|
} |
62
|
|
|
|