From a4900c94c9b297febcd519d9e3058f24151ce996 Mon Sep 17 00:00:00 2001 From: Maksim Kuznetsov Date: Fri, 24 Feb 2017 02:27:50 +0300 Subject: [PATCH] =?UTF-8?q?Create=20`writable=5Fdirs`=20if=20they=20don?= =?UTF-8?q?=E2=80=99t=20exist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + recipe/deploy/writable.php | 3 +++ test/recipe/CommonTest.php | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c6d3dab..5aebfcf7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ - Fixed an issue with the output of ls in releases_list [#1004](https://github.com/deployphp/deployer/issues/1004) [#1036](https://github.com/deployphp/deployer/pull/1036/) - Fixed possibility to use PEM files with Native SSH - Fixed old releases not being cleaned up when keep_releases reduced by more than half. +- Fixed creating non-existed `writable_dirs` [#1000](https://github.com/deployphp/deployer/pull/1000) ### Changed - Add task queue:restart for Laravel recipe [#1007](https://github.com/deployphp/deployer/pull/1007) diff --git a/recipe/deploy/writable.php b/recipe/deploy/writable.php index 17578853..55241efb 100644 --- a/recipe/deploy/writable.php +++ b/recipe/deploy/writable.php @@ -33,6 +33,9 @@ task('deploy:writable', function () { try { cd('{{release_path}}'); + // Create directories if they don't exist + run("mkdir -p $dirs"); + if ($mode === 'chown') { // Change owner. // -R operate on files and directories recursively diff --git a/test/recipe/CommonTest.php b/test/recipe/CommonTest.php index 5caf6601..be80168b 100644 --- a/test/recipe/CommonTest.php +++ b/test/recipe/CommonTest.php @@ -93,13 +93,14 @@ class CommonTest extends RecipeTester { \Deployer\set('writable_mode', 'chmod'); \Deployer\set('writable_chmod_mod', '0777'); - \Deployer\set('writable_dirs', ['app/cache', 'app/logs']); + \Deployer\set('writable_dirs', ['app/cache', 'app/logs', 'app/path/to/non-existed/folder']); \Deployer\set('writable_use_sudo', false); $this->exec('deploy:writable'); $this->assertTrue(is_writable($this->getEnv('release_path') . '/app/cache')); $this->assertTrue(is_writable($this->getEnv('release_path') . '/app/logs')); + $this->assertTrue(is_writable($this->getEnv('release_path') . '/app/path/to/non-existed/folder')); } public function testVendor()