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.