Adds check for existing /current directory to deploy:prepare

This commit is contained in:
Vic D'Elfant 2016-03-14 12:31:01 +01:00
parent 9bce6316ac
commit ac401ea2b2

View File

@ -103,6 +103,13 @@ task('deploy:prepare', function () {
run('if [ ! -d {{deploy_path}} ]; then mkdir -p {{deploy_path}}; fi');
// Check for existing /current directory (not symlink)
$result = run('if [ ! -L {{deploy_path}}/current ] && [ -d {{deploy_path}}/current ]; then echo 1; fi')->toString();
if ($result)
{
throw new RuntimeException('There already is a directory (not symlink) named "current" in the deploy_path. Remove this directory so it can be replaced with a symlink for atomic deployments.');
}
// Create releases dir.
run("cd {{deploy_path}} && if [ ! -d releases ]; then mkdir releases; fi");