Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove extra newline in errors.pot from installer template #5657

Merged
merged 1 commit into from
Dec 19, 2023

Conversation

rhcarvalho
Copy link
Contributor

After creating a new project, running mix gettext.extract --merge would remove that line anyway, causing an unnecessary change.

Related to #5649.

After creating a new project, running `mix gettext.extract --merge`
would remove that line anyway, causing an unnecessary change.
@rhcarvalho
Copy link
Contributor Author

I tried writing a test for this but was not successful.

Specifically, I changed test "new with defaults" in installer/test/phx_new_test.exs. I wanted to add a step to run mix gettext.extract --merge or mix gettext.extract --check-up-to-date, but was not able to get things to work.

Snapshot of some things I tried
      # ...

      # Gettext
      assert_file("phx_blog/lib/phx_blog_web/gettext.ex", ~r"defmodule PhxBlogWeb.Gettext")
      assert File.exists?("phx_blog/priv/gettext/errors.pot")
      assert File.exists?("phx_blog/priv/gettext/en/LC_MESSAGES/errors.po")

      Mix.Project.in_project(:phx_blog, "phx_blog", fn _module ->
        Mix.Tasks.Deps.Get.run(~w(--only dev))
        # Mix.Task.run("gettext.extract", ["--check-up-to-date"])
      end)

      # generated_errors_pot = File.read!("phx_blog/priv/gettext/errors.pot")
      # Mix.Tasks.Gettext.Extract.run(["--merge"])
      # assert generated_errors_pot == File.read!("phx_blog/priv/gettext/errors.pot")

Those tasks would require deps to be fetched, but that might be undesirable, as it would make the tests slower, dependent on network and possibly flaky.

It also seems wrong to require mix gettext.extract --check-up-to-date to pass. I think it is okay to require a first call to mix gettext.extract --merge to update gettext files after the project is generated.

@josevalim josevalim merged commit 97d0923 into phoenixframework:main Dec 19, 2023
4 checks passed
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

agonzalezro pushed a commit to agonzalezro/phoenix that referenced this pull request Dec 30, 2023
…amework#5657)

After creating a new project, running `mix gettext.extract --merge`
would remove that line anyway, causing an unnecessary change.
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.

2 participants