浏览代码

Shell handles all possible relx app formats

The list of applications in the relx config section could contain
tuples. The tuple will either contain a version constraint for the app,
the start type of the app or both.

This fix silently expands `{shell_apps, [Apps]}` to support the same
format.
pull/839/head
Fred Hebert 9 年前
父节点
当前提交
4e30b6f172
共有 1 个文件被更改,包括 15 次插入2 次删除
  1. +15
    -2
      src/rebar_prv_shell.erl

+ 15
- 2
src/rebar_prv_shell.erl 查看文件

@ -190,7 +190,7 @@ load_apps(Apps) ->
load_apps(proplists:get_value(applications, Ks));
_ ->
error % will be caught when starting the app
end || App <- Apps,
end || App <- normalize_load_apps(Apps),
not lists:keymember(App, 1, application:loaded_applications())],
ok.
@ -209,7 +209,8 @@ boot_apps(Apps) ->
?WARN("The rebar3 shell is a development tool; to deploy "
"applications in production, consider using releases "
"(http://www.rebar3.org/v3.0/docs/releases)", []),
Res = [application:ensure_all_started(App) || App <- Apps],
Normalized = normalize_boot_apps(Apps),
Res = [application:ensure_all_started(App) || App <- Normalized],
_ = [?INFO("Booted ~p", [App])
|| {ok, Booted} <- Res,
App <- Booted],
@ -217,6 +218,18 @@ boot_apps(Apps) ->
|| {error, {App, Reason}} <- Res],
ok.
normalize_load_apps([]) -> [];
normalize_load_apps([{App, _} | T]) -> [App | normalize_load_apps(T)];
normalize_load_apps([{App, _Vsn, load} | T]) -> [App | normalize_load_apps(T)];
normalize_load_apps([App | T]) when is_atom(App) -> [App | normalize_load_apps(T)].
normalize_boot_apps([]) -> [];
normalize_boot_apps([{_App, load} | T]) -> normalize_boot_apps(T);
normalize_boot_apps([{_App, _Vsn, load} | T]) -> normalize_boot_apps(T);
normalize_boot_apps([{App, _Vsn} | T]) -> [App | normalize_boot_apps(T)];
normalize_boot_apps([App | T]) when is_atom(App) -> [App | normalize_boot_apps(T)].
remove_error_handler(0) ->
?WARN("Unable to remove simple error_logger handler", []);
remove_error_handler(N) ->

正在加载...
取消
保存