Skip to content

Commit

Permalink
Support Phoenix 1.4 (#64)
Browse files Browse the repository at this point in the history
* Update Phoenix to 1.4.0

* Remove deprecated phoenix.* tasks

Phoenix.* tasks has been removed in Phoenix 1.4.

* Run formatter

* Update generated templates to use Routes module for path helpers
  • Loading branch information
scarfacedeb authored and doomspork committed Nov 28, 2018
1 parent 74a85f9 commit 99c7884
Show file tree
Hide file tree
Showing 23 changed files with 137 additions and 662 deletions.
4 changes: 4 additions & 0 deletions .formatter.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[
import_deps: [:phoenix],
inputs: ["*.{ex,exs}", "{config,lib,priv,test}/**/*.{ex,exs}"]
]
2 changes: 2 additions & 0 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ use Mix.Config
config :phoenix, :template_engines,
slim: PhoenixSlime.Engine,
slime: PhoenixSlime.Engine

config :phoenix, :json_library, Jason
185 changes: 0 additions & 185 deletions lib/mix/tasks/phoenix.gen.html.slime.ex

This file was deleted.

32 changes: 0 additions & 32 deletions lib/mix/tasks/phoenix.gen.layout.slime.ex

This file was deleted.

2 changes: 1 addition & 1 deletion lib/mix/tasks/phx.gen.layout.slime.ex
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ defmodule Mix.Tasks.Phx.Gen.Layout.Slime do

extension = PhoenixSlime.ConfiguredExtension.file_extension()

Mix.Phoenix.copy_from(slime_paths(), "priv/templates/phoenix.gen.layout.slime", binding, [
Mix.Phoenix.copy_from(slime_paths(), "priv/templates/phx.gen.layout.slime", binding, [
{:eex, "app.html.eex", "#{web_prefix}/templates/layout/app.html.#{extension}"}
])

Expand Down
27 changes: 16 additions & 11 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,31 @@ defmodule PhoenixSlime.Mixfile do
description: "Phoenix Template Engine for Slim-like templates",
elixir: "~> 1.4",
package: package(),
version: @version]
version: @version
]
end

def application do
[applications: [:phoenix, :slime]]
end

def deps do
[{:phoenix, "~> 1.3"},
{:phoenix_html, "~> 2.10"},
{:cowboy, "~> 1.0"},
{:slime, "~> 1.0"},
{:ex_doc, ">= 0.0.0", only: :dev},
{:earmark, ">= 0.0.0", only: :dev}]
[
{:phoenix, "~> 1.4"},
{:phoenix_html, "~> 2.10"},
{:jason, "~> 1.0", optional: true},
{:slime, "~> 1.0"},
{:ex_doc, ">= 0.0.0", only: :dev},
{:earmark, ">= 0.0.0", only: :dev}
]
end

defp package do
[maintainers: ["Sean Callan"],
files: ["lib", "priv", "mix.exs", "README*", "LICENSE*"],
licenses: ["MIT"],
links: %{github: "https://github.com/slime-lang/phoenix_slime"}]
[
maintainers: ["Sean Callan"],
files: ["lib", "priv", "mix.exs", "README*", "LICENSE*"],
licenses: ["MIT"],
links: %{github: "https://github.com/slime-lang/phoenix_slime"}
]
end
end
30 changes: 16 additions & 14 deletions mix.lock
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
%{"cowboy": {:hex, :cowboy, "1.1.2", "61ac29ea970389a88eca5a65601460162d370a70018afe6f949a29dca91f3bb0", [:rebar3], [{:cowlib, "~> 1.0.2", [hex: :cowlib, optional: false]}, {:ranch, "~> 1.3.2", [hex: :ranch, optional: false]}]},
"cowlib": {:hex, :cowlib, "1.0.2", "9d769a1d062c9c3ac753096f868ca121e2730b9a377de23dec0f7e08b1df84ee", [:make], []},
"earmark": {:hex, :earmark, "1.0.1", "2c2cd903bfdc3de3f189bd9a8d4569a075b88a8981ded9a0d95672f6e2b63141", [:mix], []},
"ex_doc": {:hex, :ex_doc, "0.13.2", "1059a588d2ad3ffab25a0b85c58abf08e437d3e7a9124ac255e1d15cec68ab79", [:mix], [{:earmark, "~> 1.0", [hex: :earmark, optional: false]}]},
"mime": {:hex, :mime, "1.1.0", "01c1d6f4083d8aa5c7b8c246ade95139620ef8effb009edde934e0ec3b28090a", [:mix], []},
"neotoma": {:hex, :neotoma, "1.7.3", "d8bd5404b73273989946e4f4f6d529e5c2088f5fa1ca790b4dbe81f4be408e61", [:rebar], []},
"phoenix": {:hex, :phoenix, "1.3.0", "1c01124caa1b4a7af46f2050ff11b267baa3edb441b45dbf243e979cd4c5891b", [:mix], [{:cowboy, "~> 1.0", [hex: :cowboy, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 1.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.3.3 or ~> 1.4", [hex: :plug, repo: "hexpm", optional: false]}, {:poison, "~> 2.2 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: false]}], "hexpm"},
"phoenix_html": {:hex, :phoenix_html, "2.10.3", "432dec9e04372eeb7a6dbf59a778cf43eb44518441932217371fa535f2bcfd80", [:mix], [{:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"},
"phoenix_pubsub": {:hex, :phoenix_pubsub, "1.0.2", "bfa7fd52788b5eaa09cb51ff9fcad1d9edfeb68251add458523f839392f034c1", [:mix], [], "hexpm"},
"plug": {:hex, :plug, "1.4.3", "236d77ce7bf3e3a2668dc0d32a9b6f1f9b1f05361019946aae49874904be4aed", [:mix], [{:cowboy, "~> 1.0.1 or ~> 1.1", [hex: :cowboy, repo: "hexpm", optional: true]}, {:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}], "hexpm"},
"poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], []},
"ranch": {:hex, :ranch, "1.3.2", "e4965a144dc9fbe70e5c077c65e73c57165416a901bd02ea899cfd95aa890986", [:rebar3], []},
"slim_fast": {:hex, :slim_fast, "0.6.0"},
"slime": {:hex, :slime, "1.0.0", "1566bf978cd7dc4043e1c6bd4beb03f94f586460920a1860e4cb30a5b6f3335d", [:mix], [{:neotoma, "~> 1.7", [hex: :neotoma, optional: false]}]}}
%{
"earmark": {:hex, :earmark, "1.2.6", "b6da42b3831458d3ecc57314dff3051b080b9b2be88c2e5aa41cd642a5b044ed", [:mix], [], "hexpm"},
"ex_doc": {:hex, :ex_doc, "0.19.1", "519bb9c19526ca51d326c060cb1778d4a9056b190086a8c6c115828eaccea6cf", [:mix], [{:earmark, "~> 1.1", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.7", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm"},
"jason": {:hex, :jason, "1.1.2", "b03dedea67a99223a2eaf9f1264ce37154564de899fd3d8b9a21b1a6fd64afe7", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm"},
"makeup": {:hex, :makeup, "0.5.5", "9e08dfc45280c5684d771ad58159f718a7b5788596099bdfb0284597d368a882", [:mix], [{:nimble_parsec, "~> 0.4", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm"},
"makeup_elixir": {:hex, :makeup_elixir, "0.10.0", "0f09c2ddf352887a956d84f8f7e702111122ca32fbbc84c2f0569b8b65cbf7fa", [:mix], [{:makeup, "~> 0.5.5", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm"},
"mime": {:hex, :mime, "1.3.0", "5e8d45a39e95c650900d03f897fbf99ae04f60ab1daa4a34c7a20a5151b7a5fe", [:mix], [], "hexpm"},
"neotoma": {:hex, :neotoma, "1.7.3", "d8bd5404b73273989946e4f4f6d529e5c2088f5fa1ca790b4dbe81f4be408e61", [:rebar], [], "hexpm"},
"nimble_parsec": {:hex, :nimble_parsec, "0.4.0", "ee261bb53214943679422be70f1658fff573c5d0b0a1ecd0f18738944f818efe", [:mix], [], "hexpm"},
"phoenix": {:hex, :phoenix, "1.4.0", "56fe9a809e0e735f3e3b9b31c1b749d4b436e466d8da627b8d82f90eaae714d2", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 1.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 1.0 or ~> 2.0", [hex: :plug_cowboy, repo: "hexpm", optional: true]}], "hexpm"},
"phoenix_html": {:hex, :phoenix_html, "2.12.0", "1fb3c2e48b4b66d75564d8d63df6d53655469216d6b553e7e14ced2b46f97622", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"},
"phoenix_pubsub": {:hex, :phoenix_pubsub, "1.1.1", "6668d787e602981f24f17a5fbb69cc98f8ab085114ebfac6cc36e10a90c8e93c", [:mix], [], "hexpm"},
"plug": {:hex, :plug, "1.7.1", "8516d565fb84a6a8b2ca722e74e2cd25ca0fc9d64f364ec9dbec09d33eb78ccd", [:mix], [{:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}], "hexpm"},
"plug_crypto": {:hex, :plug_crypto, "1.0.0", "18e49317d3fa343f24620ed22795ec29d4a5e602d52d1513ccea0b07d8ea7d4d", [:mix], [], "hexpm"},
"slime": {:hex, :slime, "1.2.0", "d46ede53c96b743dfdd23821268dc9b01f04ffea65d9d57c4e3d9200b162df02", [:mix], [{:neotoma, "~> 1.7", [hex: :neotoma, repo: "hexpm", optional: false]}], "hexpm"},
}
5 changes: 0 additions & 5 deletions priv/templates/phoenix.gen.html.slime/edit.html.eex

This file was deleted.

10 changes: 0 additions & 10 deletions priv/templates/phoenix.gen.html.slime/form.html.eex

This file was deleted.

19 changes: 0 additions & 19 deletions priv/templates/phoenix.gen.html.slime/index.html.eex

This file was deleted.

5 changes: 0 additions & 5 deletions priv/templates/phoenix.gen.html.slime/new.html.eex

This file was deleted.

10 changes: 0 additions & 10 deletions priv/templates/phoenix.gen.html.slime/show.html.eex

This file was deleted.

4 changes: 2 additions & 2 deletions priv/templates/phx.gen.html/edit.html.eex
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
h2 Edit <%= schema.human_singular %>

= render "form.html", Map.put(assigns, :action, <%= schema.route_helper %>_path(@conn, :update, @<%= schema.singular %>))
= render "form.html", Map.put(assigns, :action, Routes.<%= schema.route_helper %>_path(@conn, :update, @<%= schema.singular %>))

= link "Back", to: <%= schema.route_helper %>_path(@conn, :index)
= link "Back", to: Routes.<%= schema.route_helper %>_path(@conn, :index)
8 changes: 4 additions & 4 deletions priv/templates/phx.gen.html/index.html.eex
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ table.table
tr
<%= for {k, _} <- schema.attrs do %> td= <%= schema.singular %>.<%= k %>
<% end %> td class="text-right"
= link "Show", to: <%= schema.route_helper %>_path(@conn, :show, <%= schema.singular %>), class: "btn btn-default btn-xs"
= link "Show", to: Routes.<%= schema.route_helper %>_path(@conn, :show, <%= schema.singular %>), class: "btn btn-default btn-xs"
| &nbsp;
= link "Edit", to: <%= schema.route_helper %>_path(@conn, :edit, <%= schema.singular %>), class: "btn btn-default btn-xs"
= link "Edit", to: Routes.<%= schema.route_helper %>_path(@conn, :edit, <%= schema.singular %>), class: "btn btn-default btn-xs"
| &nbsp;
= link "Delete", to: <%= schema.route_helper %>_path(@conn, :delete, <%= schema.singular %>), method: :delete, data: [confirm: "Are you sure?"], class: "btn btn-danger btn-xs"
= link "Delete", to: Routes.<%= schema.route_helper %>_path(@conn, :delete, <%= schema.singular %>), method: :delete, data: [confirm: "Are you sure?"], class: "btn btn-danger btn-xs"

= link "New <%= schema.human_singular %>", to: <%= schema.route_helper %>_path(@conn, :new)
= link "New <%= schema.human_singular %>", to: Routes.<%= schema.route_helper %>_path(@conn, :new)
4 changes: 2 additions & 2 deletions priv/templates/phx.gen.html/new.html.eex
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
h2 New <%= schema.human_singular %>

= render "form.html", Map.put(assigns, :action, <%= schema.singular %>_path(@conn, :create))
= render "form.html", Map.put(assigns, :action, Routes.<%= schema.singular %>_path(@conn, :create))

= link "Back", to: <%= schema.route_helper %>_path(@conn, :index)
= link "Back", to: Routes.<%= schema.route_helper %>_path(@conn, :index)
Loading

0 comments on commit 99c7884

Please sign in to comment.