deployer/recipe/deploy/symlink.php

22 lines
740 B
PHP
Raw Normal View History

2016-11-19 15:13:32 +07:00
<?php
/* (c) Anton Medvedev <anton@medv.io>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Deployer;
desc('Creating symlink to release');
task('deploy:symlink', function () {
if (run('if [[ "$(man mv)" =~ "--no-target-directory" ]]; then echo "true"; fi')->toBool()) {
run("mv -T {{deploy_path}}/release {{deploy_path}}/current");
} else {
// Atomic symlink does not supported.
// Will use simple≤ two steps switch.
run("cd {{deploy_path}} && {{bin/symlink}} {{release_path}} current"); // Atomic override symlink.
run("cd {{deploy_path}} && rm release"); // Remove release link.
}
});