summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2015-05-29 13:55:36 +0000
committerFred Hebert <mononcqc@ferd.ca>2015-05-29 13:55:36 +0000
commit2e7eb8f4102900031e2a7cbb28bedf7b0034e392 (patch)
tree919dcf51932ee2917463c5bd27bec37b22cd809b
parentc79eedf2dba5d490988dc59ffe189ba875b750b8 (diff)
Get prebooted apps to acknowledge sys.config
Change the order from load-config -> start-apps to load-apps -> load-config -> start-apps
-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 "