diff --git a/src/Helpers/Deployer.php b/src/Helpers/Deployer.php
index 03cf149..cdd2cf2 100644
--- a/src/Helpers/Deployer.php
+++ b/src/Helpers/Deployer.php
@@ -14,7 +14,7 @@ public static function freshInit(Connection $connection, $stage)
{
// Init fresh remote repo
$connection->define('init', [
- 'cd ' . config('laravel-deploy-helper.stages.' . $stage . '.remote.root'),
+ 'cd '.config('laravel-deploy-helper.stages.'.$stage.'.remote.root'),
'mkdir releases',
'mkdir patches',
'mkdir shared',
@@ -36,11 +36,11 @@ public static function doDeploy($stage, $branch, $ldh)
{
// Some stuff that does not change in runtime
$releaseName = time();
- $home = config('laravel-deploy-helper.stages.' . $stage . '.remote.root');
- $shared = config('laravel-deploy-helper.stages.' . $stage . '.shared');
- $commands = config('laravel-deploy-helper.stages.' . $stage . '.commands');
- $versions = config('laravel-deploy-helper.stages.' . $stage . '.config.dependencies');
- $keep = config('laravel-deploy-helper.stages.' . $stage . '.config.keep');
+ $home = config('laravel-deploy-helper.stages.'.$stage.'.remote.root');
+ $shared = config('laravel-deploy-helper.stages.'.$stage.'.shared');
+ $commands = config('laravel-deploy-helper.stages.'.$stage.'.commands');
+ $versions = config('laravel-deploy-helper.stages.'.$stage.'.config.dependencies');
+ $keep = config('laravel-deploy-helper.stages.'.$stage.'.config.keep');
// Check what releases are old and can be removed
// Adding the array fixed #1
@@ -56,7 +56,7 @@ public static function doDeploy($stage, $branch, $ldh)
// Check versions
// Operators: http://php.net/manual/en/function.version-compare.php
- verbose('[' . $stage . '] Checking dependencies. Might take a minute.');
+ verbose('['.$stage.'] Checking dependencies. Might take a minute.');
foreach ($versions as $app => $version) {
// if (SSH::checkAppVersion($connection, $app, $version) == '-1') {
// Locker::unlock($connection, $stage);
@@ -66,64 +66,64 @@ public static function doDeploy($stage, $branch, $ldh)
}
// Define the deploy
- verbose('[' . $stage . '] Creating new release directory and pulling from remote');
+ verbose('['.$stage.'] Creating new release directory and pulling from remote');
// Fixes https://github.com/DALTCORE/laravel-deploy-helper/issues/6#issuecomment-315124310
- $url = config('laravel-deploy-helper.stages.' . $stage . '.git.http');
+ $url = config('laravel-deploy-helper.stages.'.$stage.'.git.http');
if ($url === null) {
- $url = config('laravel-deploy-helper.stages.' . $stage . '.git');
+ $url = config('laravel-deploy-helper.stages.'.$stage.'.git');
}
- SSH::execute($stage, ['mkdir ' . $home . '/releases/' . $releaseName]);
+ SSH::execute($stage, ['mkdir '.$home.'/releases/'.$releaseName]);
SSH::execute(
$stage,
[
- 'cd ' . $home . '/releases/' . $releaseName . '; ' .
- 'git clone -b ' . $branch . ' ' . "'" . $url . "'" . ' .',
+ 'cd '.$home.'/releases/'.$releaseName.'; '.
+ 'git clone -b '.$branch.' '."'".$url."'".' .',
]
);
// Pre-flight for shared stuff
$items['directories'] = [];
foreach ($shared['directories'] as $share) {
- verbose('[' . $stage . '] About to share directory "' . $home . '/current/' . $share . '"');
- SSH::execute($stage, ['[ -e ' . $home . '/current/' . $share . ' ] && cp -R -p ' . $home . '/current/'
- . $share . ' ' . $home . '/shared/' . $share,]);
+ verbose('['.$stage.'] About to share directory "'.$home.'/current/'.$share.'"');
+ SSH::execute($stage, ['[ -e '.$home.'/current/'.$share.' ] && cp -R -p '.$home.'/current/'
+ .$share.' '.$home.'/shared/'.$share, ]);
SSH::execute(
$stage,
- [$items['directories'][] = '[ -e ' . $home . '/shared/' . $share . ' ] && cp -R -p ' . $home .
- '/shared/' . $share . ' ' . $home . '/releases/' . $releaseName,]
+ [$items['directories'][] = '[ -e '.$home.'/shared/'.$share.' ] && cp -R -p '.$home.
+ '/shared/'.$share.' '.$home.'/releases/'.$releaseName, ]
);
}
// Pre-flight for shared stuff
$items['files'] = [];
foreach ($shared['files'] as $share) {
- verbose('[' . $stage . '] About to share file "' . $home . '/current/' . $share . '"');
- SSH::execute($stage, ['[ -e ' . $home . '/current/' . $share . ' ] && cp -p ' . $home . '/current/' . $share
- . ' ' . $home . '/shared/' . $share,]);
- SSH::execute($stage, ['[ -e ' . $home . '/shared/' . $share . ' ] && cp -p ' . $home . '/shared/' . $share .
- ' ' . $home . '/releases/' . $releaseName . '/' . $share,]);
+ verbose('['.$stage.'] About to share file "'.$home.'/current/'.$share.'"');
+ SSH::execute($stage, ['[ -e '.$home.'/current/'.$share.' ] && cp -p '.$home.'/current/'.$share
+ .' '.$home.'/shared/'.$share, ]);
+ SSH::execute($stage, ['[ -e '.$home.'/shared/'.$share.' ] && cp -p '.$home.'/shared/'.$share.
+ ' '.$home.'/releases/'.$releaseName.'/'.$share, ]);
}
// Define commands
- verbose('[' . $stage . '] Executing custom commands');
+ verbose('['.$stage.'] Executing custom commands');
$items = [];
foreach ($commands as $command) {
- SSH::execute($stage, ['cd ' . $home . '/releases/' . $releaseName . ' && ' . $command]);
+ SSH::execute($stage, ['cd '.$home.'/releases/'.$releaseName.' && '.$command]);
}
// Define post deploy actions
- verbose('[' . $stage . '] Linking new release to /current directory and removing temp');
+ verbose('['.$stage.'] Linking new release to /current directory and removing temp');
SSH::execute($stage, [
- 'ln -sfn ' . $home . '/releases/' . $releaseName . ' ' . $home . '/current &&' .
- 'rm -rf ' . $home . '/shared/*',
+ 'ln -sfn '.$home.'/releases/'.$releaseName.' '.$home.'/current &&'.
+ 'rm -rf '.$home.'/shared/*',
]);
// Remove old deploys
if (isset($toRemove) && is_array($toRemove)) {
$items = [];
- verbose('[' . $stage . '] Cleaning up old releases');
+ verbose('['.$stage.'] Cleaning up old releases');
foreach ($toRemove as $dir => $val) {
- SSH::execute($stage, ['echo "Removing release ' . $dir . '" && rm -rf ' . $home . '/releases/' . $dir]);
+ SSH::execute($stage, ['echo "Removing release '.$dir.'" && rm -rf '.$home.'/releases/'.$dir]);
}
}
@@ -137,15 +137,15 @@ public static function doDeploy($stage, $branch, $ldh)
*/
public static function doRollback(Connection $connection, $stage, $ldh, $dirs)
{
- $home = config('laravel-deploy-helper.stages.' . $stage . '.remote.root');
+ $home = config('laravel-deploy-helper.stages.'.$stage.'.remote.root');
// Define post deploy actions
$connection->define('preformRollback', [
- 'ln -sfn ' . $home . '/releases/' . $dirs[1] . ' ' . $home . '/current',
- 'rm -rf ' . $home . '/releases/' . $dirs[0],
+ 'ln -sfn '.$home.'/releases/'.$dirs[1].' '.$home.'/current',
+ 'rm -rf '.$home.'/releases/'.$dirs[0],
]);
- verbose("\t" . 'Hold my beer, We\'re rolling back');
+ verbose("\t".'Hold my beer, We\'re rolling back');
$connection->task('preformRollback');
unset($dirs[0]);
@@ -165,13 +165,13 @@ public static function doRollback(Connection $connection, $stage, $ldh, $dirs)
*/
public static function doPatch($stage, $branch)
{
- $home = config('laravel-deploy-helper.stages.' . $stage . '.remote.root');
+ $home = config('laravel-deploy-helper.stages.'.$stage.'.remote.root');
// setup ssh connection to remote
$connection = SSH::instance()->into($stage);
$connection->define('preformPatch', [
- Command::builder('cd', [$home . '/current']),
+ Command::builder('cd', [$home.'/current']),
Command::builder('ls', ['-haml']),
Command::builder('git', ['config', 'user.email', 'git+LDH@localhost.ext']),
@@ -179,12 +179,12 @@ public static function doPatch($stage, $branch)
Command::builder('git', ['fetch']),
Command::builder('git',
- ['format-patch', '-1', 'origin/' . $branch, 'FETCH_HEAD', '-o', $home . '/patches']),
- 'git apply --reject --whitespace=fix ' . $home . '/patches/*',
- Command::builder('rm', ['-rf', $home . '/patches']),
+ ['format-patch', '-1', 'origin/'.$branch, 'FETCH_HEAD', '-o', $home.'/patches']),
+ 'git apply --reject --whitespace=fix '.$home.'/patches/*',
+ Command::builder('rm', ['-rf', $home.'/patches']),
]);
- verbose("\t" . 'Hold on tight, trying to patch!');
+ verbose("\t".'Hold on tight, trying to patch!');
$connection->task('preformPatch');
}
}
diff --git a/src/Helpers/helpers.php b/src/Helpers/helpers.php
index 5c3c234..9797697 100644
--- a/src/Helpers/helpers.php
+++ b/src/Helpers/helpers.php
@@ -15,7 +15,7 @@ function verbose($message)
{
$console = new ConsoleOutput();
$console->getFormatter()->setStyle('info', new OutputFormatterStyle('blue', null));
- $console->writeln('' . $message . '');
+ $console->writeln(''.$message.'');
}
}
@@ -31,7 +31,7 @@ function error($message)
{
$console = new ConsoleOutput();
$console->getFormatter()->setStyle('error', new OutputFormatterStyle('white', 'red'));
- $console->writeln('' . $message . '');
+ $console->writeln(''.$message.'');
}
}