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