diff options
author | Jordan Wilberding <[email protected]> | 2013-10-12 14:32:01 -0700 |
---|---|---|
committer | Jordan Wilberding <[email protected]> | 2013-10-12 14:32:01 -0700 |
commit | d8fe19483d1afe15017709058f330ac132e4029a (patch) | |
tree | 4ef0d3c0b573b0d0c8459010fc37750c7bb6eba0 /src | |
parent | 7bcf3516d0c8aef9fd7cb0191dd9d36929d2a88d (diff) | |
parent | f50f63f1cb504fc9af4f060b7e7d6c5f1c816d41 (diff) | |
download | relx-d8fe19483d1afe15017709058f330ac132e4029a.tar.gz relx-d8fe19483d1afe15017709058f330ac132e4029a.tar.bz2 relx-d8fe19483d1afe15017709058f330ac132e4029a.zip |
Merge pull request #67 from tsloughter/master
add overlay_vars command line arg
Diffstat (limited to 'src')
-rw-r--r-- | src/relx.erl | 1 | ||||
-rw-r--r-- | src/rlx_cmd_args.erl | 8 | ||||
-rw-r--r-- | src/rlx_prv_config.erl | 4 | ||||
-rw-r--r-- | src/rlx_state.erl | 10 |
4 files changed, 19 insertions, 4 deletions
diff --git a/src/relx.erl b/src/relx.erl index dc5b8e0..7b09751 100644 --- a/src/relx.erl +++ b/src/relx.erl @@ -200,6 +200,7 @@ opt_spec_list() -> {override_app, $a, "override_app", string, "Provide an app name and a directory to override in the form <appname>:<app directory>"}, {config, $c, "config", {string, ""}, "The path to a config file"}, + {overlay_vars, undefined, "overlay_vars", string, "Path to a file of overlay variables"}, {version, $v, "version", undefined, "Print relx version"}, {root_dir, $r, "root", string, "The project root directory"}]. diff --git a/src/rlx_cmd_args.erl b/src/rlx_cmd_args.erl index 2a0f573..e360ab8 100644 --- a/src/rlx_cmd_args.erl +++ b/src/rlx_cmd_args.erl @@ -246,7 +246,13 @@ create_root_dir(Opts, Acc) -> {ok, rlx_state:cmd_args()} | relx:error(). create_disable_default_libs(Opts, Acc) -> Def = proplists:get_value(default_libs, Opts, true), - create_upfrom(Opts, [{default_libs, Def} | Acc]). + create_overlay_vars(Opts, [{default_libs, Def} | Acc]). + +-spec create_overlay_vars([getopt:option()], rlx_state:cmd_args()) -> + {ok, rlx_state:cmd_args()} | relx:error(). +create_overlay_vars(Opts, Acc) -> + OverlayVars = proplists:get_all_values(overlay_vars, Opts), + create_upfrom(Opts, [{overlay_vars, OverlayVars} | Acc]). -spec create_upfrom([getopt:option()], rlx_state:cmd_args()) -> {ok, rlx_state:cmd_args()} | relx:error(). diff --git a/src/rlx_prv_config.erl b/src/rlx_prv_config.erl index dd11e65..71a2dc9 100644 --- a/src/rlx_prv_config.erl +++ b/src/rlx_prv_config.erl @@ -174,6 +174,10 @@ load_terms({vm_args, VmArgs}, {ok, State}) -> {ok, rlx_state:vm_args(State, filename:absname(VmArgs))}; 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)), + {ok, rlx_state:put(State, overlay_vars, NewOverlayVars)}; load_terms({Name, Value}, {ok, State}) when erlang:is_atom(Name) -> {ok, rlx_state:put(State, Name, Value)}; diff --git a/src/rlx_state.erl b/src/rlx_state.erl index 4c6df07..74304cc 100644 --- a/src/rlx_state.erl +++ b/src/rlx_state.erl @@ -134,9 +134,13 @@ new(PropList, Targets) upfrom = proplists:get_value(upfrom, PropList, undefined), default_configured_release={proplists:get_value(relname, PropList, undefined), proplists:get_value(relvsn, PropList, undefined)}}, - rlx_state:put(create_logic_providers(State0), - default_libs, - proplists:get_value(default_libs, PropList, true)). + State1 = rlx_state:put(create_logic_providers(State0), + default_libs, + proplists:get_value(default_libs, PropList, true)), + + rlx_state:put(create_logic_providers(State1), + overlay_vars, + proplists:get_value(overlay_vars, PropList, [])). %% @doc the actions targeted for this system -spec actions(t()) -> [action()]. |