From 806c7c4fea67ca7c5dc750a352f33af4e08ba965 Mon Sep 17 00:00:00 2001 From: Justin Frydman Date: Wed, 11 Dec 2024 14:13:57 -0700 Subject: [PATCH 1/4] Add failing test --- tests/Issues/StraussIssue104Test.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/Issues/StraussIssue104Test.php b/tests/Issues/StraussIssue104Test.php index 6e52ae45..b674bc74 100644 --- a/tests/Issues/StraussIssue104Test.php +++ b/tests/Issues/StraussIssue104Test.php @@ -42,5 +42,9 @@ public function test_correct_directory_permission() $result = substr(sprintf('%o', fileperms($this->testsWorkingDir . '/vendor-prefixed')), -4); self::assertEquals('0755', $result); + + $subfolderResult = substr(sprintf('%o', fileperms($this->testsWorkingDir . '/vendor-prefixed/psr')), -4); + + self::assertEquals('0755', $subfolderResult); } } From 09afad74c33c14b8d10f5d5ce6f1dc5ae8af6bc2 Mon Sep 17 00:00:00 2001 From: Justin Frydman Date: Wed, 11 Dec 2024 14:15:15 -0700 Subject: [PATCH 2/4] phpcs fixes --- tests/Issues/StraussIssue104Test.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Issues/StraussIssue104Test.php b/tests/Issues/StraussIssue104Test.php index b674bc74..21454c8b 100644 --- a/tests/Issues/StraussIssue104Test.php +++ b/tests/Issues/StraussIssue104Test.php @@ -43,8 +43,8 @@ public function test_correct_directory_permission() self::assertEquals('0755', $result); - $subfolderResult = substr(sprintf('%o', fileperms($this->testsWorkingDir . '/vendor-prefixed/psr')), -4); + $subfolderResult = substr(sprintf('%o', fileperms($this->testsWorkingDir . '/vendor-prefixed/psr')), -4); - self::assertEquals('0755', $subfolderResult); + self::assertEquals('0755', $subfolderResult); } } From 7485c7519cd84d322fc9e20c46c49d95efd18304 Mon Sep 17 00:00:00 2001 From: Justin Frydman Date: Wed, 11 Dec 2024 14:17:03 -0700 Subject: [PATCH 3/4] Set directory copying visibility to public --- src/Pipeline/Copier.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Pipeline/Copier.php b/src/Pipeline/Copier.php index 9879d7ba..a54fbe7b 100644 --- a/src/Pipeline/Copier.php +++ b/src/Pipeline/Copier.php @@ -49,7 +49,9 @@ public function __construct(DiscoveredFiles $files, string $workingDir, StraussC $this->absoluteTargetDir = $workingDir . $config->getTargetDirectory(); - $this->filesystem = new Filesystem(new LocalFilesystemAdapter('/')); + $this->filesystem = new Filesystem(new LocalFilesystemAdapter('/'), [ + 'directory_visibility' => 'public', + ]); } /** @@ -62,7 +64,6 @@ public function prepareTarget(): void { if (! is_dir($this->absoluteTargetDir)) { $this->filesystem->createDirectory($this->absoluteTargetDir); - $this->filesystem->setVisibility($this->absoluteTargetDir, 'public'); } else { foreach ($this->files->getFiles() as $file) { if (!$file->isDoCopy()) { From 024d732c52399eb16220be7ecf0fa8e18bbc6709 Mon Sep 17 00:00:00 2001 From: Justin Frydman Date: Wed, 11 Dec 2024 15:22:35 -0700 Subject: [PATCH 4/4] Use the config constant --- src/Pipeline/Copier.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Pipeline/Copier.php b/src/Pipeline/Copier.php index a54fbe7b..1a19761e 100644 --- a/src/Pipeline/Copier.php +++ b/src/Pipeline/Copier.php @@ -16,6 +16,7 @@ use BrianHenryIE\Strauss\Composer\Extra\StraussConfig; use BrianHenryIE\Strauss\Files\DiscoveredFiles; use BrianHenryIE\Strauss\Files\File; +use League\Flysystem\Config; use League\Flysystem\Filesystem; use League\Flysystem\Local\LocalFilesystemAdapter; @@ -50,7 +51,7 @@ public function __construct(DiscoveredFiles $files, string $workingDir, StraussC $this->absoluteTargetDir = $workingDir . $config->getTargetDirectory(); $this->filesystem = new Filesystem(new LocalFilesystemAdapter('/'), [ - 'directory_visibility' => 'public', + Config::OPTION_DIRECTORY_VISIBILITY => 'public', ]); }