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

Commit b028beb

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

File tree

1 file changed

+38
-2
lines changed

1 file changed

+38
-2
lines changed

src/Symfony/Installer/NewCommand.php

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
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\Process;
1617

1718
/**
1819
* This command creates new Symfony projects for the given Symfony version.
@@ -293,9 +294,20 @@ private function cleanUp()
293294
private function displayInstallationResult()
294295
{
295296
if (empty($this->requirementsErrors)) {
297+
$versionInstalled = $this->getInstalledProjectVersion();
298+
$folderInstalled = $this->getProjectFolder();
299+
$tick = defined('PHP_WINDOWS_VERSION_BUILD') ? 'OK' : '';
300+
296301
$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
299311
));
300312
} else {
301313
$this->output->writeln(sprintf(
@@ -378,4 +390,28 @@ private function getErrorMessage(\Requirement $requirement, $lineSize = 70)
378390

379391
return $errorMessage;
380392
}
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+
}
381417
}

0 commit comments

Comments
 (0)