aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/docs/json.ex
diff options
context:
space:
mode:
authorIvan Tashkinov <ivantashkinov@gmail.com>2019-09-14 16:11:44 +0300
committerIvan Tashkinov <ivantashkinov@gmail.com>2019-09-14 16:11:44 +0300
commit6bcedb693c47fcef44ff3b4412629d1c50c2a1c7 (patch)
tree0420581ba993b70cb957c261cb83ef90597ddeb4 /lib/pleroma/docs/json.ex
parentc3f00447afc67b460e63b531e4f2432bfaa37bdb (diff)
parenta9b78f55e3561eec3cd125f030d2dd6ec338d406 (diff)
downloadpleroma-6bcedb693c47fcef44ff3b4412629d1c50c2a1c7.tar.gz
[#1149] Merge remote-tracking branch 'remotes/upstream/develop' into 1149-oban-job-queue
# Conflicts: # docs/config.md # mix.lock
Diffstat (limited to 'lib/pleroma/docs/json.ex')
-rw-r--r--lib/pleroma/docs/json.ex20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/pleroma/docs/json.ex b/lib/pleroma/docs/json.ex
new file mode 100644
index 000000000..18ba01d58
--- /dev/null
+++ b/lib/pleroma/docs/json.ex
@@ -0,0 +1,20 @@
+defmodule Pleroma.Docs.JSON do
+ @behaviour Pleroma.Docs.Generator
+
+ @spec process(keyword()) :: {:ok, String.t()}
+ def process(descriptions) do
+ config_path = "docs/generate_config.json"
+
+ with {:ok, file} <- File.open(config_path, [:write]),
+ json <- generate_json(descriptions),
+ :ok <- IO.write(file, json),
+ :ok <- File.close(file) do
+ {:ok, config_path}
+ end
+ end
+
+ @spec generate_json([keyword()]) :: String.t()
+ def generate_json(descriptions) do
+ Jason.encode!(descriptions)
+ end
+end