Add Pleroma.Utils.compile_dir/1
authorEgor Kislitsyn <egor@kislitsyn.com>
Mon, 9 Dec 2019 11:23:07 +0000 (18:23 +0700)
committerEgor Kislitsyn <egor@kislitsyn.com>
Mon, 9 Dec 2019 11:23:07 +0000 (18:23 +0700)
lib/pleroma/application.ex
lib/pleroma/utils.ex [new file with mode: 0644]

index 82a0057006553f44e4b3d115747213731795c079..104620b3733106f2cae894caadba0f3d46bc3965 100644 (file)
@@ -73,9 +73,7 @@ defmodule Pleroma.Application do
 
     if dir && File.exists?(dir) do
       dir
-      |> File.ls!()
-      |> Enum.map(&Path.join(dir, &1))
-      |> Kernel.ParallelCompiler.compile()
+      |> Pleroma.Utils.compile_dir()
       |> case do
         {:error, _errors, _warnings} ->
           raise "Invalid custom modules"
diff --git a/lib/pleroma/utils.ex b/lib/pleroma/utils.ex
new file mode 100644 (file)
index 0000000..8d36a00
--- /dev/null
@@ -0,0 +1,12 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.Utils do
+  def compile_dir(dir) when is_binary(dir) do
+    dir
+    |> File.ls!()
+    |> Enum.map(&Path.join(dir, &1))
+    |> Kernel.ParallelCompiler.compile()
+  end
+end