Update gitignore templates to match Elixir upstream - #6780
Conversation
Match Elixir upstream .gitignore template changes: - Update "3rd-party" to "third-party" in documentation comments (elixir-lang/elixir#8308) - Remove deprecated /.fetch entry and comment (elixir-lang/elixir#13871) - Move /tmp/ entry to appear above erl_crash.dump (elixir-lang/elixir#14439) Also improve template tag placement in EEx conditional blocks to prevent extra double newlines and trailing whitespace in generated .gitignore files, and update installer tests to assert single trailing newlines without consecutive blank lines (elixir-lang/elixir#15710, elixir-lang/elixir#15711).
| refute file =~ "\n\n\n" | ||
| end) | ||
|
|
||
| assert_file("phx_blog/.gitignore") |
| end) | ||
|
|
||
| assert_file("phx_blog/.gitignore") | ||
| assert_file("phx_blog/.gitignore", ~r/\n$/) |
There was a problem hiding this comment.
Asserted ending in newline, but not single newline.
Now a single assert_file call asserts single newline and no double blank lines.
| in_tmp("new with no_assets", fn -> | ||
| Mix.Tasks.Phx.New.run([@app, "--umbrella", "--no-assets"]) | ||
|
|
||
| refute File.read!(web_path(@app, ".gitignore")) |> String.contains?("/priv/static/assets/") |
There was a problem hiding this comment.
Should have used the assert_file helper. Now .gitignore is read only once as part of the test.
| assert String.ends_with?(file, "\n") | ||
| refute String.ends_with?(file, "\n\n") | ||
| refute file =~ "\n\n\n" |
There was a problem hiding this comment.
Having to repeat this in multiple places is quite tedious and error prone.
I have an alternative that I'll propose in a separate PR, perhaps an opportunity to test GitHub's new stacked PRs feature :)
There was a problem hiding this comment.
Oh I think stacks won't work from a fork... https://docs.github.com/en/pull-requests/how-tos/merge-and-close-pull-requests/troubleshooting-stacked-pull-requests#you-cant-create-a-stack-across-forks. The gh CLI failed to submit the second PR as a stack anyway.
There was a problem hiding this comment.
Sent as #6781. I'll rebase one or the other as needed.
Match Elixir upstream .gitignore template changes:
mix newtask elixir-lang/elixir#14439)Also improve template tag placement in EEx conditional blocks to prevent extra double newlines and trailing whitespace in generated .gitignore files, and update installer tests to assert single trailing newlines without consecutive blank lines (elixir-lang/elixir#15710, elixir-lang/elixir#15711).