mirror of
https://github.com/deployphp/deployer.git
synced 2025-02-24 01:02:24 +01:00
Atomic symlink.
This commit is contained in:
parent
4724625840
commit
86de97a5ab
@ -85,8 +85,7 @@ env('bin/composer', function () {
|
||||
*/
|
||||
env('bin/symlink', function () {
|
||||
if (env('use_relative_symlink')) {
|
||||
$man = run('man ln')->toString();
|
||||
if (strpos($man, '--relative') !== false) {
|
||||
if (run('if [[ "$(man ln)" =~ "--relative" ]]; then echo "true"; fi')->toBool()) {
|
||||
return 'ln -nfs --relative';
|
||||
}
|
||||
}
|
||||
@ -419,8 +418,15 @@ task('deploy:vendors', function () {
|
||||
* Create symlink to last release.
|
||||
*/
|
||||
task('deploy:symlink', function () {
|
||||
run("cd {{deploy_path}} && {{bin/symlink}} {{release_path}} current"); // Atomic override symlink.
|
||||
run("cd {{deploy_path}} && rm release"); // Remove release link.
|
||||
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.
|
||||
}
|
||||
})->desc('Creating symlink to release');
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user