예제 #1
0
파일: idxfile.php 프로젝트: alemazz/iaac
    $idx->switchToTheNextRelease();
    $idx->assetic();
    $idx->deleteOldReleases(6);
    $idx->remote('cd ' . $idx->getNextReleaseFolder() . ' && rm -Rf app/cache/*', !$go);
})->add('test:run', function ($filter = '') use($idx) {
    $idx->runTask('test:run-group', 'unit', $filter);
    $idx->runTask('test:run-group', 'integration', $filter);
    $idx->runTask('test:run-group', 'command', $filter);
    $idx->runTask('test:run-group', 'functional', $filter);
    $idx->runTask('test:run-group', 'functionalAdmin', $filter);
})->add('test:run-group', function ($group, $filter = "") use($idx) {
    if (!empty($filter)) {
        $filter = ' --filter ' . $filter;
    }
    try {
        $idx->local('bin/phpunit -c app/ --stderr --group=' . $group . " " . $filter);
    } catch (\Exception $e) {
        exit(1);
    }
})->add('project:build', function () use($idx) {
    $cwd = getcwd();
    try {
        $idx->local("rm app/logs/*");
        $idx->local("rm junit*xml");
    } catch (\Exception $e) {
    }
    $idx->local("cd app/config && rm -rf parameters.yml");
    $idx->local("cd app/config && ln -s parameters.dev.yml parameters.yml");
    $idx->runTask('vendors:install');
    try {
        $idx->local("./app/console doctrine:database:create --env=test");
예제 #2
0
<?php

use Idephix\Idephix;
use Idephix\Extension\Deploy\Deploy;
use Idephix\Extension\PHPUnit\PHPUnit;
use Idephix\SSH\SshClient;
$idx = new Idephix();
$build = function () use($idx) {
    $idx->local('composer install --prefer-source');
    $idx->local('bin/phpunit -c tests');
};
$buildTravis = function () use($idx) {
    $idx->local('composer install --prefer-source');
    $idx->local('bin/phpunit -c tests --coverage-clover=clover.xml');
    $idx->runTask('createPhar');
};
$deployPhar = function () use($idx) {
    $idx->output->writeln('Releasing new phar version...');
    if (!file_exists('./idephix.phar')) {
        $idx->output->writeln('Idephix phar does not exists');
        exit(-1);
    }
    $new_version = $idx->local('cat .git/refs/heads/master');
    $commit_msg = trim($idx->local('git log -1 --pretty=%B'));
    if (false === strpos($commit_msg, '[release]')) {
        $idx->output->writeln("skipping, commit msg was '{$commit_msg}'");
        exit(0);
    }
    $current_version = file_get_contents('https://raw.githubusercontent.com/ideatosrl/getidephix.com/gh-pages/version');
    if ($new_version == $current_version) {
        $idx->output->writeln("version {$new_version} already deployed");
예제 #3
0
 /**
  * @dataProvider getTaskAndReturnCode
  */
 public function testReturnCode($task, $expected)
 {
     $_SERVER['argv'] = array('idx', $task);
     $output = fopen("php://memory", 'r+');
     $idx = new Idephix(array(), new SSH\SshClient(new SSH\FakeSsh2Proxy($this)), new StreamOutput($output));
     $idx->getApplication()->setAutoExit(false);
     $idx->add('fooOk', function () use($idx) {
         $idx->local("echo 'God save the Queen'");
     });
     $idx->add('fooKo', function () use($idx) {
         $idx->local("God save the Queen but this command will fail!");
     });
     $this->assertEquals($expected, $idx->run());
 }