Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
surgiie committed Mar 26, 2024
1 parent 6feb911 commit 6374c96
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions app/Commands/CleanCacheCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')) {
Expand All @@ -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');
Expand Down
9 changes: 5 additions & 4 deletions app/Commands/RenderCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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");

Expand Down
9 changes: 4 additions & 5 deletions tests/Feature/MiscellaneousTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));

Expand Down Expand Up @@ -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();
});
});

0 comments on commit 6374c96

Please sign in to comment.