summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Sloughter <tristan.sloughter@gmail.com>2015-09-26 12:39:55 -0500
committerTristan Sloughter <tristan.sloughter@gmail.com>2015-09-26 12:39:55 -0500
commitb6afc1d33e0ebd3897fe067ad392a394d70287a2 (patch)
treeec8ac7f9c1d433e8e683b4370351c728faf11d10
parent7ec6dd725ae3029beb8baa80dcc89e3b572316cb (diff)
parent4e30b6f172acb0287f98390abf420774e9cc496f (diff)
Merge pull request #839 from rebar/fix-shell-load
Shell handles all possible relx app formats
-rw-r--r--src/rebar_prv_shell.erl17
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) ->