summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rebar_prv_shell.erl19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/rebar_prv_shell.erl b/src/rebar_prv_shell.erl
index b5f3cf8..9ecadf4 100644
--- a/src/rebar_prv_shell.erl
+++ b/src/rebar_prv_shell.erl
@@ -80,11 +80,9 @@ format_error(Reason) ->
shell(State) ->
setup_paths(State),
- ok = reread_config(State),
maybe_boot_apps(State),
setup_shell(),
rebar_agent:start_link(State),
- %% try to read in sys.config file
%% this call never returns (until user quits shell)
timer:sleep(infinity).
@@ -133,11 +131,26 @@ reread_config(State) ->
maybe_boot_apps(State) ->
case rebar_state:get(State, shell_apps, undefined) of
undefined ->
- ok;
+ %% try to read in sys.config file
+ ok = reread_config(State);
Apps ->
+ %% load apps, then check config, then boot them.
+ load_apps(Apps),
+ ok = reread_config(State),
boot_apps(Apps)
end.
+load_apps(Apps) ->
+ [case application:load(App) of
+ ok ->
+ {ok, Ks} = application:get_all_key(App),
+ load_apps(proplists:get_value(applications, Ks));
+ _ ->
+ error % will be caught when starting the app
+ end || App <- Apps,
+ not lists:keymember(App, 1, application:loaded_applications())],
+ ok.
+
boot_apps(Apps) ->
?WARN("The rebar3 shell is a development tool; to deploy "
"applications in production, consider using releases "