[Nostromo] Refactor some tasks, add new tests

This commit is contained in:
Andrés Montañez 2017-01-05 20:38:42 -03:00
parent 781b5e7620
commit 68e65827fa
22 changed files with 291 additions and 62 deletions

68
CONTRIBUTING.md Normal file
View file

@ -0,0 +1,68 @@
Contributor Guidelines for Magallanes
=====================================
Welcome to Magallanes! We are much appreciated you've decided to contribute to this project!
Please read the following guidelines to make your and our work easier and cleaner.
**TL;DR**
1. Write clean code with no mess left
2. Contribute the docs when adding configurable new feature
3. Create your pull request from `nostromo` branch
4. Ensure your code is fully covered by tests
----------
# Reporting Issues
If you have a problem or you've noticed a bug, please feel free to open a new issue. However follow the rules below:
* First, make sure that similar/the same issue doesn't already exists
* If you've already found the solution of the problem you are about to report, please feel free to open a new Pull Request. Then follow the rules below in **Developing Magallanes** section.
* If you are able to, include some test cases or steps to reproduce the bug for us to examine the problem and find a solution.
## Opening Pull Requests
Pull Request is a very powerful tool, so let's be measured in its usage. Always commit code which has at least 95% of coverage, and if it's a new feature always provide concrete tests.
In order to have the PRs prioritized name them with the following tags.
```
[#66] Add new CONTRIBUTING document
[FIX] Set correct permissions on deploy stage
[FEATURE] Create new PermissionsTask
[HOTFIX] Exception not caught on deployment
```
All Pull Requests must be done to the `nostromo` branch, only exception are Hotfixes.
Remember of square brackets when adding issue number. If you'd forget adding them, your whole message will be a comment!
# Developing Magallanes
## Branches
The flow is pretty simple.
In most common cases we work on the `nostromo` branch. It's the branch with the main development for the current major version. All Pull Requests must merge with that branch. The `master` branch is used to move the validated code and generate the releases in an orderly fashion, also we could use it for hotfixes.
If you want to use developing branch in your code, simple pass `dev-nostromo` to dependency version in your `composer.json` file:
```json
{
"require": {
"andres-montanez/magallanes": "dev-nostromo"
}
}
```
## Organization and code quality
We use [PSR2](http://www.php-fig.org/psr/psr-2/) as PHP coding standard.
### Tools you can use to ensure your code quality
1. **PHP-CodeSniffer**
2. **PHP Mess Detector**
3. PHP Copy/Paste Detector
4. PHP Dead Code Detector
5. [PHP Coding Standards Fixer](http://cs.sensiolabs.org)
## Testing and quality
We use PHPUnit to test our code. Most of the project is covered with tests, so if you want your code to be merged push it with proper testing and coverage (at least 95%). To execute the tests with code coverage report:
```
vendor/bin/phpunit --coverage-text
```
Tests structure follow almost the same structure as production code with `Test` suffix in class and file name. Follow the tests already made as guidelines.
# Last Words
Thank you for using Magallanes, and special thanks for making it better. When adding features always have in mind the main goal *Deploy code from A to B, and run some tasks*, and think if the feature is aiming at that.

View file

@ -18,25 +18,25 @@ use Mage\Task\AbstractTask;
*
* @author Andrés Montañez <andresmontanez@gmail.com>
*/
class GenerateAutoloadTask extends AbstractTask
class DumpAutoloadTask extends AbstractTask
{
public function getName()
{
return 'composer/generate-autoload';
return 'composer/dump-autoload';
}
public function getDescription()
{
return '[Composer] Generate Autoload';
return '[Composer] Dump Autoload';
}
public function execute()
{
$options = $this->getOptions();
$command = $options['path'] . ' dumpautoload ' . $options['flags'];
$command = sprintf('%s dump-autoload %s', $options['path'], $options['flags']);
/** @var Process $process */
$process = $this->runtime->runCommand($command);
$process = $this->runtime->runCommand(trim($command));
return $process->isSuccessful();
}

View file

@ -33,10 +33,10 @@ class InstallTask extends AbstractTask
public function execute()
{
$options = $this->getOptions();
$command = trim($options['path'] . ' install ' . $options['flags']);
$command = sprintf('%s install %s', $options['path'], $options['flags']);
/** @var Process $process */
$process = $this->runtime->runCommand($command);
$process = $this->runtime->runCommand(trim($command));
return $process->isSuccessful();
}
@ -45,7 +45,7 @@ class InstallTask extends AbstractTask
{
$userOptions = $this->runtime->getConfigOptions('composer', []);
$options = array_merge(
['path' => 'composer', 'flags' => ''],
['path' => 'composer', 'flags' => '--optimize-autoloader'],
(is_array($userOptions) ? $userOptions : []),
$this->options
);

View file

@ -33,20 +33,22 @@ class AsseticDumpTask extends AbstractTask
public function execute()
{
$options = $this->getOptions();
$command = $options['console'] . ' assetic:dump --env=' . $options['env'] . ' ' . $options['flags'];
$command = sprintf('%s assetic:dump --env=%s %s', $options['console'], $options['env'], $options['flags']);
/** @var Process $process */
$process = $this->runtime->runCommand($command);
$process = $this->runtime->runCommand(trim($command));
return $process->isSuccessful();
}
protected function getOptions()
{
$userOptions = $this->runtime->getConfigOptions('symfony', []);
$userGlobalOptions = $this->runtime->getConfigOptions('symfony', []);
$userEnvironmentOptions = $this->runtime->getEnvironmentConfig('symfony', []);
$options = array_merge(
['console' => 'bin/console', 'env' => 'dev', 'flags' => ''],
(is_array($userOptions) ? $userOptions : []),
(is_array($userGlobalOptions) ? $userGlobalOptions : []),
(is_array($userEnvironmentOptions) ? $userEnvironmentOptions : []),
$this->options
);

View file

@ -33,20 +33,22 @@ class AssetsInstallTask extends AbstractTask
public function execute()
{
$options = $this->getOptions();
$command = $options['console'] . ' assets:install --env=' . $options['env'] . ' ' . $options['flags'] . ' ' . $options['target'];
$command = sprintf('%s assets:install %s --env=%s %s', $options['console'], $options['target'], $options['env'], $options['flags']);
/** @var Process $process */
$process = $this->runtime->runCommand($command);
$process = $this->runtime->runCommand(trim($command));
return $process->isSuccessful();
}
protected function getOptions()
{
$userOptions = $this->runtime->getConfigOptions('symfony', []);
$userGlobalOptions = $this->runtime->getConfigOptions('symfony', []);
$userEnvironmentOptions = $this->runtime->getEnvironmentConfig('symfony', []);
$options = array_merge(
['console' => 'bin/console', 'env' => 'dev', 'target' => 'web', 'flags' => '--symlink --relative'],
(is_array($userOptions) ? $userOptions : []),
(is_array($userGlobalOptions) ? $userGlobalOptions : []),
(is_array($userEnvironmentOptions) ? $userEnvironmentOptions : []),
$this->options
);

View file

@ -36,17 +36,19 @@ class CacheClearTask extends AbstractTask
$command = $options['console'] . ' cache:clear --env=' . $options['env'] . ' ' . $options['flags'];
/** @var Process $process */
$process = $this->runtime->runCommand($command);
$process = $this->runtime->runCommand(trim($command));
return $process->isSuccessful();
}
protected function getOptions()
{
$userOptions = $this->runtime->getConfigOptions('symfony', []);
$userGlobalOptions = $this->runtime->getConfigOptions('symfony', []);
$userEnvironmentOptions = $this->runtime->getEnvironmentConfig('symfony', []);
$options = array_merge(
['console' => 'bin/console', 'env' => 'dev', 'flags' => ''],
(is_array($userOptions) ? $userOptions : []),
(is_array($userGlobalOptions) ? $userGlobalOptions : []),
(is_array($userEnvironmentOptions) ? $userEnvironmentOptions : []),
$this->options
);

View file

@ -36,17 +36,19 @@ class CacheWarmupTask extends AbstractTask
$command = $options['console'] . ' cache:warmup --env=' . $options['env'] . ' ' . $options['flags'];
/** @var Process $process */
$process = $this->runtime->runCommand($command);
$process = $this->runtime->runCommand(trim($command));
return $process->isSuccessful();
}
protected function getOptions()
{
$userOptions = $this->runtime->getConfigOptions('symfony', []);
$userGlobalOptions = $this->runtime->getConfigOptions('symfony', []);
$userEnvironmentOptions = $this->runtime->getEnvironmentConfig('symfony', []);
$options = array_merge(
['console' => 'bin/console', 'env' => 'dev', 'flags' => ''],
(is_array($userOptions) ? $userOptions : []),
(is_array($userGlobalOptions) ? $userGlobalOptions : []),
(is_array($userEnvironmentOptions) ? $userEnvironmentOptions : []),
$this->options
);

View file

@ -0,0 +1,104 @@
<?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\Tests\Command\BuiltIn;
use Mage\Command\BuiltIn\DeployCommand;
use Mage\Tests\MageApplicationMockup;
use Mage\Command\AbstractCommand;
use Mage\Runtime\Exception\RuntimeException;
use Exception;
use Symfony\Component\Console\Tester\CommandTester;
use PHPUnit_Framework_TestCase as TestCase;
class DeployCommandMiscTasksTest extends TestCase
{
public function testSymfonyEnvironmentConfiguration()
{
$application = new MageApplicationMockup();
$application->configure(__DIR__ . '/../../Resources/symfony-envconf.yml');
/** @var AbstractCommand $command */
$command = $application->find('deploy');
$this->assertTrue($command instanceof DeployCommand);
$tester = new CommandTester($command);
$tester->execute(['command' => $command->getName(), 'environment' => 'test']);
$ranCommands = $application->getRuntime()->getRanCommands();
$testCase = array(
0 => 'rsync -e "ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" -avz --exclude=.git --exclude=./var/cache/* --exclude=./var/log/* --exclude=./web/app_dev.php ./ tester@testhost:/var/www/test',
1 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& bin/console cache:warmup --env=testenv\\"',
2 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& bin/console assets:install web --env=testenv --symlink --relative\\"',
3 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& bin/console assetic:dump --env=testenv\\"',
4 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& bin/console assetic:dump --env=prod\\"',
);
// Check total of Executed Commands
$this->assertEquals(count($testCase), count($ranCommands));
// Check Generated Commands
foreach ($testCase as $index => $command) {
$this->assertEquals($command, $ranCommands[$index]);
}
$this->assertEquals(0, $tester->getStatusCode());
}
public function testComposerFlags()
{
$application = new MageApplicationMockup();
$application->configure(__DIR__ . '/../../Resources/composer.yml');
/** @var AbstractCommand $command */
$command = $application->find('deploy');
$this->assertTrue($command instanceof DeployCommand);
$tester = new CommandTester($command);
$tester->execute(['command' => $command->getName(), 'environment' => 'test']);
$ranCommands = $application->getRuntime()->getRanCommands();
$testCase = array(
0 => '/usr/bin/composer.phar install --prefer-source',
1 => '/usr/bin/composer.phar dump-autoload --no-scripts',
2 => 'rsync -e "ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" -avz --exclude=.git --exclude=./var/cache/* --exclude=./var/log/* --exclude=./web/app_dev.php ./ tester@testhost:/var/www/test',
);
// Check total of Executed Commands
$this->assertEquals(count($testCase), count($ranCommands));
// Check Generated Commands
foreach ($testCase as $index => $command) {
$this->assertEquals($command, $ranCommands[$index]);
}
$this->assertEquals(0, $tester->getStatusCode());
}
public function testInvalidTaskName()
{
$application = new MageApplicationMockup();
$application->configure(__DIR__ . '/../../Resources/invalid-task.yml');
/** @var AbstractCommand $command */
$command = $application->find('deploy');
$this->assertTrue($command instanceof DeployCommand);
try {
$tester = new CommandTester($command);
$tester->execute(['command' => $command->getName(), 'environment' => 'test']);
} catch (Exception $exception) {
$this->assertTrue($exception instanceof RuntimeException);
$this->assertEquals('Invalid task name "invalid/task"', $exception->getMessage());
}
}
}

View file

@ -36,13 +36,13 @@ class DeployCommandMiscTest extends TestCase
0 => 'git branch | grep "*"',
1 => 'git checkout test',
2 => 'git pull',
3 => 'composer install',
4 => 'composer dumpautoload --optimize',
3 => 'composer install --optimize-autoloader',
4 => 'composer dump-autoload --optimize',
5 => 'rsync -e "ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" -avz --exclude=.git --exclude=./var/cache/* --exclude=./var/log/* --exclude=./web/app_dev.php ./ tester@testhost:/var/www/test',
6 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& sudo bin/console cache:clear --env=dev \\"',
7 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& sudo bin/console cache:warmup --env=dev \\"',
8 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& sudo bin/console assets:install --env=dev --symlink --relative web\\"',
9 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& sudo bin/console assetic:dump --env=dev \\"',
6 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& sudo bin/console cache:clear --env=dev\\"',
7 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& sudo bin/console cache:warmup --env=dev\\"',
8 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& sudo bin/console assets:install web --env=dev --symlink --relative\\"',
9 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& sudo bin/console assetic:dump --env=dev\\"',
10 => 'git checkout master',
);
@ -75,12 +75,12 @@ class DeployCommandMiscTest extends TestCase
0 => 'git branch | grep "*"',
1 => 'git checkout maintenance',
2 => 'git pull',
3 => 'composer install',
4 => 'composer dumpautoload --optimize',
3 => 'composer install --optimize-autoloader',
4 => 'composer dump-autoload --optimize',
5 => 'rsync -e "ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" -avz --exclude=.git --exclude=./var/cache/* --exclude=./var/log/* --exclude=./web/app_dev.php ./ tester@testhost:/var/www/test',
6 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& bin/console cache:warmup --env=dev \\"',
7 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& bin/console assets:install --env=dev --symlink --relative web\\"',
8 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& bin/console assetic:dump --env=dev \\"',
6 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& bin/console cache:warmup --env=dev\\"',
7 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& bin/console assets:install web --env=dev --symlink --relative\\"',
8 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& bin/console assetic:dump --env=dev\\"',
9 => 'git checkout master',
);
@ -111,8 +111,8 @@ class DeployCommandMiscTest extends TestCase
$ranCommands = $application->getRuntime()->getRanCommands();
$testCase = array(
0 => 'composer install',
1 => 'composer dumpautoload --optimize',
0 => 'composer install --optimize-autoloader',
1 => 'composer dump-autoload --optimize',
2 => 'rsync -e "ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" -avz --exclude=.git --exclude=./var/cache/* --exclude=./var/log/* --exclude=./web/app_dev.php ./ tester@testhost:/var/www/test',
);
@ -149,8 +149,8 @@ class DeployCommandMiscTest extends TestCase
0 => 'git branch | grep "*"',
1 => 'git checkout test',
2 => 'git pull',
3 => 'composer install',
4 => 'composer dumpautoload --optimize',
3 => 'composer install --optimize-autoloader',
4 => 'composer dump-autoload --optimize',
5 => 'tar cfz /tmp/mageXYZ --exclude=".git" --exclude="./var/cache/*" --exclude="./var/log/*" --exclude="./web/app_dev.php" ./',
6 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"mkdir -p /var/www/test/releases/1234567890\\"',
7 => 'scp -P 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no /tmp/mageXYZ tester@testhost:/var/www/test/releases/1234567890/mageXYZ',
@ -189,8 +189,8 @@ class DeployCommandMiscTest extends TestCase
0 => 'git branch | grep "*"',
1 => 'git checkout test',
2 => 'git pull',
3 => 'composer install',
4 => 'composer dumpautoload --optimize',
3 => 'composer install --optimize-autoloader',
4 => 'composer dump-autoload --optimize',
5 => 'rsync -e "ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" -avz --exclude=.git --exclude=./var/cache/* --exclude=./var/log/* --exclude=./web/app_dev.php ./ tester@testhost:/var/www/test',
6 => 'git checkout master',
);
@ -225,12 +225,12 @@ class DeployCommandMiscTest extends TestCase
$testCase = array(
0 => 'git branch | grep "*"',
1 => 'git pull',
2 => 'composer install',
3 => 'composer dumpautoload --optimize',
2 => 'composer install --optimize-autoloader',
3 => 'composer dump-autoload --optimize',
4 => 'rsync -e "ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" -avz --exclude=.git --exclude=./var/cache/* --exclude=./var/log/* --exclude=./web/app_dev.php ./ tester@testhost:/var/www/test',
5 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& bin/console cache:warmup --env=dev \\"',
6 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& bin/console assets:install --env=dev --symlink --relative web\\"',
7 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& bin/console assetic:dump --env=dev \\"',
5 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& bin/console cache:warmup --env=dev\\"',
6 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& bin/console assets:install web --env=dev --symlink --relative\\"',
7 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& bin/console assetic:dump --env=dev\\"',
8 => 'git branch | grep "*"',
);

View file

@ -38,16 +38,16 @@ class DeployCommandWithReleasesTest extends TestCase
0 => 'git branch | grep "*"',
1 => 'git checkout test',
2 => 'git pull',
3 => 'composer install',
4 => 'composer dumpautoload --optimize',
3 => 'composer install --optimize-autoloader',
4 => 'composer dump-autoload --optimize',
5 => 'tar cfz /tmp/mageXYZ --exclude=".git" --exclude="./var/cache/*" --exclude="./var/log/*" --exclude="./web/app_dev.php" ./',
6 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"mkdir -p /var/www/test/releases/1234567890\\"',
7 => 'scp -P 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no /tmp/mageXYZ tester@testhost:/var/www/test/releases/1234567890/mageXYZ',
8 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test/releases/1234567890 \\&\\& tar xfz mageXYZ\\"',
9 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"rm /var/www/test/releases/1234567890/mageXYZ\\"',
10 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test/releases/1234567890 \\&\\& bin/console cache:warmup --env=dev \\"',
11 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test/releases/1234567890 \\&\\& bin/console assets:install --env=dev --symlink --relative web\\"',
12 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test/releases/1234567890 \\&\\& bin/console assetic:dump --env=dev \\"',
10 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test/releases/1234567890 \\&\\& bin/console cache:warmup --env=dev\\"',
11 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test/releases/1234567890 \\&\\& bin/console assets:install web --env=dev --symlink --relative\\"',
12 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test/releases/1234567890 \\&\\& bin/console assetic:dump --env=dev\\"',
13 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& ln -snf releases/1234567890 current\\"',
14 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"ls -1 /var/www/test/releases\\"',
15 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"rm -rf /var/www/test/releases/20170101015110\\"',

View file

@ -36,12 +36,12 @@ class DeployCommandWithoutReleasesTest extends TestCase
0 => 'git branch | grep "*"',
1 => 'git checkout test',
2 => 'git pull',
3 => 'composer install',
4 => 'composer dumpautoload --optimize',
3 => 'composer install --optimize-autoloader',
4 => 'composer dump-autoload --optimize',
5 => 'rsync -e "ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" -avz --exclude=.git --exclude=./var/cache/* --exclude=./var/log/* --exclude=./web/app_dev.php ./ tester@testhost:/var/www/test',
6 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& bin/console cache:warmup --env=dev \\"',
7 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& bin/console assets:install --env=dev --symlink --relative web\\"',
8 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& bin/console assetic:dump --env=dev \\"',
6 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& bin/console cache:warmup --env=dev\\"',
7 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& bin/console assets:install web --env=dev --symlink --relative\\"',
8 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& bin/console assetic:dump --env=dev\\"',
9 => 'git checkout master',
);

View file

@ -17,7 +17,7 @@ magephp:
pre-deploy:
- git/update
- composer/install
- composer/generate-autoload
- composer/dump-autoload
on-deploy:
- symfony/cache-warmup: { env: 'dev' }
- symfony/assets-install: { env: 'dev' }

View file

@ -0,0 +1,17 @@
magephp:
log_dir: /tmp
composer:
path: /usr/bin/composer.phar
environments:
test:
user: tester
host_path: /var/www/test
exclude:
- ./var/cache/*
- ./var/log/*
- ./web/app_dev.php
hosts:
- testhost
pre-deploy:
- composer/install: { flags: '--prefer-source' }
- composer/dump-autoload: { flags: '--no-scripts' }

View file

@ -0,0 +1,14 @@
magephp:
log_dir: /tmp
environments:
test:
user: tester
host_path: /var/www/test
exclude:
- ./var/cache/*
- ./var/log/*
- ./web/app_dev.php
hosts:
- testhost
pre-deploy:
- invalid/task

View file

@ -0,0 +1,18 @@
magephp:
log_dir: /tmp
environments:
test:
symfony: { env: 'testenv' }
user: tester
host_path: /var/www/test
exclude:
- ./var/cache/*
- ./var/log/*
- ./web/app_dev.php
hosts:
- testhost
on-deploy:
- symfony/cache-warmup
- symfony/assets-install
- symfony/assetic-dump
- symfony/assetic-dump: { env: 'prod' }

View file

@ -12,7 +12,7 @@ magephp:
- testhost
pre-deploy:
- composer/install
- composer/generate-autoload
- composer/dump-autoload
on-deploy:
- Mage\Tests\Task\CustomTask
on-release:

View file

@ -14,7 +14,7 @@ magephp:
pre-deploy:
- git/update
- composer/install
- composer/generate-autoload
- composer/dump-autoload
on-deploy:
- symfony/cache-warmup: { env: 'dev' }
- symfony/assets-install: { env: 'dev' }

View file

@ -15,7 +15,7 @@ magephp:
pre-deploy:
- git/update
- composer/install
- composer/generate-autoload
- composer/dump-autoload
on-deploy:
- symfony/cache-clear: { env: 'dev' }
- symfony/cache-warmup: { env: 'dev' }

View file

@ -15,7 +15,7 @@ magephp:
pre-deploy:
- git/update
- composer/install
- composer/generate-autoload
- composer/dump-autoload
on-deploy:
- deploy/rsync
on-release:

View file

@ -14,7 +14,7 @@ magephp:
pre-deploy:
- git/update
- composer/install
- composer/generate-autoload
- composer/dump-autoload
on-deploy:
- deploy/rsync
on-release:

View file

@ -14,7 +14,7 @@ magephp:
pre-deploy:
- git/update
- composer/install
- composer/generate-autoload
- composer/dump-autoload
on-deploy:
- symfony/cache-warmup: { env: 'dev' }
- symfony/assets-install: { env: 'dev' }

View file

@ -15,7 +15,7 @@ magephp:
pre-deploy:
- git/update
- composer/install
- composer/generate-autoload
- composer/dump-autoload
on-deploy:
- symfony/cache-warmup: { env: 'dev' }
- symfony/assets-install: { env: 'dev' }