mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-11-09 02:29:52 +00:00
mix docs generates config.md
This commit is contained in:
parent
67e4300931
commit
511d93fa54
2 changed files with 42 additions and 1 deletions
40
lib/mix/tasks/pleroma/docs.ex
Normal file
40
lib/mix/tasks/pleroma/docs.ex
Normal file
|
@ -0,0 +1,40 @@
|
|||
defmodule Mix.Tasks.Pleroma.Docs do
|
||||
use Mix.Task
|
||||
import Mix.Pleroma
|
||||
|
||||
@shortdoc "Generates docs from descriptions.exs"
|
||||
@moduledoc """
|
||||
Generates docs from `descriptions.exs`.
|
||||
|
||||
Supports two formats: `markdown` and `json`.
|
||||
|
||||
## Generate markdown docs
|
||||
|
||||
`mix pleroma.docs`
|
||||
|
||||
## Generate json docs
|
||||
|
||||
`mix pleroma.docs json`s
|
||||
"""
|
||||
|
||||
def run(["json"]) do
|
||||
do_run(Pleroma.Docs.JSON)
|
||||
end
|
||||
|
||||
def run(_) do
|
||||
do_run(Pleroma.Docs.Markdown)
|
||||
end
|
||||
|
||||
defp do_run(implementation) do
|
||||
start_pleroma()
|
||||
descriptions = Config.Reader.read!("config/description.exs")
|
||||
|
||||
{:ok, file_path} =
|
||||
Pleroma.Docs.Formatter.process(
|
||||
implementation,
|
||||
descriptions[:pleroma][:config_description]
|
||||
)
|
||||
|
||||
Mix.shell().info([:green, "Markdown docs successfully generated to #{file_path}."])
|
||||
end
|
||||
end
|
3
mix.exs
3
mix.exs
|
@ -172,7 +172,8 @@ defmodule Pleroma.Mixfile do
|
|||
"ecto.rollback": ["pleroma.ecto.rollback"],
|
||||
"ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
|
||||
"ecto.reset": ["ecto.drop", "ecto.setup"],
|
||||
test: ["ecto.create --quiet", "ecto.migrate", "test"]
|
||||
test: ["ecto.create --quiet", "ecto.migrate", "test"],
|
||||
docs: ["pleroma.docs", "docs"]
|
||||
]
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue