audreyr/cookiecutter — pull request #183 by treyhunner (2014-06-08 21:29:19+00:00)
Title: Properly maintain newlines at end of files

Currently cookiecutter has a major bug: all newlines at the ends of files are stripped. This bug makes tools like pep8 and flake8 angry.

There are already two other pull requests that attempt to fix this bug: #79 and #135. Here are the problems with the existing pull requests:

- Pull request #79 introduces a new bug by *always* adding newlines to the ends of files.
- Pull request #135 requires that users of cookiecutter decide whether newlines should be maintained.

This pull request causes cookiecutter to:

- Generate files with final newline(s) when the source files had newline(s)
- Generate files without final newline(s) when the source files did not have final newline(s)

This is technically a backwards-incompatible change because it fixes a bug in functionality. I doubt existing users will be disappointed by this new behavior because files that are not expected to have final newlines probably already lack final newlines in the source template.