mirror of
https://github.com/deployphp/deployer.git
synced 2025-02-24 01:02:24 +01:00
parent
54a29c8fa0
commit
e7f0018b05
@ -12,19 +12,22 @@ task('deploy:shared', function () {
|
||||
$sharedPath = "{{deploy_path}}/shared";
|
||||
|
||||
foreach (get('shared_dirs') as $dir) {
|
||||
$parentDir = dirname($dir);
|
||||
// Check if shared dir does not exists.
|
||||
if (!test("[ -d $sharedPath/$dir ]")) {
|
||||
// Create shared dir if it does not exist.
|
||||
run("mkdir -p $sharedPath/$dir");
|
||||
|
||||
// Create shared dir if it does not exist.
|
||||
run("mkdir -p $sharedPath/$dir");
|
||||
|
||||
// Copy shared dir files if they does not exist.
|
||||
run("if [ -d $(echo {{release_path}}/$dir) ]; then cp -rn {{release_path}}/$dir $sharedPath/$parentDir; fi");
|
||||
// If release contains shared dir, copy that dir from release to shared.
|
||||
if (test("[ -d $(echo {{release_path}}/$dir) ]")) {
|
||||
run("cp -rv {{release_path}}/$dir $sharedPath/" . dirname($dir));
|
||||
}
|
||||
}
|
||||
|
||||
// Remove from source.
|
||||
run("if [ -d $(echo {{release_path}}/$dir) ]; then rm -rf {{release_path}}/$dir; fi");
|
||||
run("rm -rf {{release_path}}/$dir");
|
||||
|
||||
// Create path to shared dir in release dir if it does not exist.
|
||||
// (symlink will not create the path and will fail otherwise)
|
||||
// Symlink will not create the path and will fail otherwise.
|
||||
run("mkdir -p `dirname {{release_path}}/$dir`");
|
||||
|
||||
// Symlink shared dir to release dir
|
||||
|
@ -363,6 +363,19 @@ function runLocally($command, $timeout = 60)
|
||||
return new Result($output);
|
||||
}
|
||||
|
||||
/**
|
||||
* Run test command.
|
||||
* Example:
|
||||
*
|
||||
* test('[ -d {{release_path}} ]')
|
||||
*
|
||||
* @param string $command
|
||||
* @return bool
|
||||
*/
|
||||
function test($command)
|
||||
{
|
||||
return run("if $command; then echo 'true'; fi")->toBool();
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload file or directory to current server.
|
||||
|
Loading…
x
Reference in New Issue
Block a user