Publish::handle()   B
last analyzed

Complexity

Conditions 6
Paths 32

Size

Total Lines 33
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 6
eloc 17
nc 32
nop 0
dl 0
loc 33
rs 8.439
c 0
b 0
f 0
1
<?php
2
3
namespace Acacha\ForgePublish\Commands;
4
5
use Acacha\ForgePublish\Commands\Traits\DNSisAlreadyConfigured;
6
use Illuminate\Console\Command;
7
8
/**
9
 * Class Publish.
10
 *
11
 * @package Acacha\ForgePublish\Commands
12
 */
13
class Publish extends Command
14
{
15
    use DNSisAlreadyConfigured;
16
17
    /**
18
     * The name and signature of the console command.
19
     *
20
     * @var string
21
     */
22
    protected $signature = 'publish';
23
24
    /**
25
     * The console command description.
26
     *
27
     * @var string
28
     */
29
    protected $description = 'Publish your project to Laravel Forge';
30
31
    /**
32
     * Execute the console command.
33
     *
34
     */
35
    public function handle()
36
    {
37
        $this->call('publish:repository');
38
39
        $this->call('publish:dns');
40
41
        $this->call('publish:ssh');
42
43
        if ($this->confirm('Do you want to install your project to production?')) {
44
            $this->call('publish:install');
45
        }
46
47
        if ($this->confirm('Do you want to enable Laravel Forge autodeploy?')) {
48
            $this->call('publish:autodeploy');
49
        }
50
51
        if ($this->confirm('Do you want to install a Deployment script with hooks?')) {
52
            $this->call('publish:deployment_script_with_hooks');
53
        }
54
55
        $this->info('### SSL. Lets Encrypt will only work on sites with a valid domain (no /etc/hosts/trick) ###');
56
        $this->info("### Skip the next step if you don't need SSL or not have a valid domain name");
57
58
        if ($this->confirm('Do you want to enable SSL on site using Lets Encrypt?')) {
59
            $this->call('publish:ssl');
60
        }
61
62
        if ($this->confirm('Do you want open your app in your default browser?')) {
63
            $this->call('publish:open');
64
        }
65
66
        $this->info("I have finished publishing you project into Laravel Forge server! Congratulations and enjoy!");
67
    }
68
}
69