mirror of
https://github.com/hauke68/Magallanes.git
synced 2026-09-04 08:28:57 +02:00
PHPStorm refactoring.
This commit is contained in:
@@ -32,7 +32,7 @@ abstract class BaseStrategyTaskAbstract extends AbstractTask implements IsReleas
|
||||
|
||||
if ($overrideRelease == true) {
|
||||
$releaseToOverride = false;
|
||||
$resultFetch = $this->runCommandRemote('ls -ld '.$symlink.' | cut -d"/" -f2', $releaseToOverride);
|
||||
$resultFetch = $this->runCommandRemote('ls -ld ' . $symlink . ' | cut -d"/" -f2', $releaseToOverride);
|
||||
if ($resultFetch && is_numeric($releaseToOverride)) {
|
||||
$this->getConfig()->setReleaseId($releaseToOverride);
|
||||
}
|
||||
|
||||
@@ -21,10 +21,10 @@ use Mage\Task\SkipException;
|
||||
*/
|
||||
class DisabledTask extends AbstractTask implements IsReleaseAware
|
||||
{
|
||||
/**
|
||||
* (non-PHPdoc)
|
||||
* @see \Mage\Task\AbstractTask::getName()
|
||||
*/
|
||||
/**
|
||||
* (non-PHPdoc)
|
||||
* @see \Mage\Task\AbstractTask::getName()
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'Disabled Deployment [built-in]';
|
||||
|
||||
@@ -44,8 +44,8 @@ class GitRebaseTask extends BaseStrategyTaskAbstract implements IsReleaseAware
|
||||
$releasesDirectory = $this->getConfig()->release('directory', 'releases');
|
||||
|
||||
$deployToDirectory = rtrim($this->getConfig()->deployment('to'), '/')
|
||||
. '/' . $releasesDirectory
|
||||
. '/' . $this->getConfig()->getReleaseId();
|
||||
. '/' . $releasesDirectory
|
||||
. '/' . $this->getConfig()->getReleaseId();
|
||||
$this->runCommandRemote('mkdir -p ' . $releasesDirectory . '/' . $this->getConfig()->getReleaseId());
|
||||
}
|
||||
|
||||
@@ -78,11 +78,11 @@ class GitRebaseTask extends BaseStrategyTaskAbstract implements IsReleaseAware
|
||||
$result = $this->runCommandRemote($command) && $result;
|
||||
|
||||
// Stash if Working Copy is not clean
|
||||
if(!$status) {
|
||||
if (!$status) {
|
||||
$stashResult = '';
|
||||
$command = $this->getReleasesAwareCommand('git stash');
|
||||
$result = $this->runCommandRemote($command, $stashResult) && $result;
|
||||
if($stashResult != "No local changes to save") {
|
||||
if ($stashResult != "No local changes to save") {
|
||||
$stashed = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,10 +21,10 @@ use Mage\Task\Releases\IsReleaseAware;
|
||||
*/
|
||||
class RsyncTask extends BaseStrategyTaskAbstract implements IsReleaseAware
|
||||
{
|
||||
/**
|
||||
* (non-PHPdoc)
|
||||
* @see \Mage\Task\AbstractTask::getName()
|
||||
*/
|
||||
/**
|
||||
* (non-PHPdoc)
|
||||
* @see \Mage\Task\AbstractTask::getName()
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
if ($this->getConfig()->release('enabled', false) == true) {
|
||||
@@ -32,14 +32,14 @@ class RsyncTask extends BaseStrategyTaskAbstract implements IsReleaseAware
|
||||
return 'Deploy via Rsync (with Releases override) [built-in]';
|
||||
} else {
|
||||
$rsync_copy = $this->getConfig()->deployment("rsync");
|
||||
if ( $rsync_copy && is_array($rsync_copy) && $rsync_copy['copy'] ) {
|
||||
if ($rsync_copy && is_array($rsync_copy) && $rsync_copy['copy']) {
|
||||
return 'Deploy via Rsync (with Releases) [built-in, incremental]';
|
||||
} else {
|
||||
return 'Deploy via Rsync (with Releases) [built-in]';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return 'Deploy via Rsync [built-in]';
|
||||
return 'Deploy via Rsync [built-in]';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,8 +61,8 @@ class RsyncTask extends BaseStrategyTaskAbstract implements IsReleaseAware
|
||||
|
||||
$currentRelease = false;
|
||||
$deployToDirectory = rtrim($this->getConfig()->deployment('to'), '/')
|
||||
. '/' . $releasesDirectory
|
||||
. '/' . $this->getConfig()->getReleaseId();
|
||||
. '/' . $releasesDirectory
|
||||
. '/' . $this->getConfig()->getReleaseId();
|
||||
|
||||
Console::log('Deploy to ' . $deployToDirectory);
|
||||
$resultFetch = $this->runCommandRemote('ls -ld ' . $symlink . ' | cut -d"/" -f2', $currentRelease);
|
||||
@@ -72,10 +72,10 @@ class RsyncTask extends BaseStrategyTaskAbstract implements IsReleaseAware
|
||||
// rsync: { copy: yes }
|
||||
$rsync_copy = $this->getConfig()->deployment('rsync');
|
||||
// If copy_tool_rsync, use rsync rather than cp for finer control of what is copied
|
||||
if ( $rsync_copy && is_array($rsync_copy) && $rsync_copy['copy'] && isset($rsync_copy['copy_tool_rsync']) ) {
|
||||
if ($rsync_copy && is_array($rsync_copy) && $rsync_copy['copy'] && isset($rsync_copy['copy_tool_rsync'])) {
|
||||
$this->runCommandRemote("rsync -a {$this->excludes(array_merge($excludes, $rsync_copy['rsync_excludes']))} "
|
||||
. "$releasesDirectory/$currentRelease/ $releasesDirectory/{$this->getConfig()->getReleaseId()}");
|
||||
} elseif ( $rsync_copy && is_array($rsync_copy) && $rsync_copy['copy'] ) {
|
||||
. "$releasesDirectory/$currentRelease/ $releasesDirectory/{$this->getConfig()->getReleaseId()}");
|
||||
} elseif ($rsync_copy && is_array($rsync_copy) && $rsync_copy['copy']) {
|
||||
$this->runCommandRemote('cp -R ' . $releasesDirectory . '/' . $currentRelease . ' ' . $releasesDirectory . '/' . $this->getConfig()->getReleaseId());
|
||||
} else {
|
||||
$this->runCommandRemote('mkdir -p ' . $releasesDirectory . '/' . $this->getConfig()->getReleaseId());
|
||||
@@ -84,10 +84,10 @@ class RsyncTask extends BaseStrategyTaskAbstract implements IsReleaseAware
|
||||
}
|
||||
|
||||
$command = 'rsync -avz '
|
||||
. '--rsh="ssh ' . $this->getConfig()->getHostIdentityFileOption() . '-p' . $this->getConfig()->getHostPort() . '" '
|
||||
. $this->excludes($excludes) . ' '
|
||||
. $this->getConfig()->deployment('from') . ' '
|
||||
. $this->getConfig()->deployment('user') . '@' . $this->getConfig()->getHostName() . ':' . $deployToDirectory;
|
||||
. '--rsh="ssh ' . $this->getConfig()->getHostIdentityFileOption() . '-p' . $this->getConfig()->getHostPort() . '" '
|
||||
. $this->excludes($excludes) . ' '
|
||||
. $this->getConfig()->deployment('from') . ' '
|
||||
. $this->getConfig()->deployment('user') . '@' . $this->getConfig()->getHostName() . ':' . $deployToDirectory;
|
||||
|
||||
$result = $this->runCommandLocal($command);
|
||||
|
||||
|
||||
@@ -21,10 +21,10 @@ use Mage\Task\Releases\IsReleaseAware;
|
||||
*/
|
||||
class TarGzTask extends BaseStrategyTaskAbstract implements IsReleaseAware
|
||||
{
|
||||
/**
|
||||
* (non-PHPdoc)
|
||||
* @see \Mage\Task\AbstractTask::getName()
|
||||
*/
|
||||
/**
|
||||
* (non-PHPdoc)
|
||||
* @see \Mage\Task\AbstractTask::getName()
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
if ($this->getConfig()->release('enabled', false) == true) {
|
||||
@@ -34,7 +34,7 @@ class TarGzTask extends BaseStrategyTaskAbstract implements IsReleaseAware
|
||||
return 'Deploy via TarGz (with Releases) [built-in]';
|
||||
}
|
||||
} else {
|
||||
return 'Deploy via TarGz [built-in]';
|
||||
return 'Deploy via TarGz [built-in]';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,10 +53,10 @@ class TarGzTask extends BaseStrategyTaskAbstract implements IsReleaseAware
|
||||
if ($this->getConfig()->release('enabled', false) == true) {
|
||||
$releasesDirectory = $this->getConfig()->release('directory', 'releases');
|
||||
$deployToDirectory = rtrim($this->getConfig()->deployment('to'), '/')
|
||||
. '/' . $releasesDirectory
|
||||
. '/' . $this->getConfig()->getReleaseId();
|
||||
. '/' . $releasesDirectory
|
||||
. '/' . $this->getConfig()->getReleaseId();
|
||||
$output = null;
|
||||
$this->runCommandRemote('mkdir -p ' . $deployToDirectory, $output , false);
|
||||
$this->runCommandRemote('mkdir -p ' . $deployToDirectory, $output, false);
|
||||
}
|
||||
|
||||
// Create Tar Gz
|
||||
@@ -68,19 +68,19 @@ class TarGzTask extends BaseStrategyTaskAbstract implements IsReleaseAware
|
||||
}
|
||||
|
||||
$command = 'tar cfz ' . $localTarGz . '.tar.gz ' . $excludeCmd . ' -C ' . $this->getConfig()->deployment('from') . ' .';
|
||||
$result = $this->runCommandLocal($command);
|
||||
$result = $this->runCommandLocal($command);
|
||||
|
||||
// Copy Tar Gz to Remote Host
|
||||
$command = 'scp ' . $this->getConfig()->getHostIdentityFileOption() . '-P ' . $this->getConfig()->getHostPort() . ' ' . $localTarGz . '.tar.gz '
|
||||
. $this->getConfig()->deployment('user') . '@' . $this->getConfig()->getHostName() . ':' . $deployToDirectory;
|
||||
$result = $this->runCommandLocal($command) && $result;
|
||||
// Copy Tar Gz to Remote Host
|
||||
$command = 'scp ' . $this->getConfig()->getHostIdentityFileOption() . '-P ' . $this->getConfig()->getHostPort() . ' ' . $localTarGz . '.tar.gz '
|
||||
. $this->getConfig()->deployment('user') . '@' . $this->getConfig()->getHostName() . ':' . $deployToDirectory;
|
||||
$result = $this->runCommandLocal($command) && $result;
|
||||
|
||||
// Extract Tar Gz
|
||||
$command = $this->getReleasesAwareCommand('tar xfz ' . $remoteTarGz . '.tar.gz');
|
||||
$command = $this->getReleasesAwareCommand('tar xfz ' . $remoteTarGz . '.tar.gz');
|
||||
$result = $this->runCommandRemote($command) && $result;
|
||||
|
||||
// Delete Tar Gz from Remote Host
|
||||
$command = $this->getReleasesAwareCommand('rm ' . $remoteTarGz . '.tar.gz');
|
||||
$command = $this->getReleasesAwareCommand('rm ' . $remoteTarGz . '.tar.gz');
|
||||
$result = $this->runCommandRemote($command) && $result;
|
||||
|
||||
// Delete Tar Gz from Local
|
||||
|
||||
Reference in New Issue
Block a user