forked from WhoopInc/dogstatsde
-
Notifications
You must be signed in to change notification settings - Fork 7
/
rebar.config.script
34 lines (30 loc) · 1.33 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
34
%% -*- 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(worker_pool) -> "https://github.com/inaka/worker_pool.git";
(lager) -> "https://github.com/erlang-lager/lager.git";
(meck) -> "https://github.com/eproxus/meck.git";
(stillir) -> "https://github.com/heroku/stillir.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.