summaryrefslogtreecommitdiff
path: root/src/rebar_erlydtl_compiler.erl
diff options
context:
space:
mode:
authorTuncer Ayaz <tuncer.ayaz@gmail.com>2012-11-10 21:59:19 +0100
committerTuncer Ayaz <tuncer.ayaz@gmail.com>2012-12-31 20:45:11 +0100
commit4b8c81fb53e2caaa74a33d5b62664a67427a7bbf (patch)
tree108c21849e5acf68e0e5f621bc9132a960b6dea7 /src/rebar_erlydtl_compiler.erl
parent78fa8fc3d5215e076284b37394e5ca149e945997 (diff)
downloadrebar-4b8c81fb53e2caaa74a33d5b62664a67427a7bbf.tar.gz
Implement 'rebar help CMD1 CMD2' and extend common 'rebar help' msg
* allow plugins to print help message for implemented commands * append core rebar.config options to common 'rebar help' message
Diffstat (limited to 'src/rebar_erlydtl_compiler.erl')
-rw-r--r--src/rebar_erlydtl_compiler.erl31
1 files changed, 25 insertions, 6 deletions
diff --git a/src/rebar_erlydtl_compiler.erl b/src/rebar_erlydtl_compiler.erl
index aef41c5..4449be6 100644
--- a/src/rebar_erlydtl_compiler.erl
+++ b/src/rebar_erlydtl_compiler.erl
@@ -96,6 +96,9 @@
-export([compile/2]).
+%% for internal use only
+-export([info/2]).
+
-include("rebar.hrl").
%% ===================================================================
@@ -123,11 +126,24 @@ compile(Config, _AppFile) ->
true = code:set_path(OrigPath),
Result.
-
%% ===================================================================
%% Internal functions
%% ===================================================================
+info(help, compile) ->
+ ?CONSOLE(
+ "Build ErlyDtl (*.dtl) sources.~n"
+ "~n"
+ "Valid rebar.config options:~n"
+ " ~p~n",
+ [
+ {erlydtl_opts, [{doc_root, "templates"},
+ {out_dir, "ebin"},
+ {source_ext, ".dtl"},
+ {module_ext, "_dtl"},
+ {recursive, true}]}
+ ]).
+
erlydtl_opts(Config) ->
Opts = rebar_config:get(Config, erlydtl_opts, []),
Tuples = [{K,V} || {K,V} <- Opts],
@@ -135,11 +151,14 @@ erlydtl_opts(Config) ->
[] ->
[lists:keysort(1, Tuples)];
Lists ->
- lists:map(fun(L) ->
- lists:keysort(1, lists:foldl(fun({K,T}, Acc) ->
- lists:keystore(K, 1, Acc, {K, T})
- end, Tuples, L))
- end, Lists)
+ lists:map(
+ fun(L) ->
+ lists:keysort(1,
+ lists:foldl(
+ fun({K,T}, Acc) ->
+ lists:keystore(K, 1, Acc, {K, T})
+ end, Tuples, L))
+ end, Lists)
end.
option(Opt, DtlOpts) ->