This commit is contained in:
Андрей Колченко
2014-12-08 12:56:29 +03:00
17 changed files with 1013 additions and 33 deletions
@@ -0,0 +1,61 @@
<?php
/*
* This file is part of the Magallanes package.
*
* (c) Andrés Montañez <andres@andresmontanez.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Mage\Task\BuiltIn\General;
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
* - find var/logs -maxdepth 1 -type f -name '*.log' -exec chown apache:apache {} \;
* - symfony2/cache-clear
*
* @author Samuel Chiriluta <samuel4x4@gmail.com>
*/
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;
}
}
+7 -1
View File
@@ -55,12 +55,18 @@ class RollbackTask extends AbstractTask implements IsReleaseAware
$result = $this->runCommandRemote('ls -1 ' . $releasesDirectory, $output);
$releases = ($output == '') ? array() : explode(PHP_EOL, $output);
$inDeploy = $this->getParameter('inDeploy',false);
if (count($releases) == 0) {
Console::output('Release are not available for <bold>' . $this->getConfig()->getHost() . '</bold> ... <red>FAIL</red>');
} else {
rsort($releases);
$deleteCurrent = $this->getConfig()->getParameter('deleteCurrent', false);
$deleteCurrent = $this->getConfig()->getParameter('deleteCurrent',
$this->getConfig()->deployment('delete-on-rollback',
$this->getConfig()->general('delete-on-rollback',false)
)
);
$releaseIsAvailable = false;
if ($this->getReleaseId() == '') {
+3 -4
View File
@@ -65,13 +65,13 @@ class ForceUpdateTask extends AbstractTask
$remote = $this->getParameter('remote', 'origin');
$command = 'git fetch ' . $remote . ' ' . $branch;
$result = $this->runCommandRemote($command);
$result = $this->runCommand($command);
$command = 'git reset --hard ' . $remote . '/' . $branch;
$result = $result && $this->runCommandRemote($command);
$result = $result && $this->runCommand($command);
$command = 'git pull ' . $remote . ' ' . $branch;
$result = $result && $this->runCommandRemote($command);
$result = $result && $this->runCommand($command);
break;
default:
@@ -79,7 +79,6 @@ class ForceUpdateTask extends AbstractTask
break;
}
$result = $this->runCommandLocal($command);
$this->getConfig()->reload();
return $result;
@@ -14,8 +14,13 @@ use Mage\Task\BuiltIn\Symfony2\SymfonyAbstractTask;
/**
* Task for Clearing the Cache
*
* Example of usage:
* symfony2/cache-clear: { env: dev }
* symfony2/cache-clear: { env: dev, optional: --no-warmup }
*
* @author Andrés Montañez <andres@andresmontanez.com>
* @author Samuel Chiriluta <samuel4x4@gmail.com>
*/
class CacheClearTask extends SymfonyAbstractTask
{
@@ -36,8 +41,10 @@ class CacheClearTask extends SymfonyAbstractTask
{
// Options
$env = $this->getParameter('env', 'dev');
$optional = $this->getParameter('optional', '');
$command = $this->getAppPath() . ' cache:clear --env=' . $env . ' ' . $optional;
$command = $this->getAppPath() . ' cache:clear --env=' . $env;
$result = $this->runCommand($command);
return $result;
@@ -15,7 +15,7 @@ use Mage\Task\BuiltIn\Symfony2\SymfonyAbstractTask;
/**
* Task for Doctrine migrations
*/
class DoctrineMigrate extends SymfonyAbstractTask
class DoctrineMigrateTask extends SymfonyAbstractTask
{
/**
* (non-PHPdoc)
@@ -34,7 +34,9 @@ class DoctrineMigrate extends SymfonyAbstractTask
public function run()
{
$env = $this->getParameter('env', 'dev');
$command = $this->getAppPath() . ' doctrine:migrations:migrate -n --env=' . $env;
return $this->runCommand($command);
}
}