diff options
-rw-r--r-- | src/rebar.erl | 12 | ||||
-rw-r--r-- | src/rebar_erlydtl_compiler.erl | 29 |
2 files changed, 32 insertions, 9 deletions
diff --git a/src/rebar.erl b/src/rebar.erl index 833e397..a1abfe3 100644 --- a/src/rebar.erl +++ b/src/rebar.erl @@ -184,10 +184,22 @@ help() -> "[var=value,...] <command,...>", [{"var=value", "rebar global variables (e.g. force=1)"}, {"command", "Command to run (e.g. compile)"}]), + + ?CONSOLE("To see a list of built-in commands, execute rebar -c.~n~n", []), ?CONSOLE( "Type 'rebar help <CMD1> <CMD2>' for help on specific commands." "~n~n", []), ?CONSOLE( + "rebar allows you to abbreviate the command to run:~n" + "$ rebar co # same as rebar compile~n" + "$ rebar eu # same as rebar eunit~n" + "$ rebar g-d # same as rebar get-deps~n" + "$ rebar x eu # same as rebar xref eunit~n" + "$ rebar l-d # same as rebar list-deps~n" + "$ rebar l-d l-t # same as rebar list-deps list-templates~n" + "$ rebar list-d l-te # same as rebar list-deps list-templates~n" + "~n", []), + ?CONSOLE( "Core rebar.config options:~n" " ~p~n" " ~p~n" diff --git a/src/rebar_erlydtl_compiler.erl b/src/rebar_erlydtl_compiler.erl index fea8ea6..556e841 100644 --- a/src/rebar_erlydtl_compiler.erl +++ b/src/rebar_erlydtl_compiler.erl @@ -178,7 +178,7 @@ compile_dtl(Config, Source, Target, DtlOpts) -> ?ERROR("~n===============================================~n" " You need to install erlydtl to compile DTL templates~n" " Download the latest tarball release from github~n" - " http://code.google.com/p/erlydtl/~n" + " https://github.com/erlydtl/erlydtl/releases~n" " and install it into your erlang library dir~n" "===============================================~n~n", []), ?FAIL; @@ -194,15 +194,22 @@ compile_dtl(Config, Source, Target, DtlOpts) -> do_compile(Config, Source, Target, DtlOpts) -> %% TODO: Check last mod on target and referenced DTLs here.. + %% erlydtl >= 0.8.1 does not use the extra indirection using the + %% compiler_options. Kept for backward compatibility with older + %% versions of erlydtl. + CompilerOptions = option(compiler_options, DtlOpts), + + Sorted = proplists:unfold( + lists:sort( + [{out_dir, option(out_dir, DtlOpts)}, + {doc_root, option(doc_root, DtlOpts)}, + {custom_tags_dir, option(custom_tags_dir, DtlOpts)}, + {compiler_options, CompilerOptions} + |CompilerOptions])), + %% ensure that doc_root and out_dir are defined, %% using defaults if necessary - Opts = lists:ukeymerge(1, - DtlOpts, - lists:sort( - [{out_dir, option(out_dir, DtlOpts)}, - {doc_root, option(doc_root, DtlOpts)}, - {custom_tags_dir, option(custom_tags_dir, DtlOpts)}, - {compiler_options, option(compiler_options, DtlOpts)}])), + Opts = lists:ukeymerge(1, DtlOpts, Sorted), ?INFO("Compiling \"~s\" -> \"~s\" with options:~n ~s~n", [Source, Target, io_lib:format("~p", [Opts])]), case erlydtl:compile(Source, @@ -210,6 +217,8 @@ do_compile(Config, Source, Target, DtlOpts) -> Opts) of ok -> ok; + {ok, _Mod} -> + ok; {ok, _Mod, Ws} -> rebar_base_compiler:ok_tuple(Config, Source, Ws); {ok, _Mod, _Bin, Ws} -> @@ -220,7 +229,9 @@ do_compile(Config, Source, Target, DtlOpts) -> rebar_base_compiler:error_tuple(Config, Source, [Error], [], Opts); {error, Msg} -> Es = [{Source, [{erlydtl_parser, Msg}]}], - rebar_base_compiler:error_tuple(Config, Source, Es, [], Opts) + rebar_base_compiler:error_tuple(Config, Source, Es, [], Opts); + {error, Es, Ws} -> + rebar_base_compiler:error_tuple(Config, Source, Es, Ws, Opts) end. module_name(Target) -> |