-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tempest\Console\Commands; | ||
|
||
use Tempest\AppConfig; | ||
use Tempest\Console\Console; | ||
use Tempest\Console\ConsoleCommand; | ||
use Tempest\Container\Container; | ||
use Tempest\Discovery\Discovery; | ||
|
||
final readonly class DiscoveryClearCommand | ||
{ | ||
public function __construct( | ||
private Container $container, | ||
private Console $console, | ||
private AppConfig $appConfig, | ||
) { | ||
} | ||
|
||
#[ConsoleCommand( | ||
name: 'discovery:clear', | ||
description: 'Clear all cached discovery files', | ||
)] | ||
public function __invoke(): void | ||
{ | ||
foreach ($this->appConfig->discoveryClasses as $discoveryClass) { | ||
/** @var Discovery $discovery */ | ||
$discovery = $this->container->get($discoveryClass); | ||
|
||
$discovery->destroyCache(); | ||
|
||
$this->console->writeln(implode('', [ | ||
"<em>{$discoveryClass}</em>", | ||
' cleared successful', | ||
])); | ||
} | ||
|
||
$this->console->writeln('Done'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tempest\Console\Commands; | ||
|
||
use Tempest\AppConfig; | ||
use Tempest\Console\Console; | ||
use Tempest\Console\ConsoleCommand; | ||
|
||
final readonly class DiscoveryStatusCommand | ||
{ | ||
public function __construct( | ||
private Console $console, | ||
private AppConfig $appConfig, | ||
) { | ||
} | ||
|
||
#[ConsoleCommand( | ||
name: 'discovery:status', | ||
description: 'List all discovery locations and discovery classes' | ||
)] | ||
public function __invoke(): void | ||
{ | ||
$this->console->info('Loaded Discovery classes'); | ||
|
||
foreach ($this->appConfig->discoveryClasses as $discoveryClass) { | ||
$this->console->writeln('- ' . $discoveryClass); | ||
} | ||
|
||
$this->console->writeln(); | ||
|
||
$this->console->info('Folders included in Tempest'); | ||
|
||
foreach ($this->appConfig->discoveryLocations as $discoveryLocation) { | ||
$this->console->writeln('- '. $discoveryLocation->path); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
require_once __DIR__ . '/../vendor/autoload.php'; | ||
|
||
passthru('./tempest discovery:clear'); |