summaryrefslogtreecommitdiff
path: root/inttest
diff options
context:
space:
mode:
authorJesse Gumm <gumm@sigma-star.com>2016-03-20 09:18:06 -0500
committerJesse Gumm <gumm@sigma-star.com>2016-03-20 10:58:20 -0500
commit3b345046bde490641866e6098d9145c360b04205 (patch)
tree8eb49a3153980e6f9de9f06c1756f26578d9d023 /inttest
parentef73556df92dd3b31daaf1cc6d97fb220dfcaa0c (diff)
downloadrebar-3b345046bde490641866e6098d9145c360b04205.tar.gz
Support rebar3-style deps
Example: {git, {appname, "git://something/something", {branch, master}}} ^ | |---- Notice the lack of a version Regex
Diffstat (limited to 'inttest')
-rw-r--r--inttest/rebar3_deps1/a.erl8
-rw-r--r--inttest/rebar3_deps1/a.rebar.config1
-rw-r--r--inttest/rebar3_deps1/b.hrl1
-rw-r--r--inttest/rebar3_deps1/rebar3_deps1_rt.erl59
4 files changed, 69 insertions, 0 deletions
diff --git a/inttest/rebar3_deps1/a.erl b/inttest/rebar3_deps1/a.erl
new file mode 100644
index 0000000..835522a
--- /dev/null
+++ b/inttest/rebar3_deps1/a.erl
@@ -0,0 +1,8 @@
+-module(a).
+
+-compile(export_all).
+
+-include_lib("b/include/b.hrl").
+
+hello() ->
+ io:format("~s\n", [?HELLO]).
diff --git a/inttest/rebar3_deps1/a.rebar.config b/inttest/rebar3_deps1/a.rebar.config
new file mode 100644
index 0000000..6b20717
--- /dev/null
+++ b/inttest/rebar3_deps1/a.rebar.config
@@ -0,0 +1 @@
+{deps, [{b, {git, "../repo/b"}}]}.
diff --git a/inttest/rebar3_deps1/b.hrl b/inttest/rebar3_deps1/b.hrl
new file mode 100644
index 0000000..25dfeda
--- /dev/null
+++ b/inttest/rebar3_deps1/b.hrl
@@ -0,0 +1 @@
+-define(HELLO, "Hi From B").
diff --git a/inttest/rebar3_deps1/rebar3_deps1_rt.erl b/inttest/rebar3_deps1/rebar3_deps1_rt.erl
new file mode 100644
index 0000000..36f94e3
--- /dev/null
+++ b/inttest/rebar3_deps1/rebar3_deps1_rt.erl
@@ -0,0 +1,59 @@
+%% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*-
+%% ex: ts=4 sw=4 et
+-module(rebar3_deps1_rt).
+
+-compile(export_all).
+
+setup([Target]) ->
+ retest_utils:load_module(filename:join(Target, "inttest_utils.erl")),
+ ok.
+
+%% Test deps with rebar3-type dependencies (that is, dependencies without Regexes)
+%% Example: {git, {appname, "git://something/something", {branch, master}}}
+files() ->
+ [
+ %% A application
+ {create, "ebin/a.app", app(a, [a])},
+ {copy, "a.rebar.config", "rebar.config"},
+ {copy, "a.erl", "src/a.erl"},
+
+ %% B application
+ {create, "repo/b/ebin/b.app", app(b, [])},
+ {copy, "b.hrl", "repo/b/include/b.hrl"}
+
+ ] ++ inttest_utils:rebar_setup().
+
+apply_cmds([], _Params) ->
+ ok;
+apply_cmds([Cmd | Rest], Params) ->
+ io:format("Running: ~s (~p)\n", [Cmd, Params]),
+ {ok, _} = retest_sh:run(Cmd, Params),
+ apply_cmds(Rest, Params).
+
+run(_Dir) ->
+ %% Initialize the dep app as git repos so that dependencies pull
+ %% properly
+ GitCmds = ["git init",
+ "git add -A",
+ "git config user.email 'tdeps@example.com'",
+ "git config user.name 'tdeps'",
+ "git commit -a -m \"Initial Commit\""],
+ apply_cmds(GitCmds, [{dir, "repo/b"}]),
+
+ {ok, _} = retest_sh:run("./rebar get-deps", []),
+ {ok, _} = retest_sh:run("./rebar compile", []),
+
+ true = filelib:is_regular("ebin/a.beam"),
+ ok.
+
+%%
+%% Generate the contents of a simple .app file
+%%
+app(Name, Modules) ->
+ App = {application, Name,
+ [{description, atom_to_list(Name)},
+ {vsn, "1"},
+ {modules, Modules},
+ {registered, []},
+ {applications, [kernel, stdlib]}]},
+ io_lib:format("~p.\n", [App]).