Ensure optional Phoenix is optional (#39)
This commit is contained in:
parent
9aea707fcc
commit
3e3f4480fa
2 changed files with 221 additions and 211 deletions
|
@ -1,4 +1,5 @@
|
|||
defmodule Mix.Tasks.Temple.Gen.Html do
|
||||
if Code.ensure_loaded?(Mix.Phoenix) do
|
||||
defmodule Mix.Tasks.Temple.Gen.Html do
|
||||
@shortdoc "Generates controller, views, and context for an HTML resource in Temple"
|
||||
|
||||
@moduledoc """
|
||||
|
@ -153,9 +154,15 @@ defmodule Mix.Tasks.Temple.Gen.Html do
|
|||
Path.join([web_prefix, "templates", web_path, schema.singular, "new.html.exs"])},
|
||||
{:eex, "show.html.exs",
|
||||
Path.join([web_prefix, "templates", web_path, schema.singular, "show.html.exs"])},
|
||||
{:eex, "view.ex", Path.join([web_prefix, "views", web_path, "#{schema.singular}_view.ex"])},
|
||||
{:eex, "view.ex",
|
||||
Path.join([web_prefix, "views", web_path, "#{schema.singular}_view.ex"])},
|
||||
{:eex, "controller_test.exs",
|
||||
Path.join([test_prefix, "controllers", web_path, "#{schema.singular}_controller_test.exs"])}
|
||||
Path.join([
|
||||
test_prefix,
|
||||
"controllers",
|
||||
web_path,
|
||||
"#{schema.singular}_controller_test.exs"
|
||||
])}
|
||||
]
|
||||
end
|
||||
|
||||
|
@ -252,4 +259,5 @@ defmodule Mix.Tasks.Temple.Gen.Html do
|
|||
defp error(field) do
|
||||
~s{partial error_tag(form, #{inspect(field)})}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
defmodule Mix.Tasks.Temple.Gen.Layout do
|
||||
if Code.ensure_loaded?(Mix.Phoenix) do
|
||||
defmodule Mix.Tasks.Temple.Gen.Layout do
|
||||
use Mix.Task
|
||||
|
||||
@shortdoc "Generates a default Phoenix layout file in Temple"
|
||||
|
@ -26,4 +27,5 @@ defmodule Mix.Tasks.Temple.Gen.Layout do
|
|||
defp temple_paths do
|
||||
[".", :temple]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Reference in a new issue