summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Sedov <asedov@platbox.com>2016-10-11 16:30:27 +0300
committerAlexander Sedov <asedov@platbox.com>2016-10-11 16:31:07 +0300
commit4ce21e4c800108030d5c646b226032f460e68065 (patch)
tree25ea3046c761453653c97a29de67b931253ef6fb
parent0afb4c4d477b1c1fba54ad3ef086d0697a5faeaa (diff)
Avoid backward-compatibility-breaking changes.
-rw-r--r--src/rebar_file_utils.erl18
-rw-r--r--src/rebar_prv_common_test.erl6
-rw-r--r--src/rebar_prv_shell.erl4
3 files changed, 15 insertions, 13 deletions
diff --git a/src/rebar_file_utils.erl b/src/rebar_file_utils.erl
index 28cc516..6721b5a 100644
--- a/src/rebar_file_utils.erl
+++ b/src/rebar_file_utils.erl
@@ -72,14 +72,16 @@ consult_config(State, Filename) ->
[T] -> T;
[] -> []
end,
- lists:flatmap(
- fun (SubConfig) when is_list(SubConfig) ->
- case consult_config(State, SubConfig) of
- [] -> consult_config(State, SubConfig ++ ".config");
- X -> X
- end;
- (Entry) -> [Entry]
- end, Config).
+ JoinedConfig = lists:flatmap(
+ fun (SubConfig) when is_list(SubConfig) ->
+ case lists:suffix(".config", SubConfig) of
+ false -> consult_config(State, SubConfig ++ ".config");
+ true -> consult_config(State, SubConfig)
+ end;
+ (Entry) -> [Entry]
+ end, Config),
+ %% Backwards compatibility
+ [JoinedConfig].
format_error({bad_term_file, AppFile, Reason}) ->
io_lib:format("Error reading file ~s: ~s", [AppFile, file:format_error(Reason)]).
diff --git a/src/rebar_prv_common_test.erl b/src/rebar_prv_common_test.erl
index e69d33e..8bfa192 100644
--- a/src/rebar_prv_common_test.erl
+++ b/src/rebar_prv_common_test.erl
@@ -218,9 +218,9 @@ select_tests(_, _, _, {error, _} = Error) -> Error;
select_tests(State, ProjectApps, CmdOpts, CfgOpts) ->
%% set application env if sys_config argument is provided
SysConfigs = sys_config_list(CmdOpts, CfgOpts),
- Configs = lists:map(fun(Filename) ->
- rebar_file_utils:consult_config(State, Filename)
- end, SysConfigs),
+ Configs = lists:flatmap(fun(Filename) ->
+ rebar_file_utils:consult_config(State, Filename)
+ end, SysConfigs),
code:add_pathsa(rebar_state:code_paths(State, all_deps)),
[application:load(Application) || Config <- Configs, {Application, _} <- Config],
rebar_utils:reread_config(Configs),
diff --git a/src/rebar_prv_shell.erl b/src/rebar_prv_shell.erl
index e14ae3a..b7febf8 100644
--- a/src/rebar_prv_shell.erl
+++ b/src/rebar_prv_shell.erl
@@ -331,8 +331,8 @@ reread_config(State) ->
case find_config(State) of
no_config ->
ok;
- Config ->
- _ = rebar_utils:reread_config([Config]),
+ ConfigList ->
+ _ = rebar_utils:reread_config(ConfigList),
ok
end.