|
13 | 13 | use Symfony\Component\Console\Input\InputInterface;
|
14 | 14 | use Symfony\Component\Console\Output\OutputInterface;
|
15 | 15 | use Symfony\Component\Filesystem\Filesystem;
|
| 16 | +use Symfony\Component\Process\Process; |
16 | 17 |
|
17 | 18 | /**
|
18 | 19 | * This command creates new Symfony projects for the given Symfony version.
|
@@ -293,9 +294,20 @@ private function cleanUp()
|
293 | 294 | private function displayInstallationResult()
|
294 | 295 | {
|
295 | 296 | if (empty($this->requirementsErrors)) {
|
| 297 | + $versionInstalled = $this->getInstalledProjectVersion(); |
| 298 | + $folderInstalled = $this->getProjectFolder(); |
| 299 | + $tick = defined('PHP_WINDOWS_VERSION_BUILD') ? 'OK' : '✔'; |
| 300 | + |
296 | 301 | $this->output->writeln(sprintf(
|
297 |
| - " <info>%s</info> Symfony was <info>successfully installed</info>. Now you can:\n", |
298 |
| - defined('PHP_WINDOWS_VERSION_BUILD') ? 'OK' : '✔' |
| 302 | + " <info>%s</info> Symfony was <info>successfully installed</info>.\n". |
| 303 | + " <info>%s</info> Your new project is using <info>%s</info>.\n". |
| 304 | + " <info>%s</info> Your project is here: <comment>%s</comment>.\n\n". |
| 305 | + " Now you can:", |
| 306 | + $tick, |
| 307 | + $tick, |
| 308 | + $versionInstalled, |
| 309 | + $tick, |
| 310 | + $folderInstalled |
299 | 311 | ));
|
300 | 312 | } else {
|
301 | 313 | $this->output->writeln(sprintf(
|
@@ -378,4 +390,28 @@ private function getErrorMessage(\Requirement $requirement, $lineSize = 70)
|
378 | 390 |
|
379 | 391 | return $errorMessage;
|
380 | 392 | }
|
| 393 | + |
| 394 | + private function getInstalledProjectVersion() |
| 395 | + { |
| 396 | + $getVersion = new Process('./'.$this->projectName.'/app/console --version'); |
| 397 | + $getVersion->run(); |
| 398 | + |
| 399 | + if (!$getVersion->isSuccessful()) { |
| 400 | + throw new \RuntimeException($getVersion->getErrorOutput()); |
| 401 | + } |
| 402 | + |
| 403 | + return substr($getVersion->getOutput(), 0, strlen($getVersion->getOutput())-17); |
| 404 | + } |
| 405 | + |
| 406 | + private function getProjectFolder() |
| 407 | + { |
| 408 | + $process = new Process('pwd'); |
| 409 | + $process->run(); |
| 410 | + |
| 411 | + if (!$process->isSuccessful()) { |
| 412 | + throw new \RuntimeException($process->getErrorOutput()); |
| 413 | + } |
| 414 | + |
| 415 | + return str_replace("\n", '', $process->getOutput().'/'.$this->projectName); |
| 416 | + } |
381 | 417 | }
|
0 commit comments