From cbfc652df85eb7acdf2070442f7d53c6f49dac79 Mon Sep 17 00:00:00 2001 From: Anton Medvedev Date: Thu, 19 Jan 2017 10:47:14 +0700 Subject: [PATCH] Remove autounlock from common and move to template --- CHANGELOG.md | 1 - recipe/common.php | 1 - src/Initializer/Template/CommonTemplate.php | 4 ++-- src/Initializer/Template/FrameworkTemplate.php | 3 +++ 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b2057ec..7474190d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,6 @@ - Raised timeout for runLocally to 300 seconds [#955](https://github.com/deployphp/deployer/pull/955) - `deploy:unlock` now always successful [#950](https://github.com/deployphp/deployer/pull/950) - Added option `-L` to `setfacl` [#956](https://github.com/deployphp/deployer/pull/956) -- Run `deploy:unlock` when deploy is fail [#958](https://github.com/deployphp/deployer/pull/958) - Now throw exception on duplicates in `shared_dirs` ### Fixed diff --git a/recipe/common.php b/recipe/common.php index bd2a343c..c7396069 100644 --- a/recipe/common.php +++ b/recipe/common.php @@ -143,4 +143,3 @@ task('deploy:failed', function () { })->setPrivate(); onFailure('deploy', 'deploy:failed'); -before('deploy:failed', 'deploy:unlock'); diff --git a/src/Initializer/Template/CommonTemplate.php b/src/Initializer/Template/CommonTemplate.php index b15a22bc..13752aad 100644 --- a/src/Initializer/Template/CommonTemplate.php +++ b/src/Initializer/Template/CommonTemplate.php @@ -63,10 +63,10 @@ task('deploy', [ 'deploy:symlink', 'deploy:unlock', 'cleanup', - 'success' ]); -after('deploy', 'success'); +// [Optional] if deploy fails automatically unlock. +after('deploy:failed', 'deploy:unlock'); PHP; } } diff --git a/src/Initializer/Template/FrameworkTemplate.php b/src/Initializer/Template/FrameworkTemplate.php index abc22bf6..88e31ba2 100644 --- a/src/Initializer/Template/FrameworkTemplate.php +++ b/src/Initializer/Template/FrameworkTemplate.php @@ -46,6 +46,9 @@ task('php-fpm:restart', function () { run('sudo systemctl restart php-fpm.service'); }); after('deploy:symlink', 'php-fpm:restart'); + +// [Optional] if deploy fails automatically unlock. +after('deploy:failed', 'deploy:unlock'); {$this->getExtraContent()} PHP; }