diff options
author | Tristan Sloughter <tristan.sloughter@gmail.com> | 2015-04-18 11:15:22 -0500 |
---|---|---|
committer | Tristan Sloughter <tristan.sloughter@gmail.com> | 2015-04-18 11:15:22 -0500 |
commit | 4a057b68c92a7b1334471c109b2c1649c9f17e67 (patch) | |
tree | 548141bbe47988c01cd94231f8953bff2aaff46d /src/rebar_prv_lock.erl | |
parent | 123b0ea61afd5d1524d0c08b5e8ebcc3b01f0866 (diff) | |
parent | 2ff4ac6d5049746be80263e48df5d864606e22d6 (diff) |
Merge pull request #344 from ferd/proper-default-fetch
Default deps always to the default profile
Diffstat (limited to 'src/rebar_prv_lock.erl')
-rw-r--r-- | src/rebar_prv_lock.erl | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/src/rebar_prv_lock.erl b/src/rebar_prv_lock.erl index 5536ec9..f88b1ff 100644 --- a/src/rebar_prv_lock.erl +++ b/src/rebar_prv_lock.erl @@ -29,19 +29,10 @@ init(State) -> -spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}. do(State) -> - AllDeps = rebar_state:lock(State), - Locks = [begin - Dir = rebar_app_info:dir(Dep), - Source = rebar_app_info:source(Dep), - - %% If source is tuple it is a source dep - %% e.g. {git, "git://github.com/ninenines/cowboy.git", "master"} - {rebar_app_info:name(Dep) - ,rebar_fetch:lock_source(Dir, Source, State) - ,rebar_app_info:dep_level(Dep)} - end || Dep <- AllDeps, not(rebar_app_info:is_checkout(Dep))], + Locks = build_locks(State), Dir = rebar_state:dir(State), - file:write_file(filename:join(Dir, ?LOCK_FILE), io_lib:format("~p.~n", [Locks])), + file:write_file(filename:join(Dir, ?LOCK_FILE), + io_lib:format("~p.~n", [Locks])), {ok, State}. -spec format_error(any()) -> iolist(). @@ -50,3 +41,17 @@ format_error(Reason) -> info(_) -> "". + +build_locks(State) -> + AllDeps = rebar_state:lock(State), + [begin + Dir = rebar_app_info:dir(Dep), + Source = rebar_app_info:source(Dep), + + %% If source is tuple it is a source dep + %% e.g. {git, "git://github.com/ninenines/cowboy.git", "master"} + {rebar_app_info:name(Dep) + ,rebar_fetch:lock_source(Dir, Source, State) + ,rebar_app_info:dep_level(Dep)} + end || Dep <- AllDeps, not(rebar_app_info:is_checkout(Dep))]. + |