aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/docs/json.ex
diff options
context:
space:
mode:
authorrinpatch <rinpatch@sdf.org>2019-09-13 19:42:53 +0300
committerrinpatch <rinpatch@sdf.org>2019-09-13 19:42:53 +0300
commitba70a8cae6c0d00963dc1d9e80f915186397ad06 (patch)
treed0cfb4e9b6c8771b84f38b9d6175b47fbf4e442d /lib/pleroma/docs/json.ex
parentac4a748fad34c02647bf72e802cd9d74205681fe (diff)
parent53a3ad60435d4f7eab2dbf1235e5974bac275aa0 (diff)
downloadpleroma-ba70a8cae6c0d00963dc1d9e80f915186397ad06.tar.gz
Merge branch 'develop' into feature/delivery-tracking
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