Beispiel #1
0
use Idephix\Idephix;
use Idephix\Extension\Deploy\Deploy;
use Idephix\Extension\PHPUnit\PHPUnit;
$localBaseDir = __DIR__;
$sshParams = array('user' => 'ideato');
$targets = array('prod' => array('hosts' => array('127.0.0.1'), 'ssh_params' => $sshParams, 'deploy' => array('local_base_dir' => $localBaseDir, 'remote_base_dir' => "/var/www/myfantasticserver/", 'rsync_exclude_file' => 'rsync_exclude.txt')), 'stage' => array('hosts' => array('127.0.0.1'), 'ssh_params' => $sshParams, 'deploy' => array('local_base_dir' => $localBaseDir, 'remote_base_dir' => "/var/www/myfantasticserver/", 'rsync_exclude_file' => 'rsync_exclude.txt')), 'dev' => array('hosts' => array('127.0.0.1'), 'ssh_params' => array('user' => 'vagrant'), 'deploy' => array('local_base_dir' => $localBaseDir, 'remote_base_dir' => "/var/www/myfantasticserver/", 'rsync_exclude_file' => 'rsync_exclude.txt')));
$idx = new Idephix($targets);
$idx->add('project:deploy', function ($go = false) use($idx) {
    $env = $idx->getCurrentTargetName();
    if (!$go) {
        echo "\nDry Run\n";
    }
    $idx->setDryRun(!$go);
    $idx->setUpEnvironment();
    if (!$idx->isRemoteReady()) {
        $idx->bootstrap();
    }
    $idx->remotePrepare();
    $idx->getStrategy()->deploy();
    $idx->remoteLinkSharedFolders();
    if ($idx->hasToMigrate()) {
        $idx->doctrineMigrate();
    }
    $idx->remote('cd ' . $idx->getNextReleaseFolder() . '/app/config && rm -f parameters.yml', !$go);
    $idx->remote('cd ' . $idx->getNextReleaseFolder() . '/app/config && ln -s parameters.' . $env . '.yml parameters.yml', !$go);
    $idx->cacheClear();
    $idx->switchToTheNextRelease();
    $idx->assetic();
    $idx->deleteOldReleases(6);
    $idx->remote('cd ' . $idx->getNextReleaseFolder() . ' && rm -Rf app/cache/*', !$go);