Просмотр исходного кода

Merge pull request #2458 from TheGeorge/cth_readable_config

fix injection of cth_readable to allow for hook configuration
pull/2455/merge
Fred Hebert 4 лет назад
committed by GitHub
Родитель
Сommit
575890f4c2
Не найден GPG ключ соответствующий данной подписи Идентификатор GPG ключа: 4AEE18F83AFDEB23
1 измененных файлов: 12 добавлений и 4 удалений
  1. +12
    -4
      src/rebar_prv_common_test.erl

+ 12
- 4
src/rebar_prv_common_test.erl Просмотреть файл

@ -269,15 +269,23 @@ add_hooks(Opts, State) ->
[{ct_hooks, [cth_readable_failonly, readable_shell_type(Other),
cth_retry] ++ FailFast} | Opts];
{Other, {ct_hooks, Hooks}} ->
%% Make sure hooks are there once only.
%% Make sure hooks are there once only and add wanted hooks that are not defined yet
ReadableHooks = [cth_readable_failonly, readable_shell_type(Other),
cth_retry] ++ FailFast,
AllReadableHooks = [cth_readable_failonly, cth_retry, cth_fail_fast,
cth_readable_shell, cth_readable_compact_shell],
NewHooks = (Hooks -- AllReadableHooks) ++ ReadableHooks,
NewHooks = Hooks ++ [ReadableHook ||
ReadableHook <- ReadableHooks,
not is_defined(ReadableHook, Hooks)
],
lists:keyreplace(ct_hooks, 1, Opts, {ct_hooks, NewHooks})
end.
is_defined(_Key, []) -> false;
is_defined(Key, [Key | _Hs]) -> true;
is_defined(Key, [{Key, _Opts} | _Hs]) -> true;
is_defined(Key, [{Key, _Opts, _Prio} | _Hs]) -> true;
is_defined(Key, [_ | Hs]) -> is_defined(Key, Hs).
readable_shell_type(true) -> cth_readable_shell;
readable_shell_type(compact) -> cth_readable_compact_shell.

Загрузка…
Отмена
Сохранить