diff --git a/lib/nimble_template/addons/variants/phoenix/gettext.ex b/lib/nimble_template/addons/variants/phoenix/gettext.ex index 2ed5bf56..6e6771a7 100644 --- a/lib/nimble_template/addons/variants/phoenix/gettext.ex +++ b/lib/nimble_template/addons/variants/phoenix/gettext.ex @@ -17,32 +17,6 @@ defmodule NimbleTemplate.Addons.Phoenix.Gettext do """, """ "gettext.extract-and-merge": ["gettext.extract --merge --no-fuzzy"], - "gettext.check": [ - "gettext.extract-and-merge", - ~S/cmd git diff --no-ext-diff --quiet priv\\/gettext || echo "The localization files POs, POTs are NOT up-to-date."/ - ], - """ - ) - - Generator.replace_content( - "mix.exs", - """ - "codebase.fix": [ - """, - """ - "codebase.fix": [ - "gettext.extract-and-merge", - """ - ) - - Generator.replace_content( - "mix.exs", - """ - codebase: [ - """, - """ - codebase: [ - "gettext.check", """ ) diff --git a/priv/templates/nimble_template/.github/workflows/test.yml.eex b/priv/templates/nimble_template/.github/workflows/test.yml.eex index 907deedd..6723132c 100644 --- a/priv/templates/nimble_template/.github/workflows/test.yml.eex +++ b/priv/templates/nimble_template/.github/workflows/test.yml.eex @@ -139,6 +139,15 @@ jobs: - name: Migrate database run: mix ecto.migrate + - name: Ensure that localization files (POs, POTs) are up-to-date. + run: + mix gettext.extract-and-merge; + + if [ -n "$(git diff --exit-code priv/gettext/)" ]; then + echo "The localization files (POs, POTs) are NOT up-to-date, run \"mix gettext.extract-and-merge\" on your local and push again."; + exit 1; + fi + - name: Run codebase check run: mix codebase diff --git a/test/nimble_template/addons/variants/gettext_test.exs b/test/nimble_template/addons/variants/gettext_test.exs index 35b197d2..e1743aa3 100644 --- a/test/nimble_template/addons/variants/gettext_test.exs +++ b/test/nimble_template/addons/variants/gettext_test.exs @@ -4,7 +4,7 @@ defmodule NimbleTemplate.Addons.Phoenix.GettextTest do describe "#apply/2" do @describetag required_addons: [:TestEnv] - test "injects gettext.extract-and-merge command to mix aliases and codebase.fix", %{ + test "injects gettext.extract-and-merge command to mix aliases", %{ project: project, test_project_path: test_project_path } do @@ -16,29 +16,6 @@ defmodule NimbleTemplate.Addons.Phoenix.GettextTest do "gettext.extract-and-merge": ["gettext.extract --merge --no-fuzzy"], """ end) - - assert_file("mix.exs", fn file -> - assert file =~ """ - "gettext.check": [ - "gettext.extract-and-merge", - ~S/cmd git diff --no-ext-diff --quiet priv\\/gettext || echo "The localization files POs, POTs are NOT up-to-date."/ - ], - """ - end) - - assert_file("mix.exs", fn file -> - assert file =~ """ - "codebase.fix": [ - "gettext.extract-and-merge", - """ - end) - - assert_file("mix.exs", fn file -> - assert file =~ """ - codebase: [ - "gettext.check", - """ - end) end) end end