28 lines
694 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('Lock deploy');
task('deploy:lock', function () {
2016-11-19 15:53:31 +07:00
$locked = run("if [ -f {{deploy_path}}/.dep/deploy.lock ]; then echo 'true'; fi")->toBool();
2016-11-19 15:13:32 +07:00
if ($locked) {
throw new \RuntimeException(
"Deploy locked.\n" .
"Run deploy:unlock command to unlock."
);
} else {
2016-11-19 15:53:31 +07:00
run("touch {{deploy_path}}/.dep/deploy.lock");
2016-11-19 15:13:32 +07:00
}
});
desc('Unlock deploy');
task('deploy:unlock', function () {
2016-11-19 15:53:31 +07:00
run("rm {{deploy_path}}/.dep/deploy.lock");
2016-11-19 15:13:32 +07:00
});