mirror of
https://github.com/hauke68/Magallanes.git
synced 2026-09-08 14:28:57 +02:00
PHPStorm refactoring.
This commit is contained in:
@@ -21,16 +21,16 @@ use Mage\Task\ErrorWithMessageException;
|
||||
*/
|
||||
class ChangeBranchTask extends AbstractTask
|
||||
{
|
||||
/**
|
||||
* Branch the executiong began with
|
||||
* @var string
|
||||
*/
|
||||
protected static $startingBranch = 'master';
|
||||
/**
|
||||
* Branch the executiong began with
|
||||
* @var string
|
||||
*/
|
||||
protected static $startingBranch = 'master';
|
||||
|
||||
/**
|
||||
* Name of the Task
|
||||
* @var string
|
||||
*/
|
||||
/**
|
||||
* Name of the Task
|
||||
* @var string
|
||||
*/
|
||||
private $name = 'SCM Changing branch [built-in]';
|
||||
|
||||
/**
|
||||
@@ -48,7 +48,7 @@ class ChangeBranchTask extends AbstractTask
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
$scmType = $this->getConfig()->general('scm');
|
||||
$scmType = $this->getConfig()->general('scm');
|
||||
|
||||
switch ($scmType) {
|
||||
case 'git':
|
||||
@@ -65,35 +65,35 @@ class ChangeBranchTask extends AbstractTask
|
||||
{
|
||||
switch ($this->getConfig()->general('scm')) {
|
||||
case 'git':
|
||||
if ($this->getParameter('_changeBranchRevert', false)) {
|
||||
$command = 'git checkout ' . self::$startingBranch;
|
||||
$result = $this->runCommandLocal($command);
|
||||
if ($this->getParameter('_changeBranchRevert', false)) {
|
||||
$command = 'git checkout ' . self::$startingBranch;
|
||||
$result = $this->runCommandLocal($command);
|
||||
|
||||
} else {
|
||||
$command = 'git branch | grep \'*\' | cut -d\' \' -f 2';
|
||||
$currentBranch = 'master';
|
||||
$result = $this->runCommandLocal($command, $currentBranch);
|
||||
} else {
|
||||
$command = 'git branch | grep \'*\' | cut -d\' \' -f 2';
|
||||
$currentBranch = 'master';
|
||||
$result = $this->runCommandLocal($command, $currentBranch);
|
||||
|
||||
$scmData = $this->getConfig()->deployment('scm', false);
|
||||
$scmData = $this->getConfig()->deployment('scm', false);
|
||||
|
||||
if ($result && is_array($scmData) && isset($scmData['branch']) && $scmData['branch'] != $currentBranch) {
|
||||
$command = 'git branch | grep \'' . $scmData['branch'] . '\' | tr -s \' \' | sed \'s/^[ ]//g\'';
|
||||
$isBranchTracked = '';
|
||||
$result = $this->runCommandLocal($command, $isBranchTracked);
|
||||
if ($result && is_array($scmData) && isset($scmData['branch']) && $scmData['branch'] != $currentBranch) {
|
||||
$command = 'git branch | grep \'' . $scmData['branch'] . '\' | tr -s \' \' | sed \'s/^[ ]//g\'';
|
||||
$isBranchTracked = '';
|
||||
$result = $this->runCommandLocal($command, $isBranchTracked);
|
||||
|
||||
if ($isBranchTracked == '') {
|
||||
throw new ErrorWithMessageException('The branch <purple>' . $scmData['branch'] . '</purple> must be tracked.');
|
||||
}
|
||||
if ($isBranchTracked == '') {
|
||||
throw new ErrorWithMessageException('The branch <purple>' . $scmData['branch'] . '</purple> must be tracked.');
|
||||
}
|
||||
|
||||
$branch = $this->getParameter('branch', $scmData['branch']);
|
||||
$command = 'git checkout ' . $branch;
|
||||
$result = $this->runCommandLocal($command) && $result;
|
||||
$branch = $this->getParameter('branch', $scmData['branch']);
|
||||
$command = 'git checkout ' . $branch;
|
||||
$result = $this->runCommandLocal($command) && $result;
|
||||
|
||||
self::$startingBranch = $currentBranch;
|
||||
} else {
|
||||
throw new SkipException;
|
||||
}
|
||||
}
|
||||
self::$startingBranch = $currentBranch;
|
||||
} else {
|
||||
throw new SkipException;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -20,10 +20,10 @@ use Mage\Task\SkipException;
|
||||
*/
|
||||
class CloneTask extends AbstractTask
|
||||
{
|
||||
/**
|
||||
* Name of the Task
|
||||
* @var string
|
||||
*/
|
||||
/**
|
||||
* Name of the Task
|
||||
* @var string
|
||||
*/
|
||||
private $name = 'SCM Clone [built-in]';
|
||||
|
||||
/**
|
||||
@@ -66,12 +66,12 @@ class CloneTask extends AbstractTask
|
||||
case 'git':
|
||||
// Clone Repo
|
||||
$command = 'cd ' . $this->source['temporal'] . ' ; '
|
||||
. 'git clone ' . $this->source['repository'] . ' . ';
|
||||
. 'git clone ' . $this->source['repository'] . ' . ';
|
||||
$result = $this->runCommandLocal($command);
|
||||
|
||||
// Checkout Branch
|
||||
$command = 'cd ' . $this->source['temporal'] . ' ; '
|
||||
. 'git checkout ' . $this->source['from'];
|
||||
. 'git checkout ' . $this->source['from'];
|
||||
$result = $result && $this->runCommandLocal($command);
|
||||
|
||||
$this->getConfig()->setFrom($this->source['temporal']);
|
||||
|
||||
@@ -19,10 +19,10 @@ use Mage\Task\AbstractTask;
|
||||
*/
|
||||
class RemoveCloneTask extends AbstractTask
|
||||
{
|
||||
/**
|
||||
* Name of the Task
|
||||
* @var string
|
||||
*/
|
||||
/**
|
||||
* Name of the Task
|
||||
* @var string
|
||||
*/
|
||||
private $name = 'SCM Remove Clone [built-in]';
|
||||
|
||||
/**
|
||||
@@ -49,8 +49,8 @@ class RemoveCloneTask extends AbstractTask
|
||||
$this->source = $this->getConfig()->deployment('source');
|
||||
switch ($this->source['type']) {
|
||||
case 'git':
|
||||
$this->name = 'SCM Remove Clone (GIT) [built-in]';
|
||||
break;
|
||||
$this->name = 'SCM Remove Clone (GIT) [built-in]';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,10 +20,10 @@ use Mage\Task\SkipException;
|
||||
*/
|
||||
class UpdateTask extends AbstractTask
|
||||
{
|
||||
/**
|
||||
* Name of the Task
|
||||
* @var string
|
||||
*/
|
||||
/**
|
||||
* Name of the Task
|
||||
* @var string
|
||||
*/
|
||||
private $name = 'SCM Update [built-in]';
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user