From ecdce9141846364ee4664e50d1ae53a5b04aa461 Mon Sep 17 00:00:00 2001 From: Brandon Date: Fri, 17 Jan 2025 23:21:58 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Use=20`Opti?= =?UTF-8?q?mizeCommand::getOptimizedTasks`=20when=20getting=20optimize=20t?= =?UTF-8?q?asks=20(#425)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Acorn/Console/Commands/OptimizeClearCommand.php | 11 +++-------- src/Roots/Acorn/Console/Commands/OptimizeCommand.php | 9 +++------ 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/Roots/Acorn/Console/Commands/OptimizeClearCommand.php b/src/Roots/Acorn/Console/Commands/OptimizeClearCommand.php index 4ded4994..e127c114 100644 --- a/src/Roots/Acorn/Console/Commands/OptimizeClearCommand.php +++ b/src/Roots/Acorn/Console/Commands/OptimizeClearCommand.php @@ -18,14 +18,9 @@ public function handle() { $this->components->info('Clearing cached bootstrap files.'); - collect([ - 'cache' => fn () => $this->gracefulCallSilent('cache:clear') == 0, - 'compiled' => fn () => $this->gracefulCallSilent('clear-compiled') == 0, - 'config' => fn () => $this->gracefulCallSilent('config:clear') == 0, - 'events' => fn () => $this->gracefulCallSilent('event:clear') == 0, - 'routes' => fn () => $this->gracefulCallSilent('route:clear') == 0, - 'views' => fn () => $this->gracefulCallSilent('view:clear') == 0, - ])->each(fn ($task, $description) => $this->components->task($description, $task)); + foreach ($this->getOptimizeClearTasks() as $description => $command) { + $this->components->task($description, fn () => $this->gracefulCallSilent($command) == 0); + } $this->newLine(); } diff --git a/src/Roots/Acorn/Console/Commands/OptimizeCommand.php b/src/Roots/Acorn/Console/Commands/OptimizeCommand.php index 538353fa..08fd5031 100644 --- a/src/Roots/Acorn/Console/Commands/OptimizeCommand.php +++ b/src/Roots/Acorn/Console/Commands/OptimizeCommand.php @@ -18,12 +18,9 @@ public function handle() { $this->components->info('Caching framework bootstrap, configuration, and metadata.'); - collect([ - 'config' => fn () => $this->gracefulCallSilent('config:cache') == 0, - 'events' => fn () => $this->gracefulCallSilent('event:cache') == 0, - 'routes' => fn () => $this->gracefulCallSilent('route:cache') == 0, - 'views' => fn () => $this->gracefulCallSilent('view:cache') == 0, - ])->each(fn ($task, $description) => $this->components->task($description, $task)); + foreach ($this->getOptimizeTasks() as $description => $command) { + $this->components->task($description, fn () => $this->gracefulCallSilent($command) == 0); + } $this->newLine(); }