Skip to content
This repository was archived by the owner on Dec 28, 2021. It is now read-only.

Commit 0ea4d2c

Browse files
RamonSmitStyleCIBot
authored andcommitted
Apply fixes from StyleCI
1 parent 5b4acb8 commit 0ea4d2c

File tree

12 files changed

+115
-115
lines changed

12 files changed

+115
-115
lines changed

config/laravel-deploy-helper.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
'stages' => [
55
'production' => [
66
'git' => [
7-
'http' => ''
7+
'http' => '',
88
],
99

1010
'connection' => [
@@ -32,8 +32,8 @@
3232
'storage',
3333
],
3434
'files' => [
35-
'.env'
36-
]
35+
'.env',
36+
],
3737
],
3838

3939
'config' => [
@@ -43,6 +43,6 @@
4343
],
4444
'keep' => 4,
4545
],
46-
]
47-
]
46+
],
47+
],
4848
];

src/Console/Commands/Deploy.php

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public function __construct()
4545
* Execute the console command.
4646
*
4747
* @throws \Exception on failure
48+
*
4849
* @return mixed
4950
*/
5051
public function handle()
@@ -54,9 +55,9 @@ public function handle()
5455
if ($this->option('stage') === null) {
5556
throw new \Exception('The argument "--stage=" is required!', 128);
5657
} else {
57-
if (!is_array(config('laravel-deploy-helper.stages.' . $this->option('stage')))) {
58-
throw new \Exception('The stage "' . $this->option('stage')
59-
. '" does not exist!', 128);
58+
if (!is_array(config('laravel-deploy-helper.stages.'.$this->option('stage')))) {
59+
throw new \Exception('The stage "'.$this->option('stage')
60+
.'" does not exist!', 128);
6061
}
6162
}
6263

@@ -65,12 +66,12 @@ public function handle()
6566
}
6667

6768
if (in_array($this->option('branch'), Git::getBranches()) == false) {
68-
throw new \Exception('The branch "' . $this->option('branch')
69-
. '" does not exists locally? Please `git pull`!', 128);
69+
throw new \Exception('The branch "'.$this->option('branch')
70+
.'" does not exists locally? Please `git pull`!', 128);
7071
}
7172

7273
// Connecting to remote server
73-
verbose('[' . $this->option('stage') . '] Trying to login into remote SSH');
74+
verbose('['.$this->option('stage').'] Trying to login into remote SSH');
7475
$ssh = SSH::instance()->into($this->option('stage'));
7576

7677
// Check for lockfile
@@ -80,22 +81,22 @@ public function handle()
8081
}
8182

8283
// Trying to read file
83-
verbose('[' . $this->option('stage') . '] Reading config file from remote server');
84-
$config = $ssh->exists(SSH::home($this->option('stage')) . '/ldh.json');
84+
verbose('['.$this->option('stage').'] Reading config file from remote server');
85+
$config = $ssh->exists(SSH::home($this->option('stage')).'/ldh.json');
8586

8687
// Check if config exists
8788
if ($config == false) {
88-
error('[' . $this->option('stage') . '] ldh.json does not exists.');
89+
error('['.$this->option('stage').'] ldh.json does not exists.');
8990
if ($this->confirm('Do you want to initialize LDH here?')) {
9091
Deployer::freshInit($ssh, $this->option('stage'));
9192
} else {
9293
return false;
9394
}
9495
} else {
95-
verbose('[' . $this->option('stage') . '] Found config. Checking directories.');
96-
$config = $ssh->getString(SSH::home($this->option('stage')) . '/ldh.json');
96+
verbose('['.$this->option('stage').'] Found config. Checking directories.');
97+
$config = $ssh->getString(SSH::home($this->option('stage')).'/ldh.json');
9798
if ($config == false) {
98-
error('[' . $this->option('stage') . '] Config file is empty... Something is wrong.');
99+
error('['.$this->option('stage').'] Config file is empty... Something is wrong.');
99100

100101
return false;
101102
}
@@ -106,10 +107,10 @@ public function handle()
106107
$this->ldh = Deployer::doDeploy($ssh, $this->option('stage'), $this->option('branch'), $this->ldh);
107108

108109
// Write to config
109-
$ssh->putString(SSH::home($this->option('stage')) . '/ldh.json', json_encode($this->ldh));
110+
$ssh->putString(SSH::home($this->option('stage')).'/ldh.json', json_encode($this->ldh));
110111

111112
// Done
112-
verbose('[' . $this->option('stage') . '] Deploy successfull!');
113+
verbose('['.$this->option('stage').'] Deploy successfull!');
113114
Locker::unlock($ssh, $this->option('stage'));
114115
}
115116
}

