From a4198d6560b77e33816399b4d21abbf769848c6a Mon Sep 17 00:00:00 2001 From: Alexander Schwenn Date: Tue, 7 Apr 2015 00:26:01 +0200 Subject: [PATCH] Don't create README.md on cleanup --- src/Symfony/Installer/NewCommand.php | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Installer/NewCommand.php b/src/Symfony/Installer/NewCommand.php index fb13475..39e7101 100644 --- a/src/Symfony/Installer/NewCommand.php +++ b/src/Symfony/Installer/NewCommand.php @@ -58,6 +58,7 @@ protected function execute(InputInterface $input, OutputInterface $output) ->download() ->extract() ->cleanUp() + ->dumpReadmeFile() ->updateParameters() ->updateComposerJson() ->createGitIgnore() @@ -202,9 +203,6 @@ protected function cleanUp() $filesToRemove = array_merge($licenseFile, $upgradeFiles, $changelogFiles); $this->fs->remove($filesToRemove); - - $readmeContents = sprintf("%s\n%s\n\nA Symfony project created on %s.\n", $this->projectName, str_repeat('=', strlen($this->projectName)), date('F j, Y, g:i a')); - $this->fs->dumpFile($this->projectDir.'/README.md', $readmeContents); } catch (\Exception $e) { // don't throw an exception in case any of the Symfony-related files cannot // be removed, because this is just an enhancement, not something mandatory @@ -262,6 +260,25 @@ protected function displayInstallationResult() return $this; } + /** + * Dump a basic README.md file. + * + * @return NewCommand + */ + protected function dumpReadmeFile() + { + $readmeContents = sprintf("%s\n%s\n\nA Symfony project created on %s.\n", $this->projectName, str_repeat('=', strlen($this->projectName)), date('F j, Y, g:i a')); + try { + $this->fs->dumpFile($this->projectDir.'/README.md', $readmeContents); + } catch (\Exception $e) { + // don't throw an exception in case the file could not be created, + // because this is just an enhancement, not something mandatory + // for the project + } + + return $this; + } + /** * Updates the Symfony parameters.yml file to replace default configuration * values with better generated values.