From d201d7f4a6e6058c272fe75bb832dc78a418272f Mon Sep 17 00:00:00 2001 From: Fred Hebert Date: Fri, 18 Dec 2015 22:04:44 -0500 Subject: A bad template index does not crash; shows warning This should fix #955 The test is implicit as a bad index previously silently crashed rebar3. By adding the bad index to the `new` suite's files, we can show that things keep running. --- src/rebar_prv_new.erl | 20 ++++++++++--- src/rebar_templater.erl | 18 +++++++---- .../.rebar3/templates/bad_index/LICENSE.dtl | 29 ++++++++++++++++++ .../.rebar3/templates/bad_index/README.md.dtl | 9 ++++++ .../.rebar3/templates/bad_index/app.erl.dtl | 27 +++++++++++++++++ .../.rebar3/templates/bad_index/bad_index.template | 13 ++++++++ .../.rebar3/templates/bad_index/gitignore.dtl | 18 +++++++++++ .../templates/bad_index/otp_app.app.src.dtl | 12 ++++++++ .../.rebar3/templates/bad_index/rebar.config.dtl | 2 ++ .../.rebar3/templates/bad_index/sup.erl.dtl | 35 ++++++++++++++++++++++ 10 files changed, 173 insertions(+), 10 deletions(-) create mode 100644 test/rebar_new_SUITE_data/.rebar3/templates/bad_index/LICENSE.dtl create mode 100644 test/rebar_new_SUITE_data/.rebar3/templates/bad_index/README.md.dtl create mode 100644 test/rebar_new_SUITE_data/.rebar3/templates/bad_index/app.erl.dtl create mode 100644 test/rebar_new_SUITE_data/.rebar3/templates/bad_index/bad_index.template create mode 100644 test/rebar_new_SUITE_data/.rebar3/templates/bad_index/gitignore.dtl create mode 100644 test/rebar_new_SUITE_data/.rebar3/templates/bad_index/otp_app.app.src.dtl create mode 100644 test/rebar_new_SUITE_data/.rebar3/templates/bad_index/rebar.config.dtl create mode 100644 test/rebar_new_SUITE_data/.rebar3/templates/bad_index/sup.erl.dtl diff --git a/src/rebar_prv_new.erl b/src/rebar_prv_new.erl index 28572a9..71560d5 100644 --- a/src/rebar_prv_new.erl +++ b/src/rebar_prv_new.erl @@ -7,6 +7,7 @@ format_error/1]). -include("rebar.hrl"). +-include_lib("providers/include/providers.hrl"). -define(PROVIDER, new). -define(DEPS, []). @@ -35,16 +36,16 @@ do(State) -> case strip_flags(rebar_state:command_args(State)) of ["help"] -> ?CONSOLE("Call `rebar3 new help