diff options
author | Tristan Sloughter <[email protected]> | 2013-10-16 17:14:50 -0500 |
---|---|---|
committer | Tristan Sloughter <[email protected]> | 2013-10-16 18:31:31 -0500 |
commit | d6adddc25738be79c2663e410cc1ff45c14c23c7 (patch) | |
tree | 0caed1b01ffd66ed50d3e76198a15e5fde0a930b | |
parent | 5216cf94a3d2b62756a2acb2867449a782437bf9 (diff) | |
download | relx-d6adddc25738be79c2663e410cc1ff45c14c23c7.tar.gz relx-d6adddc25738be79c2663e410cc1ff45c14c23c7.tar.bz2 relx-d6adddc25738be79c2663e410cc1ff45c14c23c7.zip |
fix load overlay to support filename not in a list. This closes #74
-rw-r--r-- | src/rlx_prv_config.erl | 12 | ||||
-rw-r--r-- | test/rlx_release_SUITE.erl | 4 |
2 files changed, 14 insertions, 2 deletions
diff --git a/src/rlx_prv_config.erl b/src/rlx_prv_config.erl index b223bce..5f6dcad 100644 --- a/src/rlx_prv_config.erl +++ b/src/rlx_prv_config.erl @@ -177,7 +177,8 @@ load_terms({sys_config, SysConfig}, {ok, State}) -> {ok, rlx_state:sys_config(State, filename:absname(SysConfig))}; load_terms({overlay_vars, OverlayVars}, {ok, State}) -> CurrentOverlayVars = rlx_state:get(State, overlay_vars), - NewOverlayVars = lists:umerge(lists:usort(OverlayVars), lists:usort(CurrentOverlayVars)), + NewOverlayVars = list_of_overlay_vars_files(OverlayVars), + NewOverlayVars = lists:umerge(lists:usort(NewOverlayVars), lists:usort(CurrentOverlayVars)), {ok, rlx_state:put(State, overlay_vars, NewOverlayVars)}; load_terms({Name, Value}, {ok, State}) when erlang:is_atom(Name) -> @@ -196,3 +197,12 @@ gen_providers(Providers, State) -> (_, E={_, {error, _}}) -> E end, {[], {ok, State}}, Providers). + +list_of_overlay_vars_files(undefined) -> + []; +list_of_overlay_vars_files([]) -> + []; +list_of_overlay_vars_files([H | _]=FileNames) when erlang:is_list(H) -> + FileNames; +list_of_overlay_vars_files(FileName) when is_list(FileName) -> + [FileName]. diff --git a/test/rlx_release_SUITE.erl b/test/rlx_release_SUITE.erl index 184f444..2d4c86d 100644 --- a/test/rlx_release_SUITE.erl +++ b/test/rlx_release_SUITE.erl @@ -410,11 +410,13 @@ make_rerun_overridden_release(Config) -> create_app(OverrideDir1, OverrideApp, OverrideVsn, [stdlib,kernel], []), ConfigFile = filename:join([LibDir1, "relx.config"]), + OverlayVars = filename:join([LibDir1, "vars1.config"]), write_config(ConfigFile, [{release, {foo, "0.0.1"}, [goal_app_1, erlang:list_to_atom(OverrideApp), - goal_app_2]}]), + goal_app_2]}, + {overlay_vars, [OverlayVars]}]), OutputDir = filename:join([proplists:get_value(data_dir, Config), create_random_name("relx-output")]), {ok, Cwd} = file:get_cwd(), |