Skip to content

Commit

Permalink
Merge pull request #130 from defunctl/master
Browse files Browse the repository at this point in the history
Fix vendor-prefixed subdirectory permissions being copied as 0700 instead of 0755
  • Loading branch information
BrianHenryIE authored Dec 12, 2024
2 parents c831ef3 + 024d732 commit 8bbab09
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Pipeline/Copier.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -49,7 +50,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('/'), [
Config::OPTION_DIRECTORY_VISIBILITY => 'public',
]);
}

/**
Expand All @@ -62,7 +65,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()) {
Expand Down
4 changes: 4 additions & 0 deletions tests/Issues/StraussIssue104Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit 8bbab09

Please sign in to comment.