Code Duplication    Length = 73-73 lines in 2 locations

src/Console/Commands/PublishUpgrade.php 1 location

@@ 15-87 (lines=73) @@
12
 *
13
 * @package Acacha\ForgePublish\Commands
14
 */
15
class PublishUpgrade extends Command
16
{
17
    use ChecksEnv, RunsSSHCommands;
18
19
    /**
20
     * Server name
21
     *
22
     * @var String
23
     */
24
    protected $server;
25
26
    /**
27
     * Domain
28
     *
29
     * @var String
30
     */
31
    protected $domain;
32
33
    /**
34
     * The name and signature of the console command.
35
     *
36
     * @var string
37
     */
38
    protected $signature = 'publish:upgrade {--server=} {--domain=}';
39
40
    /**
41
     * The console command description.
42
     *
43
     * @var string
44
     */
45
    protected $description = 'Run dist-upgrade on server';
46
47
    /**
48
     * Guzzle http client.
49
     *
50
     * @var Client
51
     */
52
    protected $http;
53
54
    /**
55
     * Create a new command instance.
56
     *
57
     */
58
    public function __construct(Client $http)
59
    {
60
        parent::__construct();
61
        $this->http = $http;
62
    }
63
64
    /**
65
     * Execute the console command.
66
     *
67
     */
68
    public function handle()
69
    {
70
        $this->abortCommandExecution();
71
        $this->info("Upgrading server...");
72
        $this->runSSH("cd $this->domain;sudo apt-get update && sudo apt-get dist-upgrade");
73
    }
74
75
    /**
76
     * Abort command execution?
77
     */
78
    protected function abortCommandExecution()
79
    {
80
        $this->server = $this->checkEnv('server', 'ACACHA_FORGE_SERVER');
81
        $this->domain = $this->checkEnv('domain', 'ACACHA_FORGE_DOMAIN');
82
83
        $this->abortIfNoSSHConnection();
84
    }
85
}
86

src/Console/Commands/PublishZsh.php 1 location

@@ 15-87 (lines=73) @@
12
 *
13
 * @package Acacha\ForgePublish\Commands
14
 */
15
class PublishZsh extends Command
16
{
17
    use ChecksEnv, RunsSSHCommands;
18
19
    /**
20
     * Server name
21
     *
22
     * @var String
23
     */
24
    protected $server;
25
26
    /**
27
     * Domain
28
     *
29
     * @var String
30
     */
31
    protected $domain;
32
33
    /**
34
     * The name and signature of the console command.
35
     *
36
     * @var string
37
     */
38
    protected $signature = 'publish:zsh {--server=} {--domain=}';
39
40
    /**
41
     * The console command description.
42
     *
43
     * @var string
44
     */
45
    protected $description = 'Install zsh and oh my zsh';
46
47
    /**
48
     * Guzzle http client.
49
     *
50
     * @var Client
51
     */
52
    protected $http;
53
54
    /**
55
     * Create a new command instance.
56
     *
57
     */
58
    public function __construct(Client $http)
59
    {
60
        parent::__construct();
61
        $this->http = $http;
62
    }
63
64
    /**
65
     * Execute the console command.
66
     *
67
     */
68
    public function handle()
69
    {
70
        $this->abortCommandExecution();
71
        $this->info("Installing zsh on production...");
72
        $this->runSSH('cd $this->domain;sudo apt-get install zsh;sudo apt-get install curl;sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"');
73
    }
74
75
    /**
76
     * Abort command execution?
77
     */
78
    protected function abortCommandExecution()
79
    {
80
        $this->server = $this->checkEnv('server', 'ACACHA_FORGE_SERVER');
81
        $this->domain = $this->checkEnv('domain', 'ACACHA_FORGE_DOMAIN');
82
83
        $this->abortIfNoSSHConnection();
84
    }
85
}
86