summaryrefslogtreecommitdiff
path: root/src/rebar3.erl
diff options
context:
space:
mode:
authorTristan Sloughter <t@crashfast.com>2014-11-30 10:54:48 -0600
committerTristan Sloughter <t@crashfast.com>2014-11-30 10:54:48 -0600
commit5fdf2f82d57ed0b404e5dfa207b4944f0b8a412d (patch)
treecfa3448da5680d81729e31407d51bc374a2c1ca9 /src/rebar3.erl
parent3abb122b3557b62ce9a621f86f847b997aa540b1 (diff)
add use of REBAR_PROFILE os var to set default profile
Diffstat (limited to 'src/rebar3.erl')
-rw-r--r--src/rebar3.erl22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/rebar3.erl b/src/rebar3.erl
index 9de8236..ebb0ea2 100644
--- a/src/rebar3.erl
+++ b/src/rebar3.erl
@@ -106,20 +106,28 @@ run_aux(State, GlobalPluginProviders, RawArgs) ->
application:start(ssl),
inets:start(),
+ State2 = case os:getenv("REBAR_PROFILE") of
+ false ->
+ State;
+ Profile ->
+ State1 = rebar_state:current_profile(State, list_to_atom(Profile)),
+ rebar_state:default(State1, rebar_state:opts(State1))
+ end,
+
%% Process each command, resetting any state between each one
- BaseDir = rebar_utils:base_dir(State),
- State2 = rebar_state:set(State, base_dir,
- filename:join(filename:absname(rebar_state:dir(State)), BaseDir)),
+ BaseDir = rebar_utils:base_dir(State2),
+ State3 = rebar_state:set(State2, base_dir,
+ filename:join(filename:absname(rebar_state:dir(State2)), BaseDir)),
{ok, Providers} = application:get_env(rebar, providers),
- {ok, PluginProviders, State3} = rebar_plugins:install(State2),
- rebar_core:update_code_path(State3),
+ {ok, PluginProviders, State4} = rebar_plugins:install(State3),
+ rebar_core:update_code_path(State4),
AllProviders = Providers++PluginProviders++GlobalPluginProviders,
- State4 = rebar_state:create_logic_providers(AllProviders, State3),
+ State5 = rebar_state:create_logic_providers(AllProviders, State4),
{Task, Args} = parse_args(RawArgs),
- rebar_core:process_command(rebar_state:command_args(State4, Args), list_to_atom(Task)).
+ rebar_core:process_command(rebar_state:command_args(State5, Args), list_to_atom(Task)).
init_config() ->
%% Initialize logging system