Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
3 changes: 1 addition & 2 deletions lib/mix/mix_utils.ex
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ defmodule Coherence.Mix.Utils do
unless unknown == [] do
opts =
unknown
|> Enum.map(&elem(&1, 0))
|> Enum.join(", ")
|> Enum.map_join(", ", &elem(&1, 0))

Mix.raise("""
Invalid argument(s) #{opts}
Expand Down
9 changes: 5 additions & 4 deletions lib/mix/tasks/coh.gen.controllers.ex
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,12 @@ defmodule Mix.Tasks.Coh.Gen.Controllers do

def do_default_opts(config, opts) do
@default_booleans
|> Enum.map(&String.to_atom/1)
|> Enum.reduce(config, fn opt, config ->
value = if opts[opt] == false, do: false, else: true
Map.put(config, opt, value)
|> Enum.map_reduce(config, fn
opt_string, config ->
opt = String.to_atom(opt_string)
{opt, Map.put(config, opt, opt in opts)}
end)
|> elem(1)
end

defp paths do
Expand Down
10 changes: 4 additions & 6 deletions lib/mix/tasks/coh.install.ex
Original file line number Diff line number Diff line change
Expand Up @@ -568,13 +568,11 @@ defmodule Mix.Tasks.Coh.Install do
adds =
field_list
|> add_timestamp(config)
|> Enum.map(&(" " <> &1))
|> Enum.join("\n")
|> Enum.map_join("\n", &(" " <> &1))

constraints =
constraints
|> Enum.map(&(" " <> &1))
|> Enum.join("\n")
|> Enum.map_join("\n", &(" " <> &1))

statement =
case verb do
Expand Down Expand Up @@ -1315,8 +1313,8 @@ defmodule Mix.Tasks.Coh.Install do

opts_names = Enum.map(opts, &elem(&1, 0))

with [] <- Enum.filter(opts_bin, &(not (&1 in @switch_names))),
[] <- Enum.filter(opts_names, &(not (&1 in @switch_names))) do
with [] <- Enum.filter(opts_bin, &(&1 not in @switch_names)),
[] <- Enum.filter(opts_names, &(&1 not in @switch_names)) do
{opts_bin, opts}
else
list -> raise_option_errors(list)
Expand Down
2 changes: 1 addition & 1 deletion test/mix_helpers.exs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ defmodule MixHelper do
is_list(match) ->
assert_file(file, &Enum.each(match, fn m -> assert &1 =~ m end))

is_binary(match) or Regex.regex?(match) ->
is_binary(match) or is_struct(match, Regex) ->
assert_file(file, &assert(&1 =~ match))

is_function(match, 1) ->
Expand Down
2 changes: 1 addition & 1 deletion test/view_helpers_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ defmodule CoherenceTestWeb.ViewHelpers do
{:ok, conn: conn, user: user}
end

@helpers Module.concat(Application.get_env(:coherence, :web_module), Router.Helpers)
@helpers Module.concat(Application.compile_env(:coherence, :web_module), Router.Helpers)

test "coherence_path", %{conn: conn} do
assert ViewHelpers.coherence_path(@helpers, :unlock_path, conn, :new) == "/unlocks/new"
Expand Down