aboutsummaryrefslogtreecommitdiffstats
path: root/src/rlx_cmd_args.erl
diff options
context:
space:
mode:
authorTristan Sloughter <[email protected]>2014-10-06 10:54:30 -0500
committerTristan Sloughter <[email protected]>2014-10-11 11:13:05 -0500
commit12514d2314ed52ba6d26dba7846f51e943057a2f (patch)
treebe83fed15da6a78128d538320eeb6ad31cbcb975 /src/rlx_cmd_args.erl
parente4849bd132b28ba1e1420686aadf8b2136c44fbd (diff)
downloadrelx-12514d2314ed52ba6d26dba7846f51e943057a2f.tar.gz
relx-12514d2314ed52ba6d26dba7846f51e943057a2f.tar.bz2
relx-12514d2314ed52ba6d26dba7846f51e943057a2f.zip
fix tests for providers moved to new app and config list option
Diffstat (limited to 'src/rlx_cmd_args.erl')
-rw-r--r--src/rlx_cmd_args.erl27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/rlx_cmd_args.erl b/src/rlx_cmd_args.erl
index 84aeca5..ac3e718 100644
--- a/src/rlx_cmd_args.erl
+++ b/src/rlx_cmd_args.erl
@@ -90,12 +90,16 @@ format_error({invalid_target, Target}) ->
-spec handle_config(any(), [atom()], proplists:proplist()) ->
{ok, {rlx_state:t(), [string()]}} | relx:error().
handle_config(Opts, Targets, CommandLineConfig) ->
- {ok, Config} = validate_config(proplists:get_value(config, Opts, [])),
- case rlx_state:new(Config, CommandLineConfig, Targets) of
- {error, Error} ->
- {error, Error};
- State ->
- {ok, State}
+ case validate_config(proplists:get_value(config, Opts, [])) of
+ Error = {error, _} ->
+ Error;
+ {ok, Config} ->
+ case rlx_state:new(Config, CommandLineConfig, Targets) of
+ {error, Error} ->
+ {error, Error};
+ State ->
+ {ok, State}
+ end
end.
-spec convert_targets([string()]) -> {ok, release | relup} | relx:error().
@@ -118,7 +122,7 @@ convert_targets([Target | _T], _Acc) ->
?RLX_ERROR({invalid_target, Target}).
-spec validate_config(file:filename() | list() | undefined) ->
- {ok, file:filename() | list() | undefined}.
+ {ok, file:filename() | list() | undefined} | relx:error().
validate_config(undefined) ->
{ok, undefined};
validate_config("") ->
@@ -128,7 +132,14 @@ validate_config(Config) ->
true ->
{ok, filename:absname(Config)};
false ->
- {ok, Config}
+ case io_lib:printable_list(Config) of
+ true ->
+ ?RLX_ERROR({invalid_config_file, Config});
+ false when is_list(Config) ->
+ {ok, Config};
+ false ->
+ ?RLX_ERROR({invalid_config_file, Config})
+ end
end.
run_creates(Opts) ->