diff options
author | Tuncer Ayaz <tuncer.ayaz@gmail.com> | 2011-03-12 10:32:58 +0100 |
---|---|---|
committer | Tuncer Ayaz <tuncer.ayaz@gmail.com> | 2011-03-12 16:32:44 +0100 |
commit | bc98a4820ed17ebcfcf98440f6d2cb63826bd1fb (patch) | |
tree | b439ae39d41b18a10c42c51f2856354c528cff89 | |
parent | e76770511a6bae6fe9d23e7821db8d32e897f9a8 (diff) |
Simplify hook changes to rebar_core
-rw-r--r-- | src/rebar_core.erl | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/rebar_core.erl b/src/rebar_core.erl index 3f8068a..42f301f 100644 --- a/src/rebar_core.erl +++ b/src/rebar_core.erl @@ -305,19 +305,13 @@ run_modules([Module | Rest], Command, Config, File) -> end. apply_hooks(Mode, Config, Command) -> - case rebar_config:get_local(Config, Mode, []) of - [] -> - skip; - Hooks when is_list(Hooks) -> - lists:foreach(fun apply_hook/1, - [{Command, Hook} || Hook <- Hooks]) - end. + Hooks = rebar_config:get_local(Config, Mode, []), + lists:foreach(fun apply_hook/1, + [Hook || Hook <- Hooks, element(1, Hook) =:= Command]). -apply_hook({Command, {Command, Hook}}) -> +apply_hook({Command, Hook}) -> Msg = lists:flatten(io_lib:format("Command [~p] failed!~n", [Command])), - rebar_utils:sh(Hook, [{abort_on_error, Msg}]); -apply_hook({Command, {HookCmd, _}}) when Command =/= HookCmd -> - skip. + rebar_utils:sh(Hook, [{abort_on_error, Msg}]). acc_modules(Modules, Command, Config, File) -> acc_modules(select_modules(Modules, Command, []), |