Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎨 Improve the optimize and optimize:clear console commands #386

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions src/Roots/Acorn/Console/Commands/OptimizeClearCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,17 @@ class OptimizeClearCommand extends FoundationOptimizeClearCommand
*/
public function handle()
{
$this->gracefulCall('view:clear');
$this->gracefulCall('cache:clear');
$this->gracefulCall('route:clear');
$this->gracefulCall('config:clear');
$this->gracefulCall('clear-compiled');
$this->components->info('Clearing cached bootstrap files.');

$this->info('Caches cleared successfully!');
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));

$this->newLine();
}
}
12 changes: 9 additions & 3 deletions src/Roots/Acorn/Console/Commands/OptimizeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,15 @@ class OptimizeCommand extends FoundationOptimizeCommand
*/
public function handle()
{
$this->gracefulCall('config:cache');
$this->gracefulCall('route:cache');
$this->components->info('Caching framework bootstrap, configuration, and metadata.');

$this->info('Files cached successfully!');
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));

$this->newLine();
}
}
Loading