From 6229d681ebcfb1db3f1b85b7b11d45eee1175fb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Mez=C3=AAncio?= Date: Sat, 27 May 2017 23:09:45 -0300 Subject: [PATCH 01/12] Add Laravel version task --- recipe/laravel.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/recipe/laravel.php b/recipe/laravel.php index 56adf5e19..3eed81e66 100644 --- a/recipe/laravel.php +++ b/recipe/laravel.php @@ -108,6 +108,17 @@ run('{{bin/php}} {{release_path}}/artisan storage:link'); }); +desc('Get Laravel version'); +task('artisan:version', function () { + $result = run('{{bin/php}} {{release_path}}/artisan --version'); + + preg_match_all('/version\ (.+?)$/', $result, $matches); + + $version = $matches[1][0] ?? get('laravel_version') ?? 5.4; + + set('laravel_version', (float) $version); +}); + /** * Task deploy:public_disk support the public disk. * To run this task automatically, please add below line to your deploy.php file From c0f927fc701aa0b5e025007ae0878ff9c8d349f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Mez=C3=AAncio?= Date: Sat, 27 May 2017 23:10:44 -0300 Subject: [PATCH 02/12] Check Laravel version before run artisan storage:link Since Laravel 5.2 does not have `artisan storage:link` command, we can't call it. --- recipe/laravel.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/recipe/laravel.php b/recipe/laravel.php index 3eed81e66..bec21f6d7 100644 --- a/recipe/laravel.php +++ b/recipe/laravel.php @@ -105,7 +105,9 @@ desc('Execute artisan storage:link'); task('artisan:storage:link', function () { - run('{{bin/php}} {{release_path}}/artisan storage:link'); + if (get('laravel_version') > 5.2) { + run('{{bin/php}} {{release_path}}/artisan storage:link'); + } }); desc('Get Laravel version'); @@ -151,6 +153,7 @@ 'deploy:shared', 'deploy:vendors', 'deploy:writable', + 'artisan:version', 'artisan:storage:link', 'artisan:view:clear', 'artisan:cache:clear', From 54b589f11c67b4f5a07250b36fc863cd66cdcf5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Mez=C3=AAncio?= Date: Sun, 28 May 2017 16:18:41 -0300 Subject: [PATCH 03/12] Change from task to configuration option --- recipe/laravel.php | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/recipe/laravel.php b/recipe/laravel.php index bec21f6d7..718c5c280 100644 --- a/recipe/laravel.php +++ b/recipe/laravel.php @@ -35,6 +35,16 @@ 'storage/logs', ]); +set('laravel_version', function () { + $result = run('{{bin/php}} {{release_path}}/artisan --version'); + + preg_match_all('/version\ (.+?)$/', $result, $matches); + + $version = $matches[1][0] ?? 5.4; + + return (float) $version; +}); + /** * Helper tasks */ @@ -110,17 +120,6 @@ } }); -desc('Get Laravel version'); -task('artisan:version', function () { - $result = run('{{bin/php}} {{release_path}}/artisan --version'); - - preg_match_all('/version\ (.+?)$/', $result, $matches); - - $version = $matches[1][0] ?? get('laravel_version') ?? 5.4; - - set('laravel_version', (float) $version); -}); - /** * Task deploy:public_disk support the public disk. * To run this task automatically, please add below line to your deploy.php file @@ -153,7 +152,6 @@ 'deploy:shared', 'deploy:vendors', 'deploy:writable', - 'artisan:version', 'artisan:storage:link', 'artisan:view:clear', 'artisan:cache:clear', From 7abcbbe03312db2573c14d1840af3f772c60312d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Mez=C3=AAncio?= Date: Sun, 28 May 2017 16:20:11 -0300 Subject: [PATCH 04/12] Compare versions using PHP's built-in function `version_compare()` --- recipe/laravel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipe/laravel.php b/recipe/laravel.php index 718c5c280..9f034f492 100644 --- a/recipe/laravel.php +++ b/recipe/laravel.php @@ -115,7 +115,7 @@ desc('Execute artisan storage:link'); task('artisan:storage:link', function () { - if (get('laravel_version') > 5.2) { + if (version_compare(get('laravel_version'), 5.2, '>')) { run('{{bin/php}} {{release_path}}/artisan storage:link'); } }); From ecc85dbc19e7654f5f0c897c4885b4b4d36dca92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Meze=CC=82ncio?= Date: Tue, 30 May 2017 09:09:54 -0300 Subject: [PATCH 05/12] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87fd74557..215ff138d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ ### Fixed - Fixed upload / download with optional rsync ssh options [#1227] +- Fixed storage link error when deploying Laravel < 5.3. +- Helps [#1153] ## v5.0.1 [v5.0.0...v5.0.1](https://github.com/deployphp/deployer/compare/v5.0.0...v5.0.1) From 5e3feb99c473243a9a87162582ba5568c2c5be8c Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Tue, 30 May 2017 10:42:37 +0200 Subject: [PATCH 06/12] Disable maintenance after failure --- recipe/magento2.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipe/magento2.php b/recipe/magento2.php index dfd527016..ba6c63ab9 100644 --- a/recipe/magento2.php +++ b/recipe/magento2.php @@ -87,3 +87,5 @@ 'cleanup', 'success' ]); + +after('deploy:failed', 'magento:maintenance:disable'); From 724fa20c60f318c330e8bdca093c87b3f2e8429d Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Tue, 30 May 2017 12:07:02 +0200 Subject: [PATCH 07/12] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 215ff138d..d7bb65a9c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Fixed upload / download with optional rsync ssh options [#1227] - Fixed storage link error when deploying Laravel < 5.3. - Helps [#1153] +- Disable maintenance mode when Magento2 deployment fails [#1251] ## v5.0.1 [v5.0.0...v5.0.1](https://github.com/deployphp/deployer/compare/v5.0.0...v5.0.1) @@ -202,6 +203,7 @@ ## v4.0.0 🙄 +[#1251]: https://github.com/deployphp/deployer/pull/1251 [#1218]: https://github.com/deployphp/deployer/issues/1218 [#1205]: https://github.com/deployphp/deployer/issues/1205 [#1204]: https://github.com/deployphp/deployer/issues/1204 From 03bbf7e55785737509e7a5b9a3935836c934c151 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Meze=CC=82ncio?= Date: Tue, 30 May 2017 09:09:54 -0300 Subject: [PATCH 08/12] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d7bb65a9c..b37e74039 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ - Fixed storage link error when deploying Laravel < 5.3. - Helps [#1153] - Disable maintenance mode when Magento2 deployment fails [#1251] +- Fixed storage link error when deploying Laravel < 5.3. +- Helps [#1153] ## v5.0.1 [v5.0.0...v5.0.1](https://github.com/deployphp/deployer/compare/v5.0.0...v5.0.1) From 69c8f7c1e24a66da690f4f2db9d31f66d25d11da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Meze=CC=82ncio?= Date: Tue, 30 May 2017 17:31:03 -0300 Subject: [PATCH 09/12] Fix version regex and change version check --- recipe/laravel.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/recipe/laravel.php b/recipe/laravel.php index 9f034f492..fbddeaca3 100644 --- a/recipe/laravel.php +++ b/recipe/laravel.php @@ -38,11 +38,11 @@ set('laravel_version', function () { $result = run('{{bin/php}} {{release_path}}/artisan --version'); - preg_match_all('/version\ (.+?)$/', $result, $matches); + preg_match_all('/([0-9\.])$/', $result, $matches); $version = $matches[1][0] ?? 5.4; - return (float) $version; + return $version; }); /** @@ -115,7 +115,10 @@ desc('Execute artisan storage:link'); task('artisan:storage:link', function () { - if (version_compare(get('laravel_version'), 5.2, '>')) { + $needsVersion = 5.3; + $currentVersion = get('laravel_version'); + + if (version_compare($currentVersion, $needsVersion, '>=')) { run('{{bin/php}} {{release_path}}/artisan storage:link'); } }); From 0bd8d4aba9cf91892aa95e669316d942195d4f5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Meze=CC=82ncio?= Date: Tue, 30 May 2017 17:34:42 -0300 Subject: [PATCH 10/12] Update changelog --- CHANGELOG.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b37e74039..1dc0173a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,10 +5,8 @@ ### Fixed - Fixed upload / download with optional rsync ssh options [#1227] -- Fixed storage link error when deploying Laravel < 5.3. -- Helps [#1153] - Disable maintenance mode when Magento2 deployment fails [#1251] -- Fixed storage link error when deploying Laravel < 5.3. +- Fixed storage link error when deploying Laravel < 5.3 - Helps [#1153] ## v5.0.1 @@ -232,6 +230,7 @@ [#1145]: https://github.com/deployphp/deployer/pull/1145 [#1146]: https://github.com/deployphp/deployer/pull/1146 [#1152]: https://github.com/deployphp/deployer/pull/1152 +[#1153]: https://github.com/deployphp/deployer/issues/1153 [#1165]: https://github.com/deployphp/deployer/issues/1165 [#1175]: https://github.com/deployphp/deployer/pull/1175 [#330]: https://github.com/deployphp/deployer/pull/330 From 704fc697f1b66d2308d644d356bce53cb4f07995 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Meze=CC=82ncio?= Date: Tue, 30 May 2017 09:09:54 -0300 Subject: [PATCH 11/12] Update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1dc0173a0..af58cb128 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ ### Fixed - Fixed upload / download with optional rsync ssh options [#1227] - Disable maintenance mode when Magento2 deployment fails [#1251] -- Fixed storage link error when deploying Laravel < 5.3 +- Fixed storage link error when deploying Laravel < 5.3. - Helps [#1153] ## v5.0.1 From 910e2e2aee756e2afb82db3248d927fe1ba25662 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Meze=CC=82ncio?= Date: Tue, 30 May 2017 17:34:42 -0300 Subject: [PATCH 12/12] Update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index af58cb128..1dc0173a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ ### Fixed - Fixed upload / download with optional rsync ssh options [#1227] - Disable maintenance mode when Magento2 deployment fails [#1251] -- Fixed storage link error when deploying Laravel < 5.3. +- Fixed storage link error when deploying Laravel < 5.3 - Helps [#1153] ## v5.0.1