src/Console/Commands/Locktest.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public function __construct()
3535
* Execute the console command.
3636
*
3737
* @throws \Exception on failure
38+
*
3839
* @return mixed
3940
*/
4041
public function handle()
@@ -45,21 +46,21 @@ public function handle()
4546
if ($this->option('stage') === null) {
4647
throw new \Exception('The argument "--stage=" is required!', 128);
4748
} else {
48-
if (!is_array(config('laravel-deploy-helper.stages.' . $this->option('stage')))) {
49-
throw new \Exception('The stage "' . $this->option('stage')
50-
. '" does not exist!', 128);
49+
if (!is_array(config('laravel-deploy-helper.stages.'.$this->option('stage')))) {
50+
throw new \Exception('The stage "'.$this->option('stage')
51+
.'" does not exist!', 128);
5152
}
5253
}
5354

5455
$stage = $this->option('stage');
5556

5657
// Connecting to remote server
57-
verbose('[' . $this->option('stage') . '] Trying to login into remote SSH');
58+
verbose('['.$this->option('stage').'] Trying to login into remote SSH');
5859
$ssh = SSH::instance()->into($this->option('stage'));
5960

60-
verbose('Setting lock: ' . (Locker::lock($ssh, $stage) ? 'OK' : 'Error'));
61-
verbose('Getting lock: ' . (Locker::verify($ssh, $stage) ? 'OK' : 'Error'));
62-
verbose('Path to lock: ' . Locker::getLockPath($ssh, $stage));
63-
verbose('Destroy lock: ' . (Locker::unlock($ssh, $stage) ? 'OK' : 'Error'));
61+
verbose('Setting lock: '.(Locker::lock($ssh, $stage) ? 'OK' : 'Error'));
62+
verbose('Getting lock: '.(Locker::verify($ssh, $stage) ? 'OK' : 'Error'));
63+
verbose('Path to lock: '.Locker::getLockPath($ssh, $stage));
64+
verbose('Destroy lock: '.(Locker::unlock($ssh, $stage) ? 'OK' : 'Error'));
6465
}
6566
}

src/Console/Commands/Rollback.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ class Rollback extends Command
3030

