diff options
author | Fred Hebert <mononcqc@ferd.ca> | 2016-06-11 18:47:47 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-11 18:47:47 -0400 |
commit | caaa4be10de29db59ff94949ba6ef7312b7feb8d (patch) | |
tree | db25e5c5078769f8af3f9ae839365ac7758ade83 /src/rebar_file_utils.erl | |
parent | e337793e9fda77462d5d5dec7ed0fa3fd11483d7 (diff) | |
parent | 854abc1bda6457ababae18d115e2aed26cce6405 (diff) |
Merge pull request #1231 from tsloughter/ct_sys_config
add support for passing a sys_config to common test
Diffstat (limited to 'src/rebar_file_utils.erl')
-rw-r--r-- | src/rebar_file_utils.erl | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/rebar_file_utils.erl b/src/rebar_file_utils.erl index 0f84520..45da782 100644 --- a/src/rebar_file_utils.erl +++ b/src/rebar_file_utils.erl @@ -27,6 +27,7 @@ -module(rebar_file_utils). -export([try_consult/1, + consult_config/2, format_error/1, symlink_or_copy/2, rm_rf/1, @@ -61,6 +62,20 @@ try_consult(File) -> throw(?PRV_ERROR({bad_term_file, File, Reason})) end. +-spec consult_config(rebar_state:t(), string()) -> [[tuple()]]. +consult_config(State, Filename) -> + Fullpath = filename:join(rebar_dir:root_dir(State), Filename), + ?DEBUG("Loading configuration from ~p", [Fullpath]), + Config = case try_consult(Fullpath) of + [T] -> T; + [] -> [] + end, + SubConfigs = [consult_config(State, Entry ++ ".config") || + Entry <- Config, is_list(Entry) + ], + + [Config | lists:merge(SubConfigs)]. + format_error({bad_term_file, AppFile, Reason}) -> io_lib:format("Error reading file ~s: ~s", [AppFile, file:format_error(Reason)]). |