aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Sloughter <[email protected]>2016-03-24 09:53:49 -0500
committerTristan Sloughter <[email protected]>2016-03-24 09:53:49 -0500
commit946155322d9279401f3e6140627d2b0ebf1dddde (patch)
tree6496ed27b3a8a627208b9cd4bfd4c70d34a2a0c0
parentfee01211334e8d104aaebea2ba98f89db442c067 (diff)
parentc3f01bc7ded59104b363edb8e9efd59db410c058 (diff)
downloadrelx-946155322d9279401f3e6140627d2b0ebf1dddde.tar.gz
relx-946155322d9279401f3e6140627d2b0ebf1dddde.tar.bz2
relx-946155322d9279401f3e6140627d2b0ebf1dddde.zip
Merge pull request #457 from egobrain/fixed-template-args-order-bug
Fixed template args order bug
-rw-r--r--src/rlx_prv_overlay.erl4
-rw-r--r--test/rlx_release_SUITE.erl3
-rw-r--r--test/rlx_test_utils.erl1
3 files changed, 7 insertions, 1 deletions
diff --git a/src/rlx_prv_overlay.erl b/src/rlx_prv_overlay.erl
index 412e5ba..becdb32 100644
--- a/src/rlx_prv_overlay.erl
+++ b/src/rlx_prv_overlay.erl
@@ -197,7 +197,9 @@ merge_overlay_vars(State, FileNames) ->
%% to the current one being read
OverlayRelativeRoot = filename:dirname(FileName),
NewTerms = check_overlay_inclusion(State, OverlayRelativeRoot, Terms),
- lists:ukeymerge(1, lists:ukeysort(1, NewTerms), Acc);
+ lists:foldl(fun(NewTerm, A) ->
+ lists:keystore(element(1, NewTerm), 1, A, NewTerm)
+ end, Acc, NewTerms);
{error, Reason} ->
ec_cmd_log:warn(rlx_state:log(State),
format_error({unable_to_read_varsfile, FileName, Reason})),
diff --git a/test/rlx_release_SUITE.erl b/test/rlx_release_SUITE.erl
index 710370a..780b1c8 100644
--- a/test/rlx_release_SUITE.erl
+++ b/test/rlx_release_SUITE.erl
@@ -550,6 +550,7 @@ overlay_release(Config) ->
VarsFile1 = filename:join([LibDir1, "vars1.config"]),
rlx_test_utils:write_config(VarsFile1, [{yahoo, "yahoo"},
{yahoo2, [{foo, "bar"}]},
+ {foo_yahoo, "foo_{{yahoo}}"},
{foo_dir, "foodir"}]),
VarsFile2 = filename:join([LibDir1, "vars2.config"]),
@@ -610,6 +611,8 @@ overlay_release(Config) ->
proplists:get_value(release_name, TemplateData)),
?assertEqual("yahoo/foo4",
proplists:get_value(yahoo4, TemplateData)),
+ ?assertEqual("foo_yahoo",
+ proplists:get_value(foo_yahoo, TemplateData)),
?assertEqual("yahoo",
proplists:get_value(google, TemplateData)).
diff --git a/test/rlx_test_utils.erl b/test/rlx_test_utils.erl
index 9db2835..1157e3f 100644
--- a/test/rlx_test_utils.erl
+++ b/test/rlx_test_utils.erl
@@ -77,4 +77,5 @@ test_template_contents() ->
"{yahoo4, \"{{yahoo4}}\"}.\n"
"{yahoo, \"{{yahoo}}\"}.\n"
"{foo_dir, \"{{foo_dir}}\"}.\n"
+ "{foo_yahoo, \"{{foo_yahoo}}\"}.\n"
"{google, \"{{google}}\"}.\n".