3131
/**
3232
* Create a new command instance.
33-
*
3433
*/
3534
public function __construct()
3635
{
@@ -41,6 +40,7 @@ public function __construct()
4140
* Execute the console command.
4241
*
4342
* @throws \Exception on failure
43+
*
4444
* @return mixed
4545
*/
4646
public function handle()
@@ -51,14 +51,14 @@ public function handle()
5151
if ($this->option('stage') === null) {
5252
throw new \Exception('The argument "--stage=" is required!', 128);
5353
} else {
54-
if (!is_array(config('laravel-deploy-helper.stages.' . $this->option('stage')))) {
55-
throw new \Exception('The stage "' . $this->option('stage')
56-
. '" does not exist!', 128);
54+
if (!is_array(config('laravel-deploy-helper.stages.'.$this->option('stage')))) {
55+
throw new \Exception('The stage "'.$this->option('stage')
56+
.'" does not exist!', 128);
5757
}
5858
}
5959

6060
// Connecting to remote server
61-
verbose('[' . $this->option('stage') . '] Trying to login into remote SSH');
61+
verbose('['.$this->option('stage').'] Trying to login into remote SSH');
6262
$ssh = SSH::instance()->into($this->option('stage'));
6363

6464
// Check for lockfile
@@ -68,18 +68,18 @@ public function handle()
6868
}
6969

7070
// Trying to read file
71-
verbose('[' . $this->option('stage') . '] Reading config file from remote server');
72-
$config = $ssh->exists(SSH::home($this->option('stage')) . '/ldh.json');
71+
verbose('['.$this->option('stage').'] Reading config file from remote server');
72+
$config = $ssh->exists(SSH::home($this->option('stage')).'/ldh.json');
7373

7474
// Check if config exists
7575
if ($config == false) {
76-
error('[' . $this->option('stage') . '] ldh.json does not exists.');
76+
error('['.$this->option('stage').'] ldh.json does not exists.');
7777
exit(128);
7878
} else {
79-
verbose('[' . $this->option('stage') . '] Found config. Checking directories.');
80-
$config = $ssh->getString(SSH::home($this->option('stage')) . '/ldh.json');
79+
verbose('['.$this->option('stage').'] Found config. Checking directories.');
80+
$config = $ssh->getString(SSH::home($this->option('stage')).'/ldh.json');
8181
if ($config == false) {
82-
error('[' . $this->option('stage') . '] Config file is empty... Something is wrong.');
82+
error('['.$this->option('stage').'] Config file is empty... Something is wrong.');
8383
exit(0);
8484
}
8585
$this->ldh = json_decode($config, true);
@@ -96,8 +96,8 @@ public function handle()
9696
}
9797

9898
$this->ldh = Deployer::doRollback($ssh, $this->option('stage'), $this->ldh, $dirs);
99-
$ssh->putString(SSH::home($this->option('stage')) . '/ldh.json', json_encode($this->ldh));
100-
verbose('[' . $this->option('stage') . '] Rolled back!');
99+
$ssh->putString(SSH::home($this->option('stage')).'/ldh.json', json_encode($this->ldh));
100+
verbose('['.$this->option('stage').'] Rolled back!');
101101
Locker::unlock($ssh, $this->option('stage'));
102102
}
103103
}

