diff --git a/src/Command/RemoveIgnoredFilesCommand.php b/src/Command/RemoveIgnoredFilesCommand.php new file mode 100644 index 0000000..07728db --- /dev/null +++ b/src/Command/RemoveIgnoredFilesCommand.php @@ -0,0 +1,34 @@ + $filesToGenerate + * @var ConfigDto $configurationDataDto, + * @var array $configurationData + */ + [$configurationData, $configurationDataDto, $filesToGenerate] = $filesToGenerateAndConfigurationData; + + $filesToGenerate = $filesToGenerate->filter(function (TemplateFile $templateFile): bool { + return !collect($this->filenames)->contains($templateFile->name); + }); + + return $next([$configurationData, $configurationDataDto, $filesToGenerate]); + } +} diff --git a/src/Console/Command/GenerateCommand.php b/src/Console/Command/GenerateCommand.php index 5d4dc3f..884405a 100644 --- a/src/Console/Command/GenerateCommand.php +++ b/src/Console/Command/GenerateCommand.php @@ -8,9 +8,11 @@ use App\Command\CreateFinalConfigurationDataCommand; use App\Command\CreateListOfFilesToGenerateCommand; use App\Command\FindBuildConfigurationFileCommand; use App\Command\GenerateConfigurationFilesCommand; +use App\Command\RemoveIgnoredFilesCommand; use App\Command\ValidateConfigurationDataCommand; use App\DataTransferObject\ConfigDto; use App\DataTransferObject\TemplateFile; +use App\IgnoreFile; use Illuminate\Pipeline\Pipeline; use Illuminate\Support\Collection; use Symfony\Component\Console\Attribute\AsCommand; @@ -72,6 +74,7 @@ class GenerateCommand extends Command new CreateFinalConfigurationDataCommand(), new ValidateConfigurationDataCommand(), new CreateListOfFilesToGenerateCommand(), + new RemoveIgnoredFilesCommand(IgnoreFile::parse()), new GenerateConfigurationFilesCommand( $this->filesystem, $this->twig, diff --git a/src/IgnoreFile.php b/src/IgnoreFile.php new file mode 100644 index 0000000..30ff2e6 --- /dev/null +++ b/src/IgnoreFile.php @@ -0,0 +1,19 @@ +execute([[], [], $filenamesToGenerate], function ($result) { + self::assertCount(1, $result[2]); + self::assertSame('phpcs.xml.dist', $result[2][0]->name); + }); + } +} diff --git a/tests/Kernel/IgnoreFileTest.php b/tests/Kernel/IgnoreFileTest.php new file mode 100644 index 0000000..4a85329 --- /dev/null +++ b/tests/Kernel/IgnoreFileTest.php @@ -0,0 +1,26 @@ +