Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
7 / 7 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
| HydeUpdateConfigsCommand | |
100.00% |
7 / 7 |
|
100.00% |
3 / 3 |
5 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
3 | |||
| handle | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
| checkIfConfigIsOutOfDate | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Hyde\Framework\Commands; |
| 4 | |
| 5 | use Hyde\Framework\Actions\ChecksIfConfigIsUpToDate; |
| 6 | use Hyde\Framework\Hyde; |
| 7 | use Illuminate\Support\Facades\File; |
| 8 | use LaravelZero\Framework\Commands\Command; |
| 9 | |
| 10 | /** |
| 11 | * Publish the Hyde Config Files. |
| 12 | * |
| 13 | * @see \Tests\Feature\Commands\HydeUpdateConfigsCommandTest |
| 14 | */ |
| 15 | class HydeUpdateConfigsCommand extends Command |
| 16 | { |
| 17 | protected $signature = 'update:configs'; |
| 18 | protected $description = 'Publish the default configuration files'; |
| 19 | |
| 20 | public function __construct() |
| 21 | { |
| 22 | parent::__construct(); |
| 23 | |
| 24 | if ($this->checkIfConfigIsOutOfDate() && config('hyde.warn_about_outdated_config', true)) { |
| 25 | $this->setDescription( |
| 26 | '<comment>⚠ Your configuration may be out of date. </comment>'. |
| 27 | 'Run this command to update them.' |
| 28 | ); |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | public function handle(): int |
| 33 | { |
| 34 | File::copyDirectory(Hyde::vendorPath('config'), Hyde::path('config')); |
| 35 | |
| 36 | $this->line('<info>Published config files to</info> <comment>'.Hyde::path('config').'</comment>'); |
| 37 | |
| 38 | return 0; |
| 39 | } |
| 40 | |
| 41 | protected function checkIfConfigIsOutOfDate(): bool |
| 42 | { |
| 43 | return ! (new ChecksIfConfigIsUpToDate)->execute(); |
| 44 | } |
| 45 | } |