From 6374c96fe583005673b8b762699dbe9dbd9428b4 Mon Sep 17 00:00:00 2001 From: Sergio Compean Date: Tue, 26 Mar 2024 02:00:26 -0400 Subject: [PATCH] format --- app/Commands/CleanCacheCommand.php | 10 +++++----- app/Commands/RenderCommand.php | 9 +++++---- tests/Feature/MiscellaneousTest.php | 9 ++++----- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/Commands/CleanCacheCommand.php b/app/Commands/CleanCacheCommand.php index 52dda65..b07c1b8 100644 --- a/app/Commands/CleanCacheCommand.php +++ b/app/Commands/CleanCacheCommand.php @@ -33,8 +33,8 @@ public function handle(): void { $cacheExpiration = $this->option('expires-minutes'); - if(! $cacheExpiration){ - $cacheExpiration = config('laravel-directory-cleanup.directories')[get_cached_path()]["deleteAllOlderThanMinutes"]; + if (! $cacheExpiration) { + $cacheExpiration = config('laravel-directory-cleanup.directories')[get_cached_path()]['deleteAllOlderThanMinutes']; } if ($this->option('force')) { @@ -44,9 +44,9 @@ public function handle(): void config([ 'laravel-directory-cleanup.directories' => [ get_cached_path() => [ - "deleteAllOlderThanMinutes" => intval($cacheExpiration) - ] - ] + 'deleteAllOlderThanMinutes' => intval($cacheExpiration), + ], + ], ]); $this->call('clean:directories'); diff --git a/app/Commands/RenderCommand.php b/app/Commands/RenderCommand.php index 8d22dbd..a494f65 100644 --- a/app/Commands/RenderCommand.php +++ b/app/Commands/RenderCommand.php @@ -219,11 +219,11 @@ protected function gatherVariables(): array { $variables = []; - foreach ( $this->option('from-yaml', []) as $file) { + foreach ($this->option('from-yaml', []) as $file) { $variables = array_merge($variables, Yaml::parseFile($file)); } - foreach ( $this->option('from-json', []) as $file) { + foreach ($this->option('from-json', []) as $file) { $variables = array_merge($variables, $this->loadJsonFile($file)); } @@ -257,8 +257,9 @@ public function renderFile(string $path, array $vars = [], ?string $saveTo = nul $saveTo = false; } - if($this->option('skip-existing') && is_file($saveTo)) { + if ($this->option('skip-existing') && is_file($saveTo)) { $this->components->info("Skipped existing file: $saveTo"); + return false; } @@ -312,7 +313,7 @@ public function renderFile(string $path, array $vars = [], ?string $saveTo = nul @mkdir($saveDirectory, recursive: true); file_put_contents($saveTo, $contents); - $saveTo = str_replace("//", "/", $saveTo); + $saveTo = str_replace('//', '/', $saveTo); $this->components->info("Rendered file: $saveTo"); diff --git a/tests/Feature/MiscellaneousTest.php b/tests/Feature/MiscellaneousTest.php index f494461..f510795 100644 --- a/tests/Feature/MiscellaneousTest.php +++ b/tests/Feature/MiscellaneousTest.php @@ -247,7 +247,6 @@ ])->expectsOutputToContain('The path being processed is also the --save-to directory, use a different save directory.'); }); - it('can render files in directory', function () { @mkdir(test_workspace_path('directory')); @@ -358,9 +357,9 @@ 'path' => $path, '--name' => 'Doug', '--dry-run' => true, - ])->expectsOutputToContain("DRY RUN") - ->expectsOutputToContain("name: Doug") - ->assertExitCode(0); + ])->expectsOutputToContain('DRY RUN') + ->expectsOutputToContain('name: Doug') + ->assertExitCode(0); expect(is_file(test_workspace_path("$name.rendered.yaml")))->toBeFalse(); -}); \ No newline at end of file +});