diff options
author | Ali Sabil <ali.sabil@tillitech.com> | 2011-11-21 00:01:53 +0100 |
---|---|---|
committer | Tuncer Ayaz <tuncer.ayaz@gmail.com> | 2011-12-28 13:18:40 +0100 |
commit | f47d61bc13d4b93c2dc234ceebf27d2d3a18507f (patch) | |
tree | 786b4e583fc5199791cc6973818b228d8186cfb1 | |
parent | 1de48e49023a929bb9b23bc7901040f08c188268 (diff) |
Add {vsn, _} support for reltool.config
-rw-r--r-- | src/rebar_rel_utils.erl | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/rebar_rel_utils.erl b/src/rebar_rel_utils.erl index bc77c46..081e409 100644 --- a/src/rebar_rel_utils.erl +++ b/src/rebar_rel_utils.erl @@ -118,7 +118,7 @@ get_previous_release_path() -> load_config(ReltoolFile) -> case file:consult(ReltoolFile) of {ok, Terms} -> - Terms; + expand_version(Terms, filename:dirname(ReltoolFile)); Other -> ?ABORT("Failed to load expected config from ~s: ~p\n", [ReltoolFile, Other]) @@ -208,3 +208,17 @@ make_proplist([H|T], Acc) -> make_proplist(T, [{App,Ver}|Acc]); make_proplist([], Acc) -> Acc. + +expand_version(ReltoolConfig, Dir) -> + case lists:keyfind(sys, 1, ReltoolConfig) of + {sys, Sys} -> + ExpandedSys = {sys, [expand_rel_version(Term, Dir) || Term <- Sys]}, + lists:keyreplace(sys, 1, ReltoolConfig, ExpandedSys); + _ -> + ReltoolConfig + end. + +expand_rel_version({rel, Name, Version, Apps}, Dir) -> + {rel, Name, rebar_utils:vcs_vsn(Version, Dir), Apps}; +expand_rel_version(Other, _Dir) -> + Other. |