-
Notifications
You must be signed in to change notification settings - Fork 88
/
check_edown.script
39 lines (38 loc) · 1.43 KB
/
check_edown.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
35
36
37
38
39
%% -*- erlang -*-
%%
%% This helper script checks if doc is being built, otherwise removes edoc dep.
%% To build docs, call `rebar get-deps doc`
%% Assumes that the rebar config is bound to CONFIG
[_|Args] = init:get_plain_arguments(). % rebar 'commands' and options
case lists:member("doc", Args) of
false ->
{ok,C1} = file:script(filename:join(filename:dirname(SCRIPT),
"remove_deps.script"),
[{'CONFIG', CONFIG}, {'DEPS', [edown]}]),
C1;
true ->
%% We actually only need to start inets if we have a doc path with http URIS
application:start(crypto),
application:start(asn1),
application:start(public_key),
application:start(ssl),
application:start(inets),
case code:lib_dir(edown) of
{error, bad_name} ->
io:fwrite("cannot find edown~n", []),
D = {edown, ".*",
{git, "git://github.com/uwiger/edown.git", "HEAD"}},
Deps = case lists:keyfind(deps, 1, CONFIG) of
false -> [D];
{_, Ds} ->
case lists:keymember(edown, 1, Ds) of
true -> Ds;
false -> [D|Ds]
end
end,
lists:keystore(deps, 1, CONFIG, {deps, Deps});
_ ->
io:fwrite("edown in path~n", []),
CONFIG
end
end.