From 6f6cf2436ad3454725e5bc6e8684aeb40cadc19f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Monta=C3=B1ez?= Date: Thu, 7 Nov 2013 23:32:16 -0200 Subject: [PATCH] Allows to guess where a command should be executed (remote or local) based on the stage of the task. --- Mage/Task/AbstractTask.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Mage/Task/AbstractTask.php b/Mage/Task/AbstractTask.php index 0188e6f..53c26b9 100644 --- a/Mage/Task/AbstractTask.php +++ b/Mage/Task/AbstractTask.php @@ -131,7 +131,7 @@ abstract class AbstractTask } /** - * Runs a Shell Command Locally + * Runs a Shell Command Localy * @param string $command * @param string $output * @return boolean @@ -172,4 +172,20 @@ abstract class AbstractTask return $this->runCommandLocal($localCommand, $output); } + + /** + * Runs a Shell Command Localy or in the Remote Host based on the Task Stage. + * If the stage is "deploy" then it will be executed in the remote host. + * @param string $command + * @param string $output + * @return boolean + */ + protected final function runCommand($command, &$output = null) + { + if ($this->getStage() == 'deploy') { + return $this->runCommandRemote($command, $output); + } else { + return $this->runCommandLocal($command, $output); + } + } } \ No newline at end of file