From 8c10e2017a3a689b0b89193862ec04f320a2a7d4 Mon Sep 17 00:00:00 2001 From: Daniel Morris Date: Sun, 30 Nov 2014 13:04:55 +0000 Subject: [PATCH] Create the .gitignore file as part of the installation --- src/Symfony/Installer/NewCommand.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/Symfony/Installer/NewCommand.php b/src/Symfony/Installer/NewCommand.php index b2aa287..e886a7a 100755 --- a/src/Symfony/Installer/NewCommand.php +++ b/src/Symfony/Installer/NewCommand.php @@ -61,6 +61,7 @@ protected function execute(InputInterface $input, OutputInterface $output) ->checkSymfonyVersionIsInstallable() ->download() ->extract() + ->createGitIgnore() ->cleanUp() ->checkSymfonyRequirements() ->displayInstallationResult() @@ -275,6 +276,33 @@ private function extract() return $this; } + /** + * Creates the .gitignore file. + */ + private function createGitIgnore() + { + $ignored = array( + '/web/bundles/', + '/app/bootstrap.php.cache', + '/app/cache/*', + '/app/config/parameters.yml', + '/app/logs/*', + '!app/cache/.gitkeep', + '!app/logs/.gitkeep', + '/app/phpunit.xml', + '/build/', + '/vendor/', + '/bin/', + ); + + $this->fs->dumpFile( + $this->projectDir.DIRECTORY_SEPARATOR.'.gitignore', + implode(PHP_EOL, $ignored).PHP_EOL + ); + + return $this; + } + /** * Removes all the temporary files and directories created to * download and extract Symfony.