aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/docs/json.ex
diff options
context:
space:
mode:
authorMaxim Filippov <colixer@gmail.com>2019-09-16 19:44:06 +0300
committerMaxim Filippov <colixer@gmail.com>2019-09-16 19:44:06 +0300
commitdf15ed13d15db5b5a371345fcb9968b5af4100af (patch)
tree02f8834a25733ed7ee02fa9aa4dd66b606f78030 /lib/pleroma/docs/json.ex
parentd1abf7a3585e4bc1ebea4f615ae2e149d5a56918 (diff)
parenta58f29b826333c1ecb0907228f0e087a3ecd9778 (diff)
downloadpleroma-df15ed13d15db5b5a371345fcb9968b5af4100af.tar.gz
Merge branch 'develop' into feature/moderation-log-filters
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