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_app_discover.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_app_discover.erl')
-rw-r--r-- | src/rebar_app_discover.erl | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/src/rebar_app_discover.erl b/src/rebar_app_discover.erl index 4eda199..34310c7 100644 --- a/src/rebar_app_discover.erl +++ b/src/rebar_app_discover.erl @@ -182,25 +182,21 @@ app_dir(AppFile) -> -spec create_app_info(file:name(), file:name()) -> rebar_app_info:t() | {error, term()}. create_app_info(AppDir, AppFile) -> - case file:consult(AppFile) of - {ok, [{application, AppName, AppDetails}]} -> - AppVsn = proplists:get_value(vsn, AppDetails), - Applications = proplists:get_value(applications, AppDetails, []), - IncludedApplications = proplists:get_value(included_applications, AppDetails, []), - {ok, AppInfo} = rebar_app_info:new(AppName, AppVsn, AppDir, []), - AppInfo1 = rebar_app_info:applications( - rebar_app_info:app_details(AppInfo, AppDetails), - IncludedApplications++Applications), - Valid = case rebar_app_utils:validate_application_info(AppInfo1) of - true -> - true; - _ -> - false - end, - rebar_app_info:dir(rebar_app_info:valid(AppInfo1, Valid), AppDir); - {error, Reason} -> - {error, Reason} - end. + [{application, AppName, AppDetails}] = rebar_file_utils:try_consult(AppFile), + AppVsn = proplists:get_value(vsn, AppDetails), + Applications = proplists:get_value(applications, AppDetails, []), + IncludedApplications = proplists:get_value(included_applications, AppDetails, []), + {ok, AppInfo} = rebar_app_info:new(AppName, AppVsn, AppDir, []), + AppInfo1 = rebar_app_info:applications( + rebar_app_info:app_details(AppInfo, AppDetails), + IncludedApplications++Applications), + Valid = case rebar_app_utils:validate_application_info(AppInfo1) of + true -> + true; + _ -> + false + end, + rebar_app_info:dir(rebar_app_info:valid(AppInfo1, Valid), AppDir). dedup([]) -> []; dedup([A]) -> [A]; |