mirror of https://github.com/hauke68/Magallanes
Andrés Montañez
7 years ago
20 changed files with 89 additions and 147 deletions
@ -1,37 +1,9 @@ |
|||||||
CHANGELOG for 3.X |
CHANGELOG for 4.X |
||||||
================= |
================= |
||||||
|
|
||||||
* 3.4.0 (2018-03-29) |
* 4.0.0 (2018-04-02) |
||||||
* [Issue#380] Throw exception if log_dir is defined but directory doesn't exists |
* v4 series release |
||||||
* [BUGFIX] [Issue#405] Malformed ssh command when defining host:port notation |
* Refactored for Symfony 4 and PHP 7.1 |
||||||
* [Issue#415] Remove timeout on Deploy with Tar or Rsync tasks |
* Symfony Pool Clear task added |
||||||
|
* Symfony Pool Prune task added |
||||||
|
* Symfony Assetic task removed |
||||||
* 3.3.0 (2017-07-22) |
|
||||||
* [PR#386] Allow to define timeout (default 120s) for symfony/assetic-dump task. |
|
||||||
* [PR#392] Allow to define Host Port in Host configuration. |
|
||||||
* Allow to specify the binary path of tar on for create and extract |
|
||||||
|
|
||||||
* 3.2.0 (2017-04-14) |
|
||||||
* Allow to pre-register Custom Tasks |
|
||||||
* [PR#365] New option "from" to define deployment start point |
|
||||||
* Allow to define excludes in the global scope. |
|
||||||
* Improve code quality, remove duplications on Symfony Tasks. |
|
||||||
* Improve code quality, remove duplications on Composer Tasks. |
|
||||||
* [PR#364] Allow to define custom timeout to Composer:Install |
|
||||||
|
|
||||||
* 3.1.0 (2017-02-25) |
|
||||||
* Add new Exec task to execute arbitrary shell commands |
|
||||||
* Add new Composer task, to update phar (composer/self-update) |
|
||||||
* [#344] Allow to flag Filesystem tasks |
|
||||||
* [PR#346] Add new File System task, to change file's modes (fs/chmod) |
|
||||||
* [BUGFIX] [PR#342] Ignore empty exclude lines |
|
||||||
* [PR#330] Allow Composer task options to be overwritten at environment level |
|
||||||
* [PR#330] Add new method Runtime::getMergedOption to merge ConfigOption and EnvOption |
|
||||||
* [Documentation] [PR#333] Improve example config file |
|
||||||
|
|
||||||
* 3.0.1 (2017-01-10) |
|
||||||
* [BUGFIX] [#350] [#353] Fix escape issue when commands are sent through SSH |
|
||||||
|
|
||||||
* 3.0.0 (2017-01-31) |
|
||||||
* v3 series release |
|
||||||
|
@ -0,0 +1,42 @@ |
|||||||
|
<?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\Symfony; |
||||||
|
|
||||||
|
use Symfony\Component\Process\Process; |
||||||
|
|
||||||
|
/** |
||||||
|
* Symfony Task - Cache Pool Prune |
||||||
|
* |
||||||
|
* @author Andrés Montañez <andresmontanez@gmail.com> |
||||||
|
*/ |
||||||
|
class CachePoolPruneTask extends AbstractSymfonyTask |
||||||
|
{ |
||||||
|
public function getName() |
||||||
|
{ |
||||||
|
return 'symfony/cache-pool-prune'; |
||||||
|
} |
||||||
|
|
||||||
|
public function getDescription() |
||||||
|
{ |
||||||
|
return '[Symfony] Cache Pool Prune'; |
||||||
|
} |
||||||
|
|
||||||
|
public function execute() |
||||||
|
{ |
||||||
|
$options = $this->getOptions(); |
||||||
|
$command = $options['console'] . ' cache:pool:prune --env=' . $options['env'] . ' ' . $options['flags']; |
||||||
|
|
||||||
|
/** @var Process $process */ |
||||||
|
$process = $this->runtime->runCommand(trim($command)); |
||||||
|
|
||||||
|
return $process->isSuccessful(); |
||||||
|
} |
||||||
|
} |
@ -1,71 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
namespace Mage\tests\Task\BuiltIn\Symfony; |
|
||||||
|
|
||||||
|
|
||||||
use Mage\Task\BuiltIn\Symfony\AsseticDumpTask; |
|
||||||
use Mage\Tests\Runtime\RuntimeMockup; |
|
||||||
use PHPUnit\Framework\TestCase; |
|
||||||
|
|
||||||
class AsseticDumpTaskTest extends TestCase |
|
||||||
{ |
|
||||||
/** |
|
||||||
* @var RuntimeMockup |
|
||||||
*/ |
|
||||||
private $runtime; |
|
||||||
|
|
||||||
public function setUp() |
|
||||||
{ |
|
||||||
$this->runtime = new RuntimeMockup(); |
|
||||||
$this->runtime->setConfiguration(['environments' => ['test' => []]]); |
|
||||||
$this->runtime->setEnvironment('test'); |
|
||||||
} |
|
||||||
|
|
||||||
public function testAsseticDumpTask() |
|
||||||
{ |
|
||||||
$task = new AsseticDumpTask(); |
|
||||||
$task->setOptions(['env' => 'test']); |
|
||||||
$task->setRuntime($this->runtime); |
|
||||||
$this->assertEquals('[Symfony] Assetic Dump', $task->getDescription()); |
|
||||||
$task->execute(); |
|
||||||
|
|
||||||
$testCase = [ |
|
||||||
'bin/console assetic:dump --env=test' => 120, |
|
||||||
]; |
|
||||||
|
|
||||||
$this->assertRanCommands($testCase); |
|
||||||
} |
|
||||||
|
|
||||||
public function testAsseticDumpTaskWithTimeoutOption() |
|
||||||
{ |
|
||||||
$task = new AsseticDumpTask(); |
|
||||||
$task->setOptions(['env' => 'test', 'timeout' => 300]); |
|
||||||
$task->setRuntime($this->runtime); |
|
||||||
$task->execute(); |
|
||||||
|
|
||||||
|
|
||||||
$testCase = [ |
|
||||||
'bin/console assetic:dump --env=test' => 300, |
|
||||||
]; |
|
||||||
|
|
||||||
$this->assertRanCommands($testCase); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @param $testCase |
|
||||||
*/ |
|
||||||
private function assertRanCommands($testCase) |
|
||||||
{ |
|
||||||
$ranCommands = $this->runtime->getRanCommands(); |
|
||||||
|
|
||||||
// Check total of Executed Commands |
|
||||||
$this->assertEquals(count($testCase), count($ranCommands)); |
|
||||||
|
|
||||||
// Check Generated Commands |
|
||||||
$index = 0; |
|
||||||
foreach ($testCase as $command => $timeout) { |
|
||||||
$this->assertEquals($command, $ranCommands[$index++]); |
|
||||||
$this->assertEquals($timeout, $this->runtime->getRanCommandTimeoutFor($command)); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
Loading…
Reference in new issue