2011-11-23 04:17:06 +01:00
|
|
|
<?php
|
|
|
|
abstract class Mage_Task_TaskAbstract
|
|
|
|
{
|
2011-11-23 12:38:52 +01:00
|
|
|
protected $_config = null;
|
|
|
|
|
2011-11-23 04:17:06 +01:00
|
|
|
public abstract function getName();
|
|
|
|
|
2011-11-23 12:38:52 +01:00
|
|
|
public abstract function run();
|
|
|
|
|
|
|
|
public final function __construct($config)
|
|
|
|
{
|
|
|
|
$this->_config = $config;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function init()
|
|
|
|
{
|
|
|
|
}
|
2011-11-23 04:17:06 +01:00
|
|
|
|
2011-11-23 12:38:52 +01:00
|
|
|
protected final function _runLocalCommand($command)
|
2011-11-23 04:17:06 +01:00
|
|
|
{
|
|
|
|
return Mage_Console::executeCommand($command);
|
|
|
|
}
|
|
|
|
|
2011-11-23 12:38:52 +01:00
|
|
|
protected final function _runRemoteCommand($command)
|
2011-11-23 04:17:06 +01:00
|
|
|
{
|
2011-11-23 12:38:52 +01:00
|
|
|
$localCommand = 'ssh '
|
|
|
|
. $this->_config['deploy']['user'] . '@' . $this->_config['deploy']['host'] . ' '
|
|
|
|
. '"cd ' . $this->_config['deploy']['deploy-to'] . ' && '
|
|
|
|
. $command . '"';
|
|
|
|
|
|
|
|
return $this->_runLocalCommand($localCommand);
|
2011-11-23 04:17:06 +01:00
|
|
|
}
|
|
|
|
}
|