|
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
|
|
|
* @return void |
|
35
|
|
|
* @throws \Exception |
|
36
|
|
|
*/ |
|
37
|
1 |
|
public function handle(): void |
|
38
|
|
|
{ |
|
39
|
1 |
|
$this->line('================'); |
|
40
|
1 |
|
$this->line('PREPARING PORTER'); |
|
41
|
1 |
|
$this->line('================'); |
|
42
|
1 |
|
$this->line(''); |
|
43
|
|
|
|
|
44
|
|
|
try { |
|
45
|
1 |
|
$this->porterLibrary->setup($this->app, (bool) $this->option('force')); |
|
|
|
|
|
|
46
|
|
|
} catch (PorterSetupFailed $e) { |
|
47
|
|
|
$this->alert($e->getMessage()); |
|
48
|
|
|
|
|
49
|
|
|
return; |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
1 |
|
$this->info('Your Porter settings are stored in '.$this->porterLibrary->path()); |
|
53
|
1 |
|
$this->info(''); |
|
54
|
|
|
|
|
55
|
1 |
|
$home = realpath((string) $this->argument('home') ?: $this->cli->currentWorkingDirectory()); |
|
56
|
1 |
|
$this->callSilent('home', ['path' => $home]); |
|
57
|
|
|
|
|
58
|
1 |
|
$this->info("Setting home to {$home}."); |
|
59
|
1 |
|
$this->comment('This is the root directory for your sites.'); |
|
60
|
1 |
|
$this->comment("If this is incorrect, you can change it using the 'porter home' command."); |
|
61
|
1 |
|
$this->comment(''); |
|
62
|
|
|
|
|
63
|
1 |
|
$this->info('Retrieving docker images'); |
|
64
|
1 |
|
app(ImageOrganiser::class)->pullImages(); |
|
65
|
1 |
|
} |
|
66
|
|
|
} |
|
67
|
|
|
|