diff options
author | Eric Merritt <[email protected]> | 2013-10-16 16:45:18 -0700 |
---|---|---|
committer | Eric Merritt <[email protected]> | 2013-10-16 16:45:18 -0700 |
commit | ac1435aeab0e16f3a22428e95b8d895f32917629 (patch) | |
tree | d8ccc0abca21073ec4cb7a57077d444fd30595cf | |
parent | c0a0f74fa1f5c51bc622618f924f2175c07cbda2 (diff) | |
parent | d6adddc25738be79c2663e410cc1ff45c14c23c7 (diff) | |
download | relx-ac1435aeab0e16f3a22428e95b8d895f32917629.tar.gz relx-ac1435aeab0e16f3a22428e95b8d895f32917629.tar.bz2 relx-ac1435aeab0e16f3a22428e95b8d895f32917629.zip |
Merge pull request #76 from tsloughter/master
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(), |