summaryrefslogtreecommitdiff
path: root/src/rebar_prv_erlydtl_compiler.erl
diff options
context:
space:
mode:
authorTristan Sloughter <t@crashfast.com>2015-04-17 08:32:12 -0500
committerTristan Sloughter <t@crashfast.com>2015-04-17 08:32:12 -0500
commit5f89e9c28d5932cc7a3a7075d4a6eb1136169a7d (patch)
treeb6fa53a96f82fbe84f2b076809a9afb6193fda77 /src/rebar_prv_erlydtl_compiler.erl
parentf82874de5802dbf9e2029a9aa07c7cbae12a1324 (diff)
fix erlydtl error return and dir to run from
Diffstat (limited to 'src/rebar_prv_erlydtl_compiler.erl')
-rw-r--r--src/rebar_prv_erlydtl_compiler.erl33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/rebar_prv_erlydtl_compiler.erl b/src/rebar_prv_erlydtl_compiler.erl
index 65f0094..c5fb77a 100644
--- a/src/rebar_prv_erlydtl_compiler.erl
+++ b/src/rebar_prv_erlydtl_compiler.erl
@@ -130,20 +130,23 @@ do(State) ->
%% We need a project app to store the results under in _build
%% If there is more than 1 project app, check for an app config
%% if that doesn't exist, error out.
- App1 = case rebar_state:project_apps(State) of
- [App] ->
- App;
- Apps ->
- case option(app, DtlOpts) of
- undefined ->
- ?PRV_ERROR(no_main_app);
- Name ->
- rebar_app_utils:find(Name, Apps)
- end
- end,
+ case rebar_state:project_apps(State) of
+ [App] ->
+ run_erlydtl(App, DtlOpts, State),
+ {ok, State};
+ Apps ->
+ case option(app, DtlOpts) of
+ undefined ->
+ ?PRV_ERROR(no_main_app);
+ Name ->
+ run_erlydtl(rebar_app_utils:find(Name, Apps), DtlOpts, State),
+ {ok, State}
+ end
+ end.
- Dir = rebar_app_info:dir(App1),
- OutDir = rebar_app_info:ebin_dir(App1),
+run_erlydtl(App, DtlOpts, State) ->
+ Dir = rebar_app_info:dir(App),
+ OutDir = rebar_app_info:ebin_dir(App),
rebar_base_compiler:run(State,
[],
filename:join(Dir, option(doc_root, DtlOpts)),
@@ -154,9 +157,7 @@ do(State) ->
compile_dtl(C, S, T, DtlOpts, Dir, OutDir)
end,
[{check_last_mod, false},
- {recursive, option(recursive, DtlOpts)}]),
-
- {ok, State}.
+ {recursive, option(recursive, DtlOpts)}]).
-spec format_error(any()) -> iolist().
format_error(no_main_app) ->