Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update release.ex #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions lib/release.ex
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ defmodule ExLoader.Release do

defp add_paths(remote_node, base, apps) do
paths =
Enum.map(get_paths(base, apps), fn p ->
Enum.map(get_paths(base, apps, remote_node), fn p ->
:rpc.call(remote_node, :code, :add_path, [to_charlist(p)])
p
end)
Expand Down Expand Up @@ -67,15 +67,16 @@ defmodule ExLoader.Release do
end)
end

defp get_paths(base, apps) do
defp get_paths(base, apps, remote_node) do
apps
|> Enum.map(fn app ->
parent = Path.join(base, "lib/#{elem(app, 0)}-#{elem(app, 1)}")

parent
|> File.ls!()
:rpc.call(remote_node, File, :ls!, [parent])
|> Enum.map(&Path.join(parent, &1))
|> Enum.filter(fn p -> File.dir?(p) and Path.basename(p) != "priv" end)
|> Enum.filter(fn p ->
:rpc.call(remote_node, File, :dir?, [p]) and Path.basename(p) != "priv"
end)
end)
|> List.flatten()
end
Expand Down