+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Mix.Tasks.Pleroma.Docs do
use Mix.Task
import Mix.Pleroma
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 <- Pleroma.Config.Loader.read("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"
- Mix.shell().info([:green, "Markdown docs successfully generated to #{file_path}."])
+ Mix.shell().info([:green, "#{type} docs successfully generated to #{file_path}."])
+ end
end
end