Skip to content
This repository was archived by the owner on Nov 14, 2019. It is now read-only.

Commit ac42f19

Browse files
committed
Added more information about project installed
1 parent e0b7ebf commit ac42f19

File tree

1 file changed

+35
-2
lines changed

1 file changed

+35
-2
lines changed

src/Symfony/Installer/NewCommand.php

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
use Symfony\Component\Console\Input\InputInterface;
1414
use Symfony\Component\Console\Output\OutputInterface;
1515
use Symfony\Component\Filesystem\Filesystem;
16+
use Symfony\Component\Process\PhpExecutableFinder;
17+
use Symfony\Component\Process\Process;
1618

1719
/**
1820
* This command creates new Symfony projects for the given Symfony version.
@@ -293,9 +295,20 @@ private function cleanUp()
293295
private function displayInstallationResult()
294296
{
295297
if (empty($this->requirementsErrors)) {
298+
$versionInstalled = $this->getInstalledProjectVersion();
299+
$folderInstalled = $this->getProjectFolder();
300+
$tick = defined('PHP_WINDOWS_VERSION_BUILD') ? 'OK' : '';
301+
296302
$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
299312
));
300313
} else {
301314
$this->output->writeln(sprintf(
@@ -378,4 +391,24 @@ private function getErrorMessage(\Requirement $requirement, $lineSize = 70)
378391

379392
return $errorMessage;
380393
}
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+
}
381414
}

0 commit comments

Comments
 (0)