diff options
author | Fred Hebert <mononcqc@ferd.ca> | 2015-09-26 17:00:50 +0000 |
---|---|---|
committer | Fred Hebert <mononcqc@ferd.ca> | 2015-09-26 17:14:26 +0000 |
commit | 4e30b6f172acb0287f98390abf420774e9cc496f (patch) | |
tree | ec8ac7f9c1d433e8e683b4370351c728faf11d10 | |
parent | 7ec6dd725ae3029beb8baa80dcc89e3b572316cb (diff) |
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.
-rw-r--r-- | src/rebar_prv_shell.erl | 17 |
1 files changed, 15 insertions, 2 deletions
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) -> |