Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion installer/lib/phx_new/project.ex
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ defmodule Phx.New.Project do
def new(project_path, opts) do
project_path = Path.expand(project_path)
app = opts[:app] || Path.basename(project_path)

Comment thread
josevalim marked this conversation as resolved.
Outdated
app_mod = Module.concat([opts[:module] || Macro.camelize(app)])

%Project{
Expand Down Expand Up @@ -79,7 +80,10 @@ defmodule Phx.New.Project do

defp expand_path_with_bindings(path, %Project{} = project) do
Regex.replace(Regex.recompile!(~r/:[a-zA-Z0-9_]+/), path, fn ":" <> key, _ ->
project |> Map.fetch!(:"#{key}") |> to_string()
case Map.fetch(project, :"#{key}") do
{:ok, value} -> to_string(value)
:error -> ":#{key}"
end
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change seems to be unrelated? :)

Comment thread
josevalim marked this conversation as resolved.
Outdated
end)
end
end
12 changes: 12 additions & 0 deletions lib/phoenix/verified_routes.ex
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,18 @@ defmodule Phoenix.VerifiedRoutes do
defp build_route(route_ast, sigil_p, env, endpoint_ctx, router) do
config = Module.get_attribute(env.module, :phoenix_verified_config, [])

if config == [] do
Comment thread
josevalim marked this conversation as resolved.
Outdated
raise ArgumentError, """
attempted to use Phoenix.VerifiedRoutes without calling `use Phoenix.VerifiedRoutes` first.

You must use `use Phoenix.VerifiedRoutes` with the appropriate options instead of importing it:

use Phoenix.VerifiedRoutes, endpoint: MyAppWeb.Endpoint, router: MyAppWeb.Router

See the documentation for more details on configuration options.
"""
end

router =
case Macro.expand(router, env) do
mod when is_atom(mod) ->
Expand Down