1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Commands; |
4
|
|
|
|
5
|
|
|
use App\Exceptions\PorterSetupFailed; |
6
|
|
|
use App\Support\Images\Organiser\Organiser as ImageOrganiser; |
7
|
|
|
|
8
|
|
|
class Begin extends BaseCommand |
9
|
|
|
{ |
10
|
|
|
/** |
11
|
|
|
* The begin command may be run at any time, since it's needed to perform setup. |
12
|
|
|
* |
13
|
|
|
* @var bool |
14
|
|
|
*/ |
15
|
|
|
protected $porterMustBeSetUp = false; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* The signature of the command. |
19
|
|
|
* |
20
|
|
|
* @var string |
21
|
|
|
*/ |
22
|
|
|
protected $signature = 'begin {home?} {--force}'; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* The description of the command. |
26
|
|
|
* |
27
|
|
|
* @var string |
28
|
|
|
*/ |
29
|
|
|
protected $description = 'Run initial seeders and set up'; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Execute the console command. |
33
|
|
|
* |
34
|
|
|
* @throws \Exception |
35
|
|
|
* |
36
|
|
|
* @return void |
37
|
|
|
*/ |
38
|
1 |
|
public function handle(): void |
39
|
|
|
{ |
40
|
1 |
|
$this->line('================'); |
41
|
1 |
|
$this->line('PREPARING PORTER'); |
42
|
1 |
|
$this->line('================'); |
43
|
1 |
|
$this->line(''); |
44
|
|
|
|
45
|
|
|
try { |
46
|
1 |
|
$this->porterLibrary->setup($this->app, (bool) $this->option('force')); |
|
|
|
|
47
|
|
|
} catch (PorterSetupFailed $e) { |
48
|
|
|
$this->alert($e->getMessage()); |
49
|
|
|
|
50
|
|
|
return; |
51
|
|
|
} |
52
|
|
|
|
53
|
1 |
|
$this->info('Your Porter settings are stored in '.$this->porterLibrary->path()); |
54
|
1 |
|
$this->info(''); |
55
|
|
|
|
56
|
1 |
|
$home = realpath((string) $this->argument('home') ?: $this->cli->currentWorkingDirectory()); |
57
|
1 |
|
$this->callSilent('home', ['path' => $home]); |
58
|
|
|
|
59
|
1 |
|
$this->info("Setting home to {$home}."); |
60
|
1 |
|
$this->comment('This is the root directory for your sites.'); |
61
|
1 |
|
$this->comment("If this is incorrect, you can change it using the 'porter home' command."); |
62
|
1 |
|
$this->comment(''); |
63
|
|
|
|
64
|
1 |
|
$this->info('Retrieving docker images'); |
65
|
1 |
|
app(ImageOrganiser::class)->pullImages(); |
66
|
1 |
|
} |
67
|
|
|
} |
68
|
|
|
|