Skip to content

Commit

Permalink
Fixed #36
Browse files Browse the repository at this point in the history
  • Loading branch information
grych committed Aug 8, 2017
1 parent 0f74355 commit 4034b77
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/mix/tasks/drab.gen.commander.ex
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ defmodule Mix.Tasks.Drab.Gen.Commander do
Mix.Phoenix.check_module_name_availability!(binding[:module] <> "Commander")
check_controller_existence!(path, binding[:module])

Mix.Phoenix.copy_from paths(), "priv/templates/drab/", "", binding, [
copy_from paths(), "priv/templates/drab/", binding, [
{:eex, "drab.gen.commander.ex.eex", "web/commanders/#{path}_commander.ex"}
]

Expand Down Expand Up @@ -54,4 +54,15 @@ defmodule Mix.Tasks.Drab.Gen.Commander do
defp paths do
[".", :drab]
end

if Regex.match?(~r/^1.2/, Application.spec(:phoenix, :vsn) |> to_string()) do
defp copy_from(paths, source_path, binding, mapping) do
Mix.Phoenix.copy_from paths, source_path, "", binding, mapping
end
else
defp copy_from(paths, source_path, binding, mapping) do
Mix.Phoenix.copy_from paths, source_path, binding, mapping
end
end

end

0 comments on commit 4034b77

Please sign in to comment.