summaryrefslogtreecommitdiff
path: root/src/rebar_config.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/rebar_config.erl')
-rw-r--r--src/rebar_config.erl16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/rebar_config.erl b/src/rebar_config.erl
index 751e088..56a8828 100644
--- a/src/rebar_config.erl
+++ b/src/rebar_config.erl
@@ -52,7 +52,15 @@ new() ->
#config { dir = rebar_utils:get_cwd(),
opts = []}.
-new(ParentConfig) ->
+new(ConfigFile) when is_list(ConfigFile) ->
+ case consult_file(ConfigFile) of
+ {ok, Opts} ->
+ #config { dir = rebar_utils:get_cwd(),
+ opts = Opts };
+ Other ->
+ ?ABORT("Failed to load ~s: ~p~n", [ConfigFile, Other])
+ end;
+new(#config{}=ParentConfig)->
%% If we are at the top level we might want to load another rebar.config
%% We can be certain that we are at the top level if we don't have any
%% configs yet since if we are at another level we must have some config.
@@ -66,7 +74,7 @@ new(ParentConfig) ->
%% Load terms from rebar.config, if it exists
Dir = rebar_utils:get_cwd(),
ConfigFile = filename:join([Dir, ConfName]),
- Opts = case file:consult(ConfigFile) of
+ Opts = case consult_file(ConfigFile) of
{ok, Terms} ->
%% Found a config file with some terms. We need to
%% be able to distinguish between local definitions
@@ -126,6 +134,10 @@ get_jobs() ->
%% Internal functions
%% ===================================================================
+consult_file(File) ->
+ ?DEBUG("Consult config file ~p~n", [File]),
+ file:consult(File).
+
local_opts([], Acc) ->
lists:reverse(Acc);
local_opts([local | _Rest], Acc) ->