summaryrefslogtreecommitdiff
path: root/src/rebar3.erl
diff options
context:
space:
mode:
authorTristan Sloughter <t@crashfast.com>2016-04-30 08:31:23 -0500
committerTristan Sloughter <t@crashfast.com>2016-04-30 08:31:23 -0500
commit98751fa3fdd12d497ecda7da14f93214c6a09c53 (patch)
tree351e564f536725e647c93bd18f5aaf00b52d3648 /src/rebar3.erl
parentb11d1594c38f21a27e0b33e76a1e95e61dc45acb (diff)
parent243e94391a4ac446cfe0c814750abfb014db9ac4 (diff)
Merge pull request #1121 from frojasg/feature/config-rebar-dir-using-env-var
Allows overwrite default cache dir using REBAR_CACHE_DIR
Diffstat (limited to 'src/rebar3.erl')
-rw-r--r--src/rebar3.erl13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/rebar3.erl b/src/rebar3.erl
index c1a1ae4..ff0ab6a 100644
--- a/src/rebar3.erl
+++ b/src/rebar3.erl
@@ -129,13 +129,20 @@ run_aux(State, RawArgs) ->
%% Initializing project_plugins which can override default providers
State6 = rebar_plugins:project_plugins_install(State5),
State7 = rebar_plugins:top_level_install(State6),
- State8 = rebar_state:default(State7, rebar_state:opts(State7)),
+ State8 = case os:getenv("REBAR_CACHE_DIR") of
+ false ->
+ State7;
+ ConfigFile ->
+ rebar_state:set(State7, global_rebar_dir, ConfigFile)
+ end,
+
+ State9 = rebar_state:default(State8, rebar_state:opts(State8)),
{Task, Args} = parse_args(RawArgs),
- State9 = rebar_state:code_paths(State8, default, code:get_path()),
+ State10 = rebar_state:code_paths(State9, default, code:get_path()),
- rebar_core:init_command(rebar_state:command_args(State9, Args), Task).
+ rebar_core:init_command(rebar_state:command_args(State10, Args), Task).
init_config() ->
%% Initialize logging system