aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/docs/json.ex
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2019-09-13 16:31:27 +0200
committerlain <lain@soykaf.club>2019-09-13 16:31:27 +0200
commita7f31bf06cfe3f8e2549393f34d6573854d783c0 (patch)
treef53d6747ee73044f7b342d3fdae3d30b5b5b3c90 /lib/pleroma/docs/json.ex
parentf649a2e972b70dfefb7bfc110b27a0194cda51c5 (diff)
parent0d9609894f4f4557da2db62a33da1b8995c9e1d7 (diff)
downloadpleroma-a7f31bf06cfe3f8e2549393f34d6573854d783c0.tar.gz
Merge remote-tracking branch 'origin/develop' into reactions
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