diff --git a/composer.json b/composer.json index 4fec6111..1b07209b 100644 --- a/composer.json +++ b/composer.json @@ -15,9 +15,9 @@ ], "require": { "php": "^8.0", - "illuminate/console": "^9.0|^10.0|^11.0", - "illuminate/contracts": "^9.0|^10.0|^11.0", - "illuminate/support": "^9.0|^10.0|^11.0", + "illuminate/console": "^9.52.16|^10.0|^11.0", + "illuminate/contracts": "^9.52.16|^10.0|^11.0", + "illuminate/support": "^9.52.16|^10.0|^11.0", "symfony/yaml": "^6.0|^7.0" }, "bin": [ diff --git a/src/Console/AddCommand.php b/src/Console/AddCommand.php index ac88c598..09a0ab86 100644 --- a/src/Console/AddCommand.php +++ b/src/Console/AddCommand.php @@ -41,7 +41,7 @@ public function handle() } if ($invalidServices = array_diff($services, $this->services)) { - $this->error('Invalid services ['.implode(',', $invalidServices).'].'); + $this->components->error('Invalid services ['.implode(',', $invalidServices).'].'); return 1; } @@ -50,8 +50,9 @@ public function handle() $this->replaceEnvVariables($services); $this->configurePhpUnit(); - $this->info('Additional Sail services installed successfully.'); - $this->prepareInstallation($services); + + $this->output->writeln(''); + $this->components->info('Additional Sail services installed successfully.'); } } diff --git a/src/Console/Concerns/InteractsWithDockerComposeServices.php b/src/Console/Concerns/InteractsWithDockerComposeServices.php index 51ac7aa1..d1e193eb 100644 --- a/src/Console/Concerns/InteractsWithDockerComposeServices.php +++ b/src/Console/Concerns/InteractsWithDockerComposeServices.php @@ -248,22 +248,14 @@ protected function prepareInstallation($services) } if (count($services) > 0) { - $status = $this->runCommands([ + $this->runCommands([ './vendor/bin/sail pull '.implode(' ', $services), ]); - - if ($status === 0) { - $this->info('Sail images installed successfully.'); - } } - $status = $this->runCommands([ + $this->runCommands([ './vendor/bin/sail build', ]); - - if ($status === 0) { - $this->info('Sail build successful.'); - } } /** diff --git a/src/Console/InstallCommand.php b/src/Console/InstallCommand.php index 87ca9847..d93b96ea 100644 --- a/src/Console/InstallCommand.php +++ b/src/Console/InstallCommand.php @@ -42,7 +42,7 @@ public function handle() } if ($invalidServices = array_diff($services, $this->services)) { - $this->error('Invalid services ['.implode(',', $invalidServices).'].'); + $this->components->error('Invalid services ['.implode(',', $invalidServices).'].'); return 1; } @@ -55,8 +55,21 @@ public function handle() $this->installDevContainer(); } - $this->info('Sail scaffolding installed successfully.'); - $this->prepareInstallation($services); + + $this->output->writeln(''); + $this->components->info('Sail scaffolding installed successfully. Initiate Docker containers using Sail\'s "up" command.'); + + $this->output->writeln('./vendor/bin/sail up'); + + if (in_array('mysql', $services) || + in_array('mariadb', $services) || + in_array('pgsql', $services)) { + $this->components->warn('A database service was installed. Run "artisan migrate" to prepare your database:'); + + $this->output->writeln('./vendor/bin/sail artisan migrate'); + } + + $this->output->writeln(''); } }