From 2e7eb8f4102900031e2a7cbb28bedf7b0034e392 Mon Sep 17 00:00:00 2001 From: Fred Hebert Date: Fri, 29 May 2015 13:55:36 +0000 Subject: Get prebooted apps to acknowledge sys.config Change the order from load-config -> start-apps to load-apps -> load-config -> start-apps --- src/rebar_prv_shell.erl | 19 ++++++++++++++++--- 1 file 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 " -- cgit v1.1