Skip to content

Update gitignore templates to match Elixir upstream - #6780

Open
rhcarvalho wants to merge 1 commit into
phoenixframework:mainfrom
praialabs:update-gitignore-templates
Open

Update gitignore templates to match Elixir upstream#6780
rhcarvalho wants to merge 1 commit into
phoenixframework:mainfrom
praialabs:update-gitignore-templates

Conversation

@rhcarvalho

Copy link
Copy Markdown
Contributor

Match Elixir upstream .gitignore template changes:

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).

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")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was redundant.

end)

assert_file("phx_blog/.gitignore")
assert_file("phx_blog/.gitignore", ~r/\n$/)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should have used the assert_file helper. Now .gitignore is read only once as part of the test.

Comment on lines +150 to +152
assert String.ends_with?(file, "\n")
refute String.ends_with?(file, "\n\n")
refute file =~ "\n\n\n"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sent as #6781. I'll rebase one or the other as needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant