Skip to content

Commit

Permalink
Add support for rebar3/hex
Browse files Browse the repository at this point in the history
  • Loading branch information
schlagert committed Aug 3, 2016
1 parent 85a5f18 commit ab03644
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 22 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.eunit
.rebar
ebin
_build
deps
doc
ebin
4 changes: 0 additions & 4 deletions rebar.config

This file was deleted.

37 changes: 37 additions & 0 deletions rebar.config.script
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
%%%=============================================================================
%%% Copyright (c) 2012-2016 Lindenbaum GmbH
%%%
%%% Permission to use, copy, modify, and/or distribute this software for any
%%% purpose with or without fee is hereby granted, provided that the above
%%% copyright notice and this permission notice appear in all copies.
%%%
%%% THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
%%% WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
%%% MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
%%% ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
%%% WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
%%% ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
%%% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
%%%=============================================================================

ProperGithub = {git, "https://github.com/manopapad/proper.git", {tag, "v1.1"}}.

case erlang:function_exported(rebar3, main, 1) of
true ->
[
{profiles,
[
{test,
[
{deps, [{proper, "1.1.0"}]},
{proper_opts, [long_result, verbose]}
]}
]},
{plugins,
[
rebar3_proper
]}
];
false ->
[{deps, [{proper, ".*", ProperGithub}]}]
end.
1 change: 1 addition & 0 deletions rebar.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[].
15 changes: 10 additions & 5 deletions src/lbm_kv.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
%%% | o __ _| _ __ |_ _ _ _ (TM)
%%% |_ | | | (_| (/_ | | |_) (_| |_| | | |
%%%
%%% @copyright (C) 2014, Lindenbaum GmbH
%%% @copyright (C) 2014-2016, Lindenbaum GmbH
%%%
%%% Permission to use, copy, modify, and/or distribute this software for any
%%% purpose with or without fee is hereby granted, provided that the above
Expand All @@ -17,9 +17,10 @@
%%% ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
%%% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
%%%=============================================================================
{application, lbm_kv,
[{description, "."},
{id, "A simple, distributed, Mnesia-based key-value-store."},
{application,
lbm_kv,
[
{description, "A simple, distributed, Mnesia-based key-value-store."},
{vsn, "0.0.2"},
{registered,
[
Expand All @@ -33,4 +34,8 @@
mnesia
]},
{mod, {lbm_kv, []}},
{env, []}]}.
{env, []},
{maintainers, ["Tobias Schlager", "Sven Heyll", "Timo Koepke"]},
{licenses, ["MIT"]},
{links, [{"Github", "https://github.com/lindenbaum/lbm_kv"}]}
]}.
18 changes: 6 additions & 12 deletions test/lbm_kv_dist_test.erl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
%%% | o __ _| _ __ |_ _ _ _ (TM)
%%% |_ | | | (_| (/_ | | |_) (_| |_| | | |
%%%
%%% @copyright (C) 2014, Lindenbaum GmbH
%%% @copyright (C) 2014-2016, Lindenbaum GmbH
%%%
%%% Permission to use, copy, modify, and/or distribute this software for any
%%% purpose with or without fee is hereby granted, provided that the above
Expand Down Expand Up @@ -206,20 +206,14 @@ distribute(Name) ->
%% Start a slave node and setup its environment (code path, applications, ...).
%%------------------------------------------------------------------------------
slave_setup(Name) ->
{ok, Node} = slave:start_link(localhost, Name),
Arg = string:join(["-pa " ++ P || P <- code:get_path()], " "),
{ok, Node} = slave:start_link(localhost, Name, Arg),
%% Make sure slave node started correctly and is now connected
true = lists:member(Node, nodes()),
slave_setup_env(Node),
%% Start the needed applications
ok = slave_execute(Node, fun() -> setup_apps() end),
{ok, Node}.

%%------------------------------------------------------------------------------
%% @private
%% Setup the slave node environment (code path, applications, ...).
%%------------------------------------------------------------------------------
slave_setup_env(Node) ->
Paths = code:get_path(),
ok = slave_execute(Node, fun() -> [code:add_patha(P)|| P <- Paths] end),
ok = slave_execute(Node, fun() -> setup_apps() end).

%%------------------------------------------------------------------------------
%% @private
%% Execute `Fun' on the given node.
Expand Down

0 comments on commit ab03644

Please sign in to comment.