Skip to content

Commit

Permalink
Loadpaths in cascade.help
Browse files Browse the repository at this point in the history
Closes #1
  • Loading branch information
pnezis committed Jun 28, 2024
1 parent 630d02b commit 6e8572c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions cascade/lib/mix/tasks/cascade.help.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ defmodule Mix.Tasks.Cascade.Help do

@impl Mix.Task
def run([]) do
loadpaths!()

Mix.shell().info("The following templates are available:")
Mix.shell().info("")
list_templates()
Expand Down Expand Up @@ -42,6 +44,8 @@ defmodule Mix.Tasks.Cascade.Help do
end

def run([template]) do
loadpaths!()

templates = Cascade.templates()

case templates[String.to_atom(template)] do
Expand All @@ -65,6 +69,14 @@ defmodule Mix.Tasks.Cascade.Help do
)
end

# Loadpaths without checks because templates may be defined in deps.
defp loadpaths! do
args = ["--no-elixir-version-check", "--no-deps-check", "--no-archives-check"]
Mix.Task.run("loadpaths", args)
Mix.Task.reenable("loadpaths")
Mix.Task.reenable("deps.loadpaths")
end

defp list_templates do
templates =
Cascade.templates()
Expand Down
2 changes: 1 addition & 1 deletion cascade/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ defmodule Cascade.MixProject do

# Tests
test_coverage: [
threshold: 100,
threshold: 95,
export: "cascade",
output: "../artifacts/coverdata/cascade"
],
Expand Down

0 comments on commit 6e8572c

Please sign in to comment.