Skip to content

Commit

Permalink
[5.x] Make commands lazy (#1399)
Browse files Browse the repository at this point in the history
* Make commands lazy

* lint

* lint

* Fix soft dependency
  • Loading branch information
timacdonald committed Mar 19, 2024
1 parent 7dc7c05 commit 42300e0
Show file tree
Hide file tree
Showing 19 changed files with 37 additions and 1 deletion.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"illuminate/support": "^9.21|^10.0|^11.0",
"nesbot/carbon": "^2.17|^3.0",
"ramsey/uuid": "^4.0",
"symfony/console": "^6.0|^7.0",
"symfony/process": "^6.0|^7.0",
"symfony/error-handler": "^6.0|^7.0"
},
Expand Down
2 changes: 2 additions & 0 deletions src/Console/ClearCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
use Illuminate\Support\Arr;
use Laravel\Horizon\Contracts\JobRepository;
use Laravel\Horizon\RedisQueue;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'horizon:clear')]
class ClearCommand extends Command
{
use ConfirmableTrait;
Expand Down
2 changes: 2 additions & 0 deletions src/Console/ClearMetricsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

use Illuminate\Console\Command;
use Laravel\Horizon\Contracts\MetricsRepository;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'horizon:clear-metrics')]
class ClearMetricsCommand extends Command
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Console/ContinueCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
use Illuminate\Support\Str;
use Laravel\Horizon\Contracts\MasterSupervisorRepository;
use Laravel\Horizon\MasterSupervisor;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'horizon:continue')]
class ContinueCommand extends Command
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Console/ContinueSupervisorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
use Illuminate\Support\Str;
use Laravel\Horizon\Contracts\SupervisorRepository;
use Laravel\Horizon\MasterSupervisor;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'horizon:continue-supervisor')]
class ContinueSupervisorCommand extends Command
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Console/ForgetFailedCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

use Illuminate\Console\Command;
use Laravel\Horizon\Contracts\JobRepository;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'horizon:forget')]
class ForgetFailedCommand extends Command
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Console/HorizonCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
use Laravel\Horizon\Contracts\MasterSupervisorRepository;
use Laravel\Horizon\MasterSupervisor;
use Laravel\Horizon\ProvisioningPlan;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'horizon')]
class HorizonCommand extends Command
{
/**
Expand Down
3 changes: 2 additions & 1 deletion src/Console/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
use Illuminate\Console\Command;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Str;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'horizon:install')]
class InstallCommand extends Command
{
/**
Expand Down Expand Up @@ -52,7 +54,6 @@ protected function registerHorizonServiceProvider()
$namespace = Str::replaceLast('\\', '', $this->laravel->getNamespace());

if (file_exists($this->laravel->bootstrapPath('providers.php'))) {
// @phpstan-ignore-next-line
ServiceProvider::addProviderToBootstrapFile("{$namespace}\\Providers\\HorizonServiceProvider");
} else {
$appConfig = file_get_contents(config_path('app.php'));
Expand Down
2 changes: 2 additions & 0 deletions src/Console/ListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

use Illuminate\Console\Command;
use Laravel\Horizon\Contracts\MasterSupervisorRepository;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'horizon:list')]
class ListCommand extends Command
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Console/PauseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
use Illuminate\Support\Str;
use Laravel\Horizon\Contracts\MasterSupervisorRepository;
use Laravel\Horizon\MasterSupervisor;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'horizon:pause')]
class PauseCommand extends Command
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Console/PauseSupervisorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
use Illuminate\Support\Str;
use Laravel\Horizon\Contracts\SupervisorRepository;
use Laravel\Horizon\MasterSupervisor;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'horizon:pause-supervisor')]
class PauseSupervisorCommand extends Command
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Console/PublishCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
namespace Laravel\Horizon\Console;

use Illuminate\Console\Command;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'horizon:publish')]
class PublishCommand extends Command
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Console/PurgeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
use Laravel\Horizon\Contracts\SupervisorRepository;
use Laravel\Horizon\MasterSupervisor;
use Laravel\Horizon\ProcessInspector;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'horizon:purge')]
class PurgeCommand extends Command
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Console/SnapshotCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
use Illuminate\Console\Command;
use Laravel\Horizon\Contracts\MetricsRepository;
use Laravel\Horizon\Lock;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'horizon:snapshot')]
class SnapshotCommand extends Command
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Console/StatusCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

use Illuminate\Console\Command;
use Laravel\Horizon\Contracts\MasterSupervisorRepository;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'horizon:status')]
class StatusCommand extends Command
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Console/SupervisorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
use Illuminate\Console\Command;
use Laravel\Horizon\SupervisorFactory;
use Laravel\Horizon\SupervisorOptions;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'horizon:supervisor')]
class SupervisorCommand extends Command
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Console/SupervisorsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

use Illuminate\Console\Command;
use Laravel\Horizon\Contracts\SupervisorRepository;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'horizon:supervisors')]
class SupervisorsCommand extends Command
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Console/TerminateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
use Illuminate\Support\Str;
use Laravel\Horizon\Contracts\MasterSupervisorRepository;
use Laravel\Horizon\MasterSupervisor;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'horizon:terminate')]
class TerminateCommand extends Command
{
use InteractsWithTime;
Expand Down
2 changes: 2 additions & 0 deletions src/Console/TimeoutCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
use Illuminate\Console\Command;
use Laravel\Horizon\MasterSupervisor;
use Laravel\Horizon\ProvisioningPlan;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'horizon:timeout')]
class TimeoutCommand extends Command
{
/**
Expand Down

0 comments on commit 42300e0

Please sign in to comment.