Skip to content

Commit

Permalink
Merge pull request esl#55 from esl/reuse-deps
Browse files Browse the repository at this point in the history
check if tests are run inside Mongoose repo
  • Loading branch information
erszcz committed May 26, 2014
2 parents dbb436e + da8807e commit 39d4cdb
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions rebar.config.script
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
IfInsideMongoose = fun() ->
filelib:is_regular("../../src/mongooseim.app.src")
end,

CopyDep = fun
(DirOrFile) when DirOrFile /= "ejabberd_tests" ->
Existing = filename:absname(DirOrFile,".."),
Destination = filename:absname(DirOrFile,"deps"),
case filelib:is_dir(Existing) and not filelib:is_dir(Destination) of
true ->
CMD = lists:flatten(io_lib:format("cp -r ~p ~p", [Existing, Destination])),
os:cmd(CMD);
_ ->
skip
end;
(_) -> ok
end,

ReuseDeps = fun
(true) ->
io:format("Tests are run inside MongooseIM repo, using already downloaded deps~n"),
file:make_dir("deps"),
{ok, Deps} = file:list_dir("../"),
lists:foreach(CopyDep, Deps);
(_) ->
ok
end,

ReuseDeps(IfInsideMongoose()),

CONFIG.

0 comments on commit 39d4cdb

Please sign in to comment.