Add Pleroma.Utils.compile_dir/1

This commit is contained in:
Egor Kislitsyn 2019-12-09 18:23:07 +07:00
parent a75d4a41e0
commit 84f891ea3e
2 changed files with 13 additions and 3 deletions

View 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"

12
lib/pleroma/utils.ex Normal file
View File

@ -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