From 4e30b6f172acb0287f98390abf420774e9cc496f Mon Sep 17 00:00:00 2001 From: Fred Hebert Date: Sat, 26 Sep 2015 17:00:50 +0000 Subject: 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. --- src/rebar_prv_shell.erl | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/rebar_prv_shell.erl b/src/rebar_prv_shell.erl index d965e1d..4cf1e04 100644 --- a/src/rebar_prv_shell.erl +++ b/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) -> -- cgit v1.1