mirror of https://github.com/hauke68/Magallanes
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.4 KiB
49 lines
1.4 KiB
<?php |
|
abstract class Mage_Task_TaskAbstract |
|
{ |
|
protected $_config = null; |
|
protected $_inRollback = false; |
|
|
|
public abstract function getName(); |
|
|
|
public abstract function run(); |
|
|
|
public final function __construct(Mage_Config $config, $inRollback = false) |
|
{ |
|
$this->_config = $config; |
|
$this->_inRollback = $inRollback; |
|
} |
|
|
|
public function inRollback() |
|
{ |
|
return $this->_inRollback; |
|
} |
|
|
|
public function init() |
|
{ |
|
} |
|
|
|
protected final function _runLocalCommand($command, &$output = null) |
|
{ |
|
return Mage_Console::executeCommand($command, $output); |
|
} |
|
|
|
protected final function _runRemoteCommand($command, &$output = null) |
|
{ |
|
if ($this->_config->release('enabled', false) == true) { |
|
$releasesDirectory = '/' |
|
. $this->_config->release('directory', 'releases') |
|
. '/' |
|
. $this->_config->getReleaseId(); |
|
} else { |
|
$releasesDirectory = ''; |
|
} |
|
|
|
$localCommand = 'ssh ' |
|
. $this->_config->deployment('user') . '@' . $this->_config->getHost() . ' ' |
|
. '"cd ' . rtrim($this->_config->deployment('to'), '/') . $releasesDirectory . ' && ' |
|
. $command . '"'; |
|
|
|
return $this->_runLocalCommand($localCommand, $output); |
|
} |
|
} |