refactoring
authorAlex S <alex.strizhakov@gmail.com>
Tue, 3 Sep 2019 17:11:32 +0000 (20:11 +0300)
committerAlex S <alex.strizhakov@gmail.com>
Wed, 11 Sep 2019 06:25:33 +0000 (09:25 +0300)
lib/mix/tasks/pleroma/docs.ex

index 4be53ce7553815ebf9b7beb329b1e3819a9ceb2d..0d2663648de4463d9b564bb7f29f9cc919d37362 100644 (file)
@@ -27,16 +27,16 @@ defmodule Mix.Tasks.Pleroma.Docs do
 
   defp do_run(implementation) do
     start_pleroma()
-    {descriptions, _paths} = Mix.Config.eval!("config/description.exs")
 
-    {:ok, file_path} =
-      Pleroma.Docs.Generator.process(
-        implementation,
-        descriptions[:pleroma][:config_description]
-      )
+    with {descriptions, _paths} <- Mix.Config.eval!("config/description.exs"),
+         {:ok, file_path} <-
+           Pleroma.Docs.Generator.process(
+             implementation,
+             descriptions[:pleroma][:config_description]
+           ) do
+      type = if implementation == Pleroma.Docs.Markdown, do: "Markdown", else: "JSON"
 
-    type = if implementation == Pleroma.Docs.Markdown, do: "Markdown", else: "JSON"
-
-    Mix.shell().info([:green, "#{type} docs successfully generated to #{file_path}."])
+      Mix.shell().info([:green, "#{type} docs successfully generated to #{file_path}."])
+    end
   end
 end