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

Don't create README.md on cleanup #139

Merged
merged 1 commit into from
Apr 7, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions src/Symfony/Installer/NewCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
->download()
->extract()
->cleanUp()
->dumpReadmeFile()
->updateParameters()
->updateComposerJson()
->createGitIgnore()
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down