Don't generate files if the --dry-run option is set
* Add the --dry-run option. * Add a warning if --dry-run is used saying no files have been generated.
This commit is contained in:
parent
85c370c438
commit
ea43e67da8
2 changed files with 16 additions and 4 deletions
|
|
@ -16,6 +16,7 @@ final class GenerateConfigurationFiles
|
|||
private Filesystem $filesystem,
|
||||
private Environment $twig,
|
||||
private string $outputDir,
|
||||
private bool $isDryRun = false,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
@ -28,7 +29,10 @@ final class GenerateConfigurationFiles
|
|||
*/
|
||||
[$configurationData, $configurationDataDto, $filesToGenerate] = $filesToGenerateAndConfigurationData;
|
||||
|
||||
$filesToGenerate->each(function(TemplateFile $templateFile) use ($configurationData): void {
|
||||
if ($this->isDryRun) {
|
||||
return $next([$configurationDataDto, $filesToGenerate]);
|
||||
}
|
||||
|
||||
if ($templateFile->path !== null) {
|
||||
if (!$this->filesystem->exists($templateFile->path)) {
|
||||
$this->filesystem->mkdir("{$this->outputDir}/{$templateFile->path}");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue