-
Notifications
You must be signed in to change notification settings - Fork 20
/
rebar.config.script
33 lines (29 loc) · 1.25 KB
/
rebar.config.script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
%% -*- mode: erlang; -*-
case erlang:function_exported(rebar3, main, 1) of
true ->
%% rebar3
CONFIG;
false ->
%% rebar 2.x or older
%% rebuild deps
Rebar3Deps = proplists:get_value(deps, CONFIG),
Rebar3TestDeps =
proplists:get_value(deps,
proplists:get_value(test,
proplists:get_value(profiles,
CONFIG))),
%% whenever adding a new Hex package dependency, this fun should be
%% updated
HexToRepo = fun(cowboy) -> "https://github.com/ninenines/cowboy.git";
(ranch) -> "https://github.com/ninenines/ranch.git";
(meck) -> "https://github.com/eproxus/meck.git"
end,
ConvertDep =
fun({DepName, {git, Repo, {ref, Tag}}}) ->
{DepName, ".*", {git, Repo, {tag, Tag}}};
({HexDepName, HexDepVersion}) ->
{HexDepName, ".*", {git, HexToRepo(HexDepName), {tag, HexDepVersion}}}
end,
Rebar2Deps = [ ConvertDep(Dep) || Dep <- Rebar3Deps ++ Rebar3TestDeps ],
lists:keystore(deps, 1, CONFIG, {deps, Rebar2Deps})
end.