src/Helpers/Command.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class Command
1010
{
1111
/**
12-
* Execute command on CLI
12+
* Execute command on CLI.
1313
*
1414
* @param string $prefix utility to execute
1515
* @param array $args the arguments to give to the prefix
@@ -18,8 +18,6 @@ class Command
1818
*/
1919
protected static function command($prefix, $args)
2020
{
21-
22-
2321
$process = new Process(self::builder($prefix, $args));
2422
$process->run();
2523

src/Helpers/Deployer.php

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ public static function freshInit(Connection $connection, $stage)
1414
{
1515
// Init fresh remote repo
1616
$connection->define('init', [
17-
'cd ' . config('laravel-deploy-helper.stages.' . $stage . '.remote.root'),
17+
'cd '.config('laravel-deploy-helper.stages.'.$stage.'.remote.root'),
1818
'mkdir releases',
1919
'mkdir shared',
20-
'touch ldh.json'
20+
'touch ldh.json',
2121
]);
2222
$connection->task('init');
2323
}
@@ -34,11 +34,11 @@ public static function doDeploy(Connection $connection, $stage, $branch, $ldh)
3434
{
3535
// Some stuff that does not change in runtime
3636
$releaseName = time();
37-
$home = config('laravel-deploy-helper.stages.' . $stage . '.remote.root');
38-
$shared = config('laravel-deploy-helper.stages.' . $stage . '.shared');
39-
$commands = config('laravel-deploy-helper.stages.' . $stage . '.commands');
40-
$versions = config('laravel-deploy-helper.stages.' . $stage . '.config.dependencies');
41-
$keep = config('laravel-deploy-helper.stages.' . $stage . '.config.keep');
37+
$home = config('laravel-deploy-helper.stages.'.$stage.'.remote.root');
38+
$shared = config('laravel-deploy-helper.stages.'.$stage.'.shared');
39+
$commands = config('laravel-deploy-helper.stages.'.$stage.'.commands');
40+
$versions = config('laravel-deploy-helper.stages.'.$stage.'.config.dependencies');
41+
$keep = config('laravel-deploy-helper.stages.'.$stage.'.config.keep');
4242

4343
// Check what releases are old and can be removed
4444
ksort($ldh);
@@ -48,35 +48,35 @@ public static function doDeploy(Connection $connection, $stage, $branch, $ldh)
4848

4949
// Check versions
5050
// Operators: http://php.net/manual/en/function.version-compare.php
51-
verbose('[' . $stage . '] Checking dependencies. Migth take a minute.');
51+
verbose('['.$stage.'] Checking dependencies. Migth take a minute.');
5252
foreach ($versions as $app => $version) {
5353
SSH::checkAppVersion($connection, $app, $version);
5454
}
5555

5656
// Define the deploy
5757
$connection->define('deploy', [
58-
'mkdir ' . $home . '/releases/' . $releaseName,
59-
'cd ' . $home . '/releases/' . $releaseName,
60-
'git clone -b ' . $branch . ' ' . config('laravel-deploy-helper.stages.' . $stage . '.git.http') . ' .'
58+
'mkdir '.$home.'/releases/'.$releaseName,
59+
'cd '.$home.'/releases/'.$releaseName,
60+
'git clone -b '.$branch.' '.config('laravel-deploy-helper.stages.'.$stage.'.git.http').' .',
6161
]);
6262

6363
// Pre-flight for shared stuff
6464
$items['directories'] = [];
6565
foreach ($shared['directories'] as $share) {
66-
verbose('[' . $stage . '] About to share direcroty "' . $home . '/current/' . $share . '"');
67-
$items['directories'][] = '[ -e ' . $home . '/current/' . $share . ' ] && cp -R -p ' . $home . '/current/'
68-
. $share . ' ' . $home . '/shared/' . $share;
69-
$items['directories'][] = '[ -e ' . $home . '/shared/' . $share . ' ] && cp -R -p ' . $home . '/shared/' .
70-
$share . ' ' . $home . '/releases/' . $releaseName;
66+
verbose('['.$stage.'] About to share direcroty "'.$home.'/current/'.$share.'"');
67+
$items['directories'][] = '[ -e '.$home.'/current/'.$share.' ] && cp -R -p '.$home.'/current/'
68+
.$share.' '.$home.'/shared/'.$share;
69+
$items['directories'][] = '[ -e '.$home.'/shared/'.$share.' ] && cp -R -p '.$home.'/shared/'.
70+
$share.' '.$home.'/releases/'.$releaseName;
7171
}
7272
// Pre-flight for shared stuff
7373
$items['files'] = [];
7474
foreach ($shared['files'] as $share) {
75-
verbose('[' . $stage . '] About to share file "' . $home . '/current/' . $share . '"');
76-
$items['files'][] = '[ -e ' . $home . '/current/' . $share . ' ] && cp -p ' . $home . '/current/' . $share
77-
. ' ' . $home . '/shared/' . $share;
78-
$items['files'][] = '[ -e ' . $home . '/shared/' . $share . ' ] && cp -p ' . $home . '/shared/' . $share .
79-
' ' . $home . '/releases/' . $releaseName . '/' . $share;
75+
verbose('['.$stage.'] About to share file "'.$home.'/current/'.$share.'"');
76+
$items['files'][] = '[ -e '.$home.'/current/'.$share.' ] && cp -p '.$home.'/current/'.$share
77+
.' '.$home.'/shared/'.$share;
78+
$items['files'][] = '[ -e '.$home.'/shared/'.$share.' ] && cp -p '.$home.'/shared/'.$share.
79+
' '.$home.'/releases/'.$releaseName.'/'.$share;
8080
}
8181

8282
// Define shared files
@@ -87,36 +87,36 @@ public static function doDeploy(Connection $connection, $stage, $branch, $ldh)
8787

8888
$items = [];
8989
foreach ($commands as $command) {
90-
$items[] = 'cd ' . $home . '/releases/' . $releaseName . ' && ' . $command;
90+
$items[] = 'cd '.$home.'/releases/'.$releaseName.' && '.$command;
9191
}
9292
// Define commands
9393
$connection->define('definedCommands', $items);
9494

9595
// Define post deploy actions
9696
$connection->define('postDeploy', [
97-
'ln -sfn ' . $home . '/releases/' . $releaseName . ' ' . $home . '/current',
98-
'rm -rf ' . $home . '/shared/*'
97+
'ln -sfn '.$home.'/releases/'.$releaseName.' '.$home.'/current',
98+
'rm -rf '.$home.'/shared/*',
9999
]);
100100

101101
// Remove old deploys
102102
$items = [];
103103
foreach ($toRemove as $dir => $val) {
104-
$items[] = 'echo "Removing release ' . $dir . '" && rm -rf ' . $home . '/releases/' . $dir;
104+
$items[] = 'echo "Removing release '.$dir.'" && rm -rf '.$home.'/releases/'.$dir;
105105
}
106106
$connection->define('removeOld', $items);
107107

108108
// Execute them!
109-
verbose('[' . $stage . '] Deploying ' . $branch . ' to server');
109+
verbose('['.$stage.'] Deploying '.$branch.' to server');
110110
$connection->task('deploy');
111-
verbose('[' . $stage . '] Handling shared files');
111+
verbose('['.$stage.'] Handling shared files');
112112
$connection->task('getSharedFiles');
113-
verbose('[' . $stage . '] Handling shared directories');
113+
verbose('['.$stage.'] Handling shared directories');
114114
$connection->task('getSharedDirectories');
115-
verbose('[' . $stage . '] Handling commands');
115+
verbose('['.$stage.'] Handling commands');
116116
$connection->task('definedCommands');
117-
verbose('[' . $stage . '] Clean up and linking new instance');
117+
verbose('['.$stage.'] Clean up and linking new instance');
118118
$connection->task('postDeploy');
119-
verbose('[' . $stage . '] Remove old deploys');
119+
verbose('['.$stage.'] Remove old deploys');
120120
$connection->task('removeOld');
121121

122122
$ldh[$releaseName] = true;
@@ -126,15 +126,15 @@ public static function doDeploy(Connection $connection, $stage, $branch, $ldh)
126126

127127
public static function doRollback(Connection $connection, $stage, $ldh, $dirs)
128128
{
129-
$home = config('laravel-deploy-helper.stages.' . $stage . '.remote.root');
129+
$home = config('laravel-deploy-helper.stages.'.$stage.'.remote.root');
130130

131131
// Define post deploy actions
132132
$connection->define('preformRollback', [
133-
'ln -sfn ' . $home . '/releases/' . $dirs[1] . ' ' . $home . '/current',
134-
'rm -rf ' . $home . '/releases/' . $dirs[0],
133+
'ln -sfn '.$home.'/releases/'.$dirs[1].' '.$home.'/current',
134+
'rm -rf '.$home.'/releases/'.$dirs[0],
135135
]);
136136

137-
verbose("\t" . 'Hold my beer, We\'re rolling back');
137+
verbose("\t".'Hold my beer, We\'re rolling back');
138138
$connection->task('preformRollback');
139139

140140
unset($dirs[0]);

0 commit comments

Comments
 (0)