Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.x] Improves console output #661

Merged
merged 2 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
7 changes: 4 additions & 3 deletions src/Console/AddCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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.');
}
}
12 changes: 2 additions & 10 deletions src/Console/Concerns/InteractsWithDockerComposeServices.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
}
}

/**
Expand Down
19 changes: 16 additions & 3 deletions src/Console/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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. You may run your Docker containers using Sail\'s "up" command.');

$this->output->writeln('<fg=gray>➜</> <options=bold>./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('<fg=gray>➜</> <options=bold>./vendor/bin/sail artisan migrate</>');
}

$this->output->writeln('');
}
}
Loading