diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/relx.erl | 6 | ||||
-rw-r--r-- | src/rlx_cmd_args.erl | 29 |
2 files changed, 22 insertions, 13 deletions
diff --git a/src/relx.erl b/src/relx.erl index 769668a..a48e3dd 100644 --- a/src/relx.erl +++ b/src/relx.erl @@ -118,7 +118,7 @@ do(RootDir, RelName, RelVsn, Goals, LibDirs, LogLevel, OutputDir, Configs) -> -spec do(file:name(), atom(), string(), [goal()], [file:name()], ec_cmd_log:log_level(), [file:name()], [{atom(), file:name()}], file:name() | undefined) -> ok | error() | {ok, rlx_state:t()}. -do(RootDir, RelName, RelVsn, Goals, LibDirs, LogLevel, OutputDir, Overrides, Config) -> +do(RootDir, RelName, RelVsn, Goals, LibDirs, LogLevel, OutputDir, Overrides, Config) -> do([{relname, RelName}, {relvsn, RelVsn}, {goals, Goals}, @@ -199,7 +199,7 @@ opt_spec_list() -> "Verbosity level, maybe between 0 and 3"}, {dev_mode, $d, "dev-mode", {boolean, false}, "Symlink the applications and configuration into the release instead of copying"}, - {override_app, $a, "override_app", string, + {override, $a, "override", 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"}, @@ -258,7 +258,7 @@ handle_output(_State, command_line, _) -> handle_output(_State, api, Result) -> Result. -run_providers(ConfigProvider, Providers, State0) -> +run_providers(ConfigProvider, Providers, State0) -> case Providers of [ConfigProvider | Rest] -> %% IF the config provider is still the first provider do not run it diff --git a/src/rlx_cmd_args.erl b/src/rlx_cmd_args.erl index 9233db9..f8aebf9 100644 --- a/src/rlx_cmd_args.erl +++ b/src/rlx_cmd_args.erl @@ -41,7 +41,7 @@ args2state(Opts, Targets) -> {ok, CommandLineConfig} -> RelName = rlx_util:to_atom(proplists:get_value(relname, Opts, undefined)), RelVsn = proplists:get_value(relvsn, Opts, undefined), - handle_config(Opts, AtomizedTargets, + handle_config(Opts, AtomizedTargets, [{default_release, {RelName, RelVsn}} | CommandLineConfig]) end; Error -> @@ -131,8 +131,8 @@ validate_config(Config) -> ?RLX_ERROR({invalid_config_file, Config}) end. -run_creates(Opts) -> - try +run_creates(Opts) -> + try Conf = lists:flatten(lists:foldl(fun(X, Acc) -> [create(X, Opts) | Acc] end, [], proplists:get_keys(Opts))), @@ -141,7 +141,7 @@ run_creates(Opts) -> throw:E -> E end. - + create(log_level, Opts) -> LogLevel = proplists:get_value(log_level, Opts, 0), if @@ -149,7 +149,7 @@ create(log_level, Opts) -> {log, ec_cmd_log:new(LogLevel, command_line)}; true -> throw(?RLX_ERROR({invalid_log_level, LogLevel})) - end; + end; create(goal, Opts) -> Goals = proplists:get_value(goals, Opts, []) ++ proplists:get_all_values(goal, Opts), @@ -168,12 +168,21 @@ create(goals, Opts) -> {ok, Specs} -> {goals, Specs} end; +create(override, Opts) -> + Overrides = proplists:get_value(overrides, Opts, []) ++ + proplists:get_all_values(override, Opts), + case convert_overrides(Overrides, []) of + {ok, Overrides2} -> + {overrides, Overrides2}; + Error -> + throw(Error) + end; create(overrides, Opts) -> - Overrides = proplists:get_all_values(override, Opts) ++ - proplists:get_value(overrides, Opts, []), + Overrides = proplists:get_value(overrides, Opts, []) ++ + proplists:get_all_values(override, Opts), case convert_overrides(Overrides, []) of - {ok, Overrides} -> - {overrides, Overrides}; + {ok, Overrides2} -> + {overrides, Overrides2}; Error -> throw(Error) end; @@ -275,7 +284,7 @@ convert_overrides([Override | Rest], Acc) when erlang:is_list(Override); erlang:is_binary(Override) -> case re:split(Override, ":") of [AppName, AppDir] -> - convert_overrides(Rest, [{erlang:iolist_to_binary(AppName), AppDir} | Acc]); + convert_overrides(Rest, [{rlx_util:to_atom(AppName), AppDir} | Acc]); _ -> ?RLX_ERROR({failed_to_parse_override, Override}) end; |