diff options
author | Tristan Sloughter <t@crashfast.com> | 2014-09-02 20:47:34 -0500 |
---|---|---|
committer | Tristan Sloughter <t@crashfast.com> | 2014-09-02 20:47:34 -0500 |
commit | 63ec4cdef6a9a66107ddff7ea3b9c5b97074c6bf (patch) | |
tree | 84a8fbe6f0f1593d98ad5a2ed2e657c443551d99 | |
parent | 723a34b79429511f4fa594c26991b8d4e5ab6624 (diff) |
modify rebar lock output
-rw-r--r-- | src/rebar_prv_install_deps.erl | 8 | ||||
-rw-r--r-- | src/rebar_prv_lock.erl | 31 |
2 files changed, 26 insertions, 13 deletions
diff --git a/src/rebar_prv_install_deps.erl b/src/rebar_prv_install_deps.erl index ad585b1..faca012 100644 --- a/src/rebar_prv_install_deps.erl +++ b/src/rebar_prv_install_deps.erl @@ -68,7 +68,8 @@ do(State) -> case rebar_state:get(State, locks, []) of [] -> handle_deps(State, ordsets:from_list(rebar_state:get(State, deps, []))); - _Locks -> + Locks -> + handle_deps(State, ordsets:from_list(Locks)), {ok, State} end. @@ -210,8 +211,9 @@ parse_deps(DepsDir, Deps) -> ,ec_cnv:to_binary(Vsn)) | BinaryDepsAcc]}; (Name, {SrcDepsAcc, BinaryDepsAcc}) when is_atom(Name) -> {SrcDepsAcc, [ec_cnv:to_binary(Name) | BinaryDepsAcc]}; - ({Name, _, Source}, {SrcDepsAcc, BinaryDepsAcc}) -> - {ok, Dep} = rebar_app_info:discover(get_deps_dir(DepsDir, Name)), + ({Name, _Vsn, Source}, {SrcDepsAcc, BinaryDepsAcc}) when is_tuple (Source) -> + {ok, Dep} = + rebar_app_info:discover(ec_cnv:to_list(get_deps_dir(DepsDir, Name))), Dep1 = rebar_app_info:source(Dep, Source), {ordsets:add_element(Dep1, SrcDepsAcc), BinaryDepsAcc} end, {ordsets:new(), []}, Deps). diff --git a/src/rebar_prv_lock.erl b/src/rebar_prv_lock.erl index 6aaf7ac..8edfc9a 100644 --- a/src/rebar_prv_lock.erl +++ b/src/rebar_prv_lock.erl @@ -28,16 +28,27 @@ init(State) -> -spec do(rebar_state:t()) -> {ok, rebar_state:t()}. do(State) -> - AllDeps = rebar_state:get(State, all_deps, []), - Locks = lists:map(fun(Dep) -> - Dir = rebar_app_info:dir(Dep), - {rebar_app_info:name(Dep) - ,rebar_app_info:original_vsn(Dep) - ,rebar_fetch:lock_source(Dir, rebar_app_info:source(Dep))} - end, AllDeps), - Dir = rebar_state:dir(State), - file:write_file(filename:join(Dir, "rebar.lock"), io_lib:format("~p.~n", [Locks])), - {ok, rebar_state:set(State, locks, Locks)}. + case rebar_state:get(State, locks, []) of + [] -> + AllDeps = rebar_state:get(State, all_deps, []), + Locks = lists:map(fun(Dep) -> + Dir = rebar_app_info:dir(Dep), + case rebar_app_info:source(Dep) of + Source when is_tuple(Source) -> + {rebar_app_info:name(Dep) + ,rebar_app_info:original_vsn(Dep) + ,rebar_fetch:lock_source(Dir, Source)}; + _Source -> + {rebar_app_info:name(Dep) + ,rebar_app_info:original_vsn(Dep)} + end + end, AllDeps), + Dir = rebar_state:dir(State), + file:write_file(filename:join(Dir, "rebar.lock"), io_lib:format("~p.~n", [Locks])), + {ok, rebar_state:set(State, locks, Locks)}; + _Locks -> + {ok, State} + end. info(_) -> "". |