|
@@ -9,6 +9,7 @@ case File.stat("rebar.lock") do
|
|
|
_ ->
|
|
_ ->
|
|
|
:ok
|
|
:ok
|
|
|
end
|
|
end
|
|
|
|
|
+
|
|
|
{_, 0} =
|
|
{_, 0} =
|
|
|
File.cwd!()
|
|
File.cwd!()
|
|
|
|> Path.join("rebar3")
|
|
|> Path.join("rebar3")
|
|
@@ -24,48 +25,53 @@ pkg_idx =
|
|
|
|> Keyword.fetch!(:pkg_hash)
|
|
|> Keyword.fetch!(:pkg_hash)
|
|
|
|> Map.new()
|
|
|> Map.new()
|
|
|
|
|
|
|
|
-rebar_deps = Map.new(rebar_deps, fn {name, ref, _} ->
|
|
|
|
|
- ref = case ref do
|
|
|
|
|
- {:pkg, _, _} ->
|
|
|
|
|
- pkg_idx
|
|
|
|
|
- |> Map.fetch!(name)
|
|
|
|
|
- |> String.downcase()
|
|
|
|
|
|
|
+rebar_deps =
|
|
|
|
|
+ Map.new(rebar_deps, fn {name, ref, _} ->
|
|
|
|
|
+ ref =
|
|
|
|
|
+ case ref do
|
|
|
|
|
+ {:pkg, _, _} ->
|
|
|
|
|
+ pkg_idx
|
|
|
|
|
+ |> Map.fetch!(name)
|
|
|
|
|
+ |> String.downcase()
|
|
|
|
|
|
|
|
- {:git, _, {:ref, ref}} ->
|
|
|
|
|
- to_string(ref)
|
|
|
|
|
- end
|
|
|
|
|
|
|
+ {:git, _, {:ref, ref}} ->
|
|
|
|
|
+ to_string(ref)
|
|
|
|
|
+ end
|
|
|
|
|
|
|
|
- {name, ref}
|
|
|
|
|
-end)
|
|
|
|
|
|
|
+ {name, ref}
|
|
|
|
|
+ end)
|
|
|
|
|
|
|
|
{mix_deps, []} = Code.eval_file("mix.lock")
|
|
{mix_deps, []} = Code.eval_file("mix.lock")
|
|
|
|
|
|
|
|
-mix_deps = Map.new(mix_deps, fn {name, ref} ->
|
|
|
|
|
- ref = case ref do
|
|
|
|
|
- {:git, _, ref, _} ->
|
|
|
|
|
- ref
|
|
|
|
|
|
|
+mix_deps =
|
|
|
|
|
+ Map.new(mix_deps, fn {name, ref} ->
|
|
|
|
|
+ ref =
|
|
|
|
|
+ case ref do
|
|
|
|
|
+ {:git, _, ref, _} ->
|
|
|
|
|
+ ref
|
|
|
|
|
|
|
|
- {:hex, _, _, ref, _, _, _, _} ->
|
|
|
|
|
- ref
|
|
|
|
|
- end
|
|
|
|
|
|
|
+ {:hex, _, _, ref, _, _, _, _} ->
|
|
|
|
|
+ ref
|
|
|
|
|
+ end
|
|
|
|
|
|
|
|
- {to_string(name), ref}
|
|
|
|
|
-end)
|
|
|
|
|
|
|
+ {to_string(name), ref}
|
|
|
|
|
+ end)
|
|
|
|
|
|
|
|
-diffs = Enum.reduce(rebar_deps, %{}, fn {name, rebar_ref}, acc ->
|
|
|
|
|
- mix_ref = mix_deps[name]
|
|
|
|
|
|
|
+diffs =
|
|
|
|
|
+ Enum.reduce(rebar_deps, %{}, fn {name, rebar_ref}, acc ->
|
|
|
|
|
+ mix_ref = mix_deps[name]
|
|
|
|
|
|
|
|
- cond do
|
|
|
|
|
- mix_ref && mix_ref != rebar_ref ->
|
|
|
|
|
- Map.put(acc, name, {rebar_ref, mix_ref})
|
|
|
|
|
|
|
+ cond do
|
|
|
|
|
+ mix_ref && mix_ref != rebar_ref ->
|
|
|
|
|
+ Map.put(acc, name, {rebar_ref, mix_ref})
|
|
|
|
|
|
|
|
- is_nil(mix_ref) ->
|
|
|
|
|
- Map.put(acc, name, {rebar_ref, nil})
|
|
|
|
|
|
|
+ is_nil(mix_ref) ->
|
|
|
|
|
+ Map.put(acc, name, {rebar_ref, nil})
|
|
|
|
|
|
|
|
- :otherwise ->
|
|
|
|
|
- acc
|
|
|
|
|
- end
|
|
|
|
|
-end)
|
|
|
|
|
|
|
+ :otherwise ->
|
|
|
|
|
+ acc
|
|
|
|
|
+ end
|
|
|
|
|
+ end)
|
|
|
|
|
|
|
|
if diffs == %{} do
|
|
if diffs == %{} do
|
|
|
IO.puts(
|
|
IO.puts(
|
|
@@ -73,6 +79,7 @@ if diffs == %{} do
|
|
|
"* Mix and Rebar3 dependencies OK!" <>
|
|
"* Mix and Rebar3 dependencies OK!" <>
|
|
|
IO.ANSI.reset()
|
|
IO.ANSI.reset()
|
|
|
)
|
|
)
|
|
|
|
|
+
|
|
|
System.halt(0)
|
|
System.halt(0)
|
|
|
else
|
|
else
|
|
|
IO.puts(
|
|
IO.puts(
|