summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Chvanikov <chvanikoff@pm.me>2020-07-27 16:23:16 +0300
committerRoman Chvanikov <chvanikoff@pm.me>2020-07-27 16:23:16 +0300
commit211ab00aeb7462a7f4f831d446c4b1ce779d1b1c (patch)
tree07d881dbcfaa52b56f6d3e32028cd7bb472eceea
parenta83a855b42683c59d937c8a8b684169625b3e754 (diff)
Handle empty configs in install-all
-rw-r--r--lib/mix/tasks/pleroma/frontend.ex9
-rw-r--r--test/tasks/frontend_test.exs7
2 files changed, 11 insertions, 5 deletions
diff --git a/lib/mix/tasks/pleroma/frontend.ex b/lib/mix/tasks/pleroma/frontend.ex
index 7ddd9360a..865daf3bb 100644
--- a/lib/mix/tasks/pleroma/frontend.ex
+++ b/lib/mix/tasks/pleroma/frontend.ex
@@ -35,18 +35,17 @@ defmodule Mix.Tasks.Pleroma.Frontend do
configs = Pleroma.Config.get(:frontends, %{})
- with config <- configs[:primary],
- frontend <- config["name"],
+ with config when not is_nil(config) <- configs[:primary],
ref when ref != "none" <- config["ref"] do
- run(["install", frontend, "--ref", ref])
+ run(["install", config["name"], "--ref", ref])
end
- with config <- configs[:mastodon],
+ with config when not is_nil(config) <- configs[:mastodon],
ref when ref != "none" <- config["ref"] do
run(["install", "mastodon", "--ref", ref])
end
- with config <- configs[:admin],
+ with config when not is_nil(config) <- configs[:admin],
ref when ref != "none" <- config["ref"] do
run(["install", "admin", "--ref", ref])
end
diff --git a/test/tasks/frontend_test.exs b/test/tasks/frontend_test.exs
index 6c67255e5..f2893b725 100644
--- a/test/tasks/frontend_test.exs
+++ b/test/tasks/frontend_test.exs
@@ -134,5 +134,12 @@ defmodule Mix.Tasks.Pleroma.FrontendTest do
assert {:ok, []} == File.ls(@dir)
end
+
+ test "Missing configs" do
+ clear_config(:frontends, [])
+ Mix.Tasks.Pleroma.Frontend.run(["install", "all"])
+
+ assert {:ok, []} == File.ls(@dir)
+ end
end
end