From 41c3e00f67f4bc3dbc9b8b0b2bb5fa149c544c26 Mon Sep 17 00:00:00 2001 From: samuel4x4 Date: Sun, 23 Nov 2014 23:34:58 +0200 Subject: [PATCH] Task for running multiple manually commands The purpose of this task is to provide a way to run multiple custom commands for your specific project, before Magallanes will have build-in tasks for your needs. Also maybe you'll just not consider you should create custom tasks for all commands you need (e.g. specific user rights for specific files and directories). --- Mage/Task/BuiltIn/General/ManuallyTask.php | 60 ++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 Mage/Task/BuiltIn/General/ManuallyTask.php diff --git a/Mage/Task/BuiltIn/General/ManuallyTask.php b/Mage/Task/BuiltIn/General/ManuallyTask.php new file mode 100644 index 0000000..71a681d --- /dev/null +++ b/Mage/Task/BuiltIn/General/ManuallyTask.php @@ -0,0 +1,60 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Mage\Task\BuiltIn\Scm; + +use Mage\Task\AbstractTask; + +/** + * Task for running multiple custom commands setting them manually + * + * Example of usage: + * + * tasks: + * on-deploy: + * - scm/force-update + * - general/manually: + * - find . -type d -exec chmod 755 {} \; + * - find . -type f -exec chmod 644 {} \; + * - chmod +x bin/console + * - symfony2/cache-clear + * + * @author Samuel Chiriluta + */ +class ManuallyTask extends AbstractTask { + + /** + * (non-PHPdoc) + * @see \Mage\Task\AbstractTask::getName() + */ + public function getName() + { + return 'Manually multiple custom tasks'; + } + + /** + * @see \Mage\Task\AbstractTask::run() + */ + public function run() + { + $result = true; + + $commands = $this->getParameters(); + + foreach ($commands as $command) + { + $result = $result && $this->runCommand($command); + } + + return $result; + } + +}