Skip to content

Instantly share code, notes, and snippets.

@vittore
Last active December 17, 2015 12:48
Show Gist options
  • Save vittore/5611942 to your computer and use it in GitHub Desktop.
Save vittore/5611942 to your computer and use it in GitHub Desktop.
<?php
use Idephix\Idephix;
use Idephix\Extension\Deploy\Deploy;
use Idephix\Extension\PHPUnit\PHPUnit;
use Idephix\SSH\SshClient;
$localBaseDir = __DIR__;
$sshParams = array(
'user' => 'root',
);
$targets = array(
'fp1' => array(
'hosts' => array('10.10.96.1'),
'local_base_folder' => $localBaseDir,
'remote_base_folder' => "/tmp/var/www/fp1/bazar/",
'rsync_exclude_file' => 'rsync_exclude.txt',
'ssh_params' => $sshParams
),
'fp2' => array(
'hosts' => array('10.10.96.2'),
'local_base_folder' => $localBaseDir,
'remote_base_folder' => "/tmp/var/www/fp2/bazar/",
'rsync_exclude_file' => 'rsync_exclude.txt',
'ssh_params' => $sshParams
)
);
$idx = new Idephix($targets, new SshClient());
$idx->
/**
* Execute a deploy for the specified environment
* @param bool $go if not given it does a dry-run execution
*/
add('project:deploy',
function ($go = false) use ($idx)
{
if (!$go) {
echo "\nDry Run\n";
}
$idx->setUpEnvironment();
$idx->setDryRun(!$go);
$idx->remotePrepare(true);
$idx->copyCode();
$idx->remoteLinkSharedFolders();
$idx->cacheClear();
$idx->switchToTheNextRelease();
$idx->assetic();
if ($idx->getCurrentTargetName() == 'stage') {
$idx->updateSchema();
}
$idx->deleteOldReleases(6);
})->
/** <========== RUN ME =========== */
add('idephix:test-params',
function ($param1, $param2, $param3 = 'default')
{
echo 'Param1: '.$param1."\n";
echo 'Param2: '.$param2."\n";
echo 'Param3: '.$param3."\n";
});
$idx->addLibrary('deploy', new Deploy());
$idx->addLibrary('phpunit', new PHPUnit());
$idx->run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment