mirror of
https://github.com/hauke68/Magallanes.git
synced 2025-09-18 06:30:17 +02:00
Merge pull request #158 from samuel4x4/develop
Bug fix for scm/force-update, add general/manually task, bug fix for symfony2/doctrine-migrate, improve symfony2/cache-clear
This commit is contained in:
commit
ba9b322dab
61
Mage/Task/BuiltIn/General/ManuallyTask.php
Normal file
61
Mage/Task/BuiltIn/General/ManuallyTask.php
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -65,13 +65,13 @@ class ForceUpdateTask extends AbstractTask
|
|||||||
$remote = $this->getParameter('remote', 'origin');
|
$remote = $this->getParameter('remote', 'origin');
|
||||||
|
|
||||||
$command = 'git fetch ' . $remote . ' ' . $branch;
|
$command = 'git fetch ' . $remote . ' ' . $branch;
|
||||||
$result = $this->runCommandRemote($command);
|
$result = $this->runCommand($command);
|
||||||
|
|
||||||
$command = 'git reset --hard ' . $remote . '/' . $branch;
|
$command = 'git reset --hard ' . $remote . '/' . $branch;
|
||||||
$result = $result && $this->runCommandRemote($command);
|
$result = $result && $this->runCommand($command);
|
||||||
|
|
||||||
$command = 'git pull ' . $remote . ' ' . $branch;
|
$command = 'git pull ' . $remote . ' ' . $branch;
|
||||||
$result = $result && $this->runCommandRemote($command);
|
$result = $result && $this->runCommand($command);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -79,7 +79,6 @@ class ForceUpdateTask extends AbstractTask
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->runCommandLocal($command);
|
|
||||||
$this->getConfig()->reload();
|
$this->getConfig()->reload();
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -15,7 +15,12 @@ use Mage\Task\BuiltIn\Symfony2\SymfonyAbstractTask;
|
|||||||
/**
|
/**
|
||||||
* Task for Clearing the Cache
|
* 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 Andrés Montañez <andres@andresmontanez.com>
|
||||||
|
* @author Samuel Chiriluta <samuel4x4@gmail.com>
|
||||||
*/
|
*/
|
||||||
class CacheClearTask extends SymfonyAbstractTask
|
class CacheClearTask extends SymfonyAbstractTask
|
||||||
{
|
{
|
||||||
@ -36,8 +41,10 @@ class CacheClearTask extends SymfonyAbstractTask
|
|||||||
{
|
{
|
||||||
// Options
|
// Options
|
||||||
$env = $this->getParameter('env', 'dev');
|
$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);
|
$result = $this->runCommand($command);
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -15,7 +15,7 @@ use Mage\Task\BuiltIn\Symfony2\SymfonyAbstractTask;
|
|||||||
/**
|
/**
|
||||||
* Task for Doctrine migrations
|
* Task for Doctrine migrations
|
||||||
*/
|
*/
|
||||||
class DoctrineMigrate extends SymfonyAbstractTask
|
class DoctrineMigrateTask extends SymfonyAbstractTask
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* (non-PHPdoc)
|
* (non-PHPdoc)
|
||||||
@ -34,7 +34,9 @@ class DoctrineMigrate extends SymfonyAbstractTask
|
|||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
$env = $this->getParameter('env', 'dev');
|
$env = $this->getParameter('env', 'dev');
|
||||||
|
|
||||||
$command = $this->getAppPath() . ' doctrine:migrations:migrate -n --env=' . $env;
|
$command = $this->getAppPath() . ' doctrine:migrations:migrate -n --env=' . $env;
|
||||||
|
|
||||||
return $this->runCommand($command);
|
return $this->runCommand($command);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user