From 2a49908a7deb4c98b017b722963ee015fafaee02 Mon Sep 17 00:00:00 2001 From: Len Woodward Date: Mon, 31 Jul 2023 21:41:32 -0700 Subject: [PATCH] use new Platform methods in Install command --- app/Commands/Install.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/Commands/Install.php b/app/Commands/Install.php index 99dc26b..a8c5892 100644 --- a/app/Commands/Install.php +++ b/app/Commands/Install.php @@ -5,6 +5,7 @@ use Illuminate\Support\Facades\File; use LaravelZero\Framework\Commands\Command; use ProjektGopher\Whisky\Hook; +use ProjektGopher\Whisky\Platform; use ProjektGopher\Whisky\Whisky; class Install extends Command @@ -13,9 +14,15 @@ class Install extends Command protected $description = 'Install git hooks'; + public function __construct( + public Platform $platform, + ) { + parent::__construct(); + } + public function handle(): int { - if (! $this->gitIsInitialized()) { + if ($this->platform->gitIsNotInitialized()) { $this->error('Git has not been initialized in this project, aborting...'); return Command::FAILURE; @@ -62,7 +69,7 @@ public function handle(): int } }); - if (! Whisky::isWindows()) { + if ($this->platform->isNotWindows()) { if ($this->option('verbose')) { $this->info('Verifying hooks are executable...'); } @@ -74,9 +81,4 @@ public function handle(): int return Command::SUCCESS; } - - private function gitIsInitialized(): bool - { - return File::exists(Whisky::cwd('.git')); - } }