deployer/recipe/deploy/setup.php

23 lines
686 B
PHP
Raw Normal View History

2016-11-19 15:13:32 +07:00
<?php
namespace Deployer;
2019-08-12 20:59:59 +03:00
use Deployer\Exception\Exception;
2017-03-19 22:52:05 +07:00
desc('Preparing host for deploy');
2020-04-25 23:00:08 +03:00
task('deploy:setup', function () {
2021-10-11 22:10:47 +02:00
run(<<<EOF
[ -d {{deploy_path}} ] || mkdir -p {{deploy_path}};
cd {{deploy_path}};
[ -d .dep ] || mkdir .dep;
[ -d releases ] || mkdir releases;
[ -d shared ] || mkdir shared;
EOF
);
// If current_path points to something like "/var/www/html", make sure it is
// a symlink and not a directory.
if (test('[ ! -L {{current_path}} ] && [ -d {{current_path}} ]')) {
throw error("There is a directory (not symlink) at {{current_path}}.\n Remove this directory so it can be replaced with a symlink for atomic deployments.");
2016-11-19 15:13:32 +07:00
}
});