diff options
author | Fred Hebert <mononcqc@ferd.ca> | 2015-05-22 14:34:46 -0400 |
---|---|---|
committer | Fred Hebert <mononcqc@ferd.ca> | 2015-05-22 14:34:46 -0400 |
commit | 5f577e2ab15d0aa3b6650f4e3d1ee086be3dc736 (patch) | |
tree | e7ae0873e879bf92ac9f9c51926f34781cab9d16 /src/rebar_prv_shell.erl | |
parent | b7acb56f4710fe3fd11163f6874f82f0008625b6 (diff) | |
parent | 476a80c33ee0d835e58eae3b3bb396eae401b9ec (diff) |
Merge pull request #470 from tsloughter/master
print and format error message for bad .app files and all bad configs
Diffstat (limited to 'src/rebar_prv_shell.erl')
-rw-r--r-- | src/rebar_prv_shell.erl | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/src/rebar_prv_shell.erl b/src/rebar_prv_shell.erl index ec2f692..8c0b7ff 100644 --- a/src/rebar_prv_shell.erl +++ b/src/rebar_prv_shell.erl @@ -136,20 +136,18 @@ reread_config(State) -> case find_config(State) of no_config -> ok; - {ok, ConfigList} -> + ConfigList -> lists:foreach(fun ({Application, Items}) -> lists:foreach(fun ({Key, Val}) -> application:set_env(Application, Key, Val) end, Items) end, - ConfigList); - {error, Error} -> - ?ABORT("Error while attempting to read configuration file: ~p", [Error]) + ConfigList) end. % First try the --config flag, then try the relx sys_config --spec find_config(rebar_state:t()) -> {ok, [tuple()]}|no_config|{error, tuple()}. +-spec find_config(rebar_state:t()) -> [tuple()] | no_config. find_config(State) -> case find_config_option(State) of no_config -> @@ -158,7 +156,7 @@ find_config(State) -> Result end. --spec find_config_option(rebar_state:t()) -> {ok, [tuple()]}|no_config|{error, tuple()}. +-spec find_config_option(rebar_state:t()) -> [tuple()] | no_config. find_config_option(State) -> {Opts, _} = rebar_state:command_parsed_args(State), case proplists:get_value(config, Opts) of @@ -168,7 +166,7 @@ find_config_option(State) -> consult_config(State, Filename) end. --spec find_config_relx(rebar_state:t()) -> {ok, [tuple()]}|no_config|{error, tuple()}. +-spec find_config_relx(rebar_state:t()) -> [tuple()] | no_config. find_config_relx(State) -> case proplists:get_value(sys_config, rebar_state:get(State, relx, [])) of undefined -> @@ -181,11 +179,4 @@ find_config_relx(State) -> consult_config(State, Filename) -> Fullpath = filename:join(rebar_dir:root_dir(State), Filename), ?DEBUG("Loading configuration from ~p", [Fullpath]), - case file:consult(Fullpath) of - {ok, [Config]} -> - {ok, Config}; - {ok, []} -> - {ok, []}; - {error, Error} -> - {error, {Error, Fullpath}} - end. + rebar_file_utils:try_consult(Fullpath). |