Skip to content

Commit 7e01b34

Browse files
[1.x] Improves console output (#661)
* Improves sail console output * Update InstallCommand.php --------- Co-authored-by: Taylor Otwell <taylor@laravel.com>
1 parent 9f8314a commit 7e01b34

File tree

4 files changed

+25
-19
lines changed

4 files changed

+25
-19
lines changed

composer.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
],
1616
"require": {
1717
"php": "^8.0",
18-
"illuminate/console": "^9.0|^10.0|^11.0",
19-
"illuminate/contracts": "^9.0|^10.0|^11.0",
20-
"illuminate/support": "^9.0|^10.0|^11.0",
18+
"illuminate/console": "^9.52.16|^10.0|^11.0",
19+
"illuminate/contracts": "^9.52.16|^10.0|^11.0",
20+
"illuminate/support": "^9.52.16|^10.0|^11.0",
2121
"symfony/yaml": "^6.0|^7.0"
2222
},
2323
"bin": [

src/Console/AddCommand.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function handle()
4141
}
4242

4343
if ($invalidServices = array_diff($services, $this->services)) {
44-
$this->error('Invalid services ['.implode(',', $invalidServices).'].');
44+
$this->components->error('Invalid services ['.implode(',', $invalidServices).'].');
4545

4646
return 1;
4747
}
@@ -50,8 +50,9 @@ public function handle()
5050
$this->replaceEnvVariables($services);
5151
$this->configurePhpUnit();
5252

53-
$this->info('Additional Sail services installed successfully.');
54-
5553
$this->prepareInstallation($services);
54+
55+
$this->output->writeln('');
56+
$this->components->info('Additional Sail services installed successfully.');
5657
}
5758
}

src/Console/Concerns/InteractsWithDockerComposeServices.php

+2-10
Original file line numberDiff line numberDiff line change
@@ -248,22 +248,14 @@ protected function prepareInstallation($services)
248248
}
249249

250250
if (count($services) > 0) {
251-
$status = $this->runCommands([
251+
$this->runCommands([
252252
'./vendor/bin/sail pull '.implode(' ', $services),
253253
]);
254-
255-
if ($status === 0) {
256-
$this->info('Sail images installed successfully.');
257-
}
258254
}
259255

260-
$status = $this->runCommands([
256+
$this->runCommands([
261257
'./vendor/bin/sail build',
262258
]);
263-
264-
if ($status === 0) {
265-
$this->info('Sail build successful.');
266-
}
267259
}
268260

269261
/**

src/Console/InstallCommand.php

+16-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function handle()
4242
}
4343

4444
if ($invalidServices = array_diff($services, $this->services)) {
45-
$this->error('Invalid services ['.implode(',', $invalidServices).'].');
45+
$this->components->error('Invalid services ['.implode(',', $invalidServices).'].');
4646

4747
return 1;
4848
}
@@ -55,8 +55,21 @@ public function handle()
5555
$this->installDevContainer();
5656
}
5757

58-
$this->info('Sail scaffolding installed successfully.');
59-
6058
$this->prepareInstallation($services);
59+
60+
$this->output->writeln('');
61+
$this->components->info('Sail scaffolding installed successfully. You may run your Docker containers using Sail\'s "up" command.');
62+
63+
$this->output->writeln('<fg=gray>➜</> <options=bold>./vendor/bin/sail up</>');
64+
65+
if (in_array('mysql', $services) ||
66+
in_array('mariadb', $services) ||
67+
in_array('pgsql', $services)) {
68+
$this->components->warn('A database service was installed. Run "artisan migrate" to prepare your database:');
69+
70+
$this->output->writeln('<fg=gray>➜</> <options=bold>./vendor/bin/sail artisan migrate</>');
71+
}
72+
73+
$this->output->writeln('');
6174
}
6275
}

0 commit comments

Comments
 (0)