forked from etrepum/couchperuser
-
Notifications
You must be signed in to change notification settings - Fork 1
/
rebar.config.script
27 lines (27 loc) · 920 Bytes
/
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
%% -*- mode: erlang -*-
%%
%% This doesn't change CONFIG. If couch isn't accessible to the code server,
%% it adds paths from couch-config. This is equivalent to:
%%
%% ERL_LIBS=$(couch-config --erl-libs-dir):$ERL_LIBS rebar compile
%%
case code:which(couch) of
non_existing ->
try
Cfg = os:cmd("couch-config --erl-libs-dir"),
[LibDir] = string:tokens(Cfg, "\n"),
true = filelib:is_dir(LibDir),
code:add_pathsa(
filelib:wildcard(filename:join([LibDir, "*", "ebin"]))),
false = (code:which(couch) =:= non_existing)
catch _Err:_What ->
io:format(
"CONFIG ERROR:\n"
"Failed to run couch-config --erl-libs-dir\n"
"Ensure that couch-config is on the PATH, or set ERL_LIBS "
"appropriately\n\n")
end;
_ ->
ok
end,
CONFIG.