aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.travis.yml7
-rw-r--r--Makefile5
-rw-r--r--rebar.config6
-rw-r--r--rebar.config.script2
-rw-r--r--src/rlx_prv_overlay.erl37
5 files changed, 43 insertions, 14 deletions
diff --git a/.travis.yml b/.travis.yml
index 9b12a1c..764fe9c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,8 @@
language: erlang
otp_release:
+ - 17.0-rc1
+ - R16B03-1
+ - R16B03
- R16B02
- R16B01
- R16B
@@ -10,7 +13,7 @@ otp_release:
- R14B04
- R14B03
- R14B02
-script: "make rebuild"
+script: "make get-rebar && make rebuild"
branches:
only:
- master
@@ -21,4 +24,4 @@ notifications:
channels:
- "irc.freenode.org#erlware"
use_notice: true
- skip_join: true \ No newline at end of file
+ skip_join: true
diff --git a/Makefile b/Makefile
index 4d94cc7..b7ee1e5 100644
--- a/Makefile
+++ b/Makefile
@@ -31,6 +31,11 @@ endif
REBAR=$(shell which rebar)
+# If building on travis, use the rebar in the current directory
+ifeq ($(TRAVIS),true)
+REBAR=$(CURDIR)/rebar
+endif
+
ifeq ($(REBAR),)
REBAR=$(CURDIR)/rebar
endif
diff --git a/rebar.config b/rebar.config
index 4337d5f..858add2 100644
--- a/rebar.config
+++ b/rebar.config
@@ -2,15 +2,15 @@
%% Dependencies ================================================================
{deps, [{rebar_vsn_plugin, ".*",
{git, "https://github.com/erlware/rebar_vsn_plugin.git",
- {tag, "master"}}},
+ {branch, "master"}}},
{neotoma, ".*",
{git, "https://github.com/seancribbs/neotoma.git", {branch, "master"}}},
{erlware_commons, ".*",
{git, "https://github.com/erlware/erlware_commons.git",
{branch, "master"}}},
{erlydtl, ".*",
- {git, "https://github.com/evanmiller/erlydtl.git",
- {tag, "0.8.0"}}},
+ {git, "https://github.com/erlydtl/erlydtl.git",
+ {tag, "0.9.0"}}},
{getopt, "",
{git, "https://github.com/jcomellas/getopt.git",
{branch, "master"}}}]}.
diff --git a/rebar.config.script b/rebar.config.script
index c19a751..819fc7b 100644
--- a/rebar.config.script
+++ b/rebar.config.script
@@ -1,4 +1,4 @@
-{match, [ErtsNumber]} = re:run(erlang:system_info(otp_release), "R(\\d+).+", [{capture, [1], list}]),
+{match, [ErtsNumber]} = re:run(erlang:system_info(otp_release), "(\\d+)", [{capture, [0], list}]),
ErtsVsn = erlang:list_to_integer(ErtsNumber),
Opts1 = case lists:keysearch(erl_opts, 1, CONFIG) of
{value, {erl_opts, Opts0}} ->
diff --git a/src/rlx_prv_overlay.erl b/src/rlx_prv_overlay.erl
index e8d2547..882c67e 100644
--- a/src/rlx_prv_overlay.erl
+++ b/src/rlx_prv_overlay.erl
@@ -30,6 +30,8 @@
-define(DIRECTORY_RE, ".*(\/|\\\\)$").
+-define(ERLYDTL_COMPILE_OPTS, [report_warnings, return_errors, {auto_escape, false}]).
+
-include("relx.hrl").
%%============================================================================
@@ -83,8 +85,8 @@ format_error({unable_to_render_template, FromFile, Reason}) ->
io_lib:format("Unable to render template ~s because ~p",
[FromFile, Reason]);
format_error({unable_to_compile_template, FromFile, Reason}) ->
- io_lib:format("Unable to compile template ~s because ~p",
- [FromFile, Reason]);
+ io_lib:format("Unable to compile template ~s because \n~s",
+ [FromFile, [format_errors(F, Es) || {F, Es} <- Reason]]);
format_error({unable_to_make_dir, Absolute, Error}) ->
io_lib:format("Unable to make directory ~s because ~p",
[Absolute, Error]).
@@ -92,6 +94,25 @@ format_error({unable_to_make_dir, Absolute, Error}) ->
%%%===================================================================
%%% Internal Functions
%%%===================================================================
+
+format_errors(File, [{none, Mod, E}|Es]) ->
+ [io_lib:format("~s~s: ~ts~n",
+ [rlx_util:indent(2), File,
+ Mod:format_error(E)])
+ |format_errors(File, Es)];
+format_errors(File, [{{Line, Col}, Mod, E}|Es]) ->
+ [io_lib:format("~s~s:~w:~w: ~ts~n",
+ [rlx_util:indent(2), File, Line, Col,
+ Mod:format_error(E)])
+ |format_errors(File, Es)];
+format_errors(File, [{Line, Mod, E}|Es]) ->
+ [io_lib:format("~s~s:~w: ~ts~n",
+ [rlx_util:indent(2), File, Line,
+ Mod:format_error(E)])
+ |format_errors(File, Es)];
+format_errors(_, []) -> [].
+
+
-spec generate_overlay_vars(rlx_state:t(), rlx_release:t()) ->
{ok, rlx_state:t()} | relx:error().
generate_overlay_vars(State, Release) ->
@@ -262,7 +283,7 @@ handle_errors(State, Result) ->
{ok, rlx_state:t()} | relx:error().
do_individual_overlay(State, OverlayVars, {mkdir, Dir}) ->
ModuleName = make_template_name("rlx_mkdir_template", Dir),
- case erlydtl:compile(erlang:iolist_to_binary(Dir), ModuleName) of
+ case erlydtl:compile(erlang:iolist_to_binary(Dir), ModuleName, ?ERLYDTL_COMPILE_OPTS) of
{ok, ModuleName} ->
case render(ModuleName, OverlayVars) of
{ok, IoList} ->
@@ -278,7 +299,7 @@ do_individual_overlay(State, OverlayVars, {mkdir, Dir}) ->
{error, Error} ->
?RLX_ERROR({dir_render_failed, Dir, Error})
end;
- {error, Reason} ->
+ {error, Reason, _Warnings} ->
?RLX_ERROR({unable_to_compile_template, Dir, Reason})
end;
do_individual_overlay(State, OverlayVars, {copy, From, To}) ->
@@ -361,7 +382,7 @@ is_directory(ToFile0, ToFile1) ->
ok | relx:error().
render_template(OverlayVars, Data) ->
TemplateName = make_template_name("rlx_template_renderer", Data),
- case erlydtl:compile(Data, TemplateName) of
+ case erlydtl:compile(Data, TemplateName, ?ERLYDTL_COMPILE_OPTS) of
Good when Good =:= ok; Good =:= {ok, TemplateName} ->
case render(TemplateName, OverlayVars) of
{ok, IoData} ->
@@ -369,7 +390,7 @@ render_template(OverlayVars, Data) ->
{error, Reason} ->
?RLX_ERROR({unable_to_render_template, Data, Reason})
end;
- {error, Reason} ->
+ {error, Reason, _Warnings} ->
?RLX_ERROR({unable_to_compile_template, Data, Reason})
end.
@@ -397,7 +418,7 @@ write_template(OverlayVars, FromFile, ToFile) ->
fun((term()) -> {ok, rlx_state:t()} | relx:error())) ->
{ok, rlx_state:t()} | relx:error().
file_render_do(OverlayVars, Data, TemplateName, NextAction) ->
- case erlydtl:compile(erlang:iolist_to_binary(Data), TemplateName) of
+ case erlydtl:compile(erlang:iolist_to_binary(Data), TemplateName, ?ERLYDTL_COMPILE_OPTS) of
{ok, TemplateName} ->
case render(TemplateName, OverlayVars) of
{ok, IoList} ->
@@ -405,7 +426,7 @@ file_render_do(OverlayVars, Data, TemplateName, NextAction) ->
{error, Error} ->
?RLX_ERROR({render_failed, Data, Error})
end;
- {error, Reason} ->
+ {error, Reason, _Warnings} ->
?RLX_ERROR({unable_to_compile_template, Data, Reason})
end.