summaryrefslogtreecommitdiff
path: root/src/rebar_dir.erl
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2015-05-19 08:50:10 -0400
committerFred Hebert <mononcqc@ferd.ca>2015-05-19 08:50:10 -0400
commitf9c9e0eacca3e9e42cf7dccbb178dd6c7b8f5c68 (patch)
tree36f5b7a5ff2f151542dca03232f5581bde7e107f /src/rebar_dir.erl
parent76dafaffcd957e35a3844294b1cacf92bba02cc6 (diff)
parent3a201230fedb01ba258c291ed56450300caeac56 (diff)
Merge pull request #441 from tsloughter/global_plugins
install plugins from the global config to ~/.cache/plugins
Diffstat (limited to 'src/rebar_dir.erl')
-rw-r--r--src/rebar_dir.erl13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/rebar_dir.erl b/src/rebar_dir.erl
index a94c72d..8d8a39e 100644
--- a/src/rebar_dir.erl
+++ b/src/rebar_dir.erl
@@ -30,14 +30,15 @@ base_dir(State) ->
-spec profile_dir(rebar_state:t(), [atom()]) -> file:filename_all().
profile_dir(State, Profiles) ->
- ProfilesStrings = case [ec_cnv:to_list(P) || P <- Profiles] of
- ["default"] -> ["default"];
+ {BaseDir, ProfilesStrings} = case [ec_cnv:to_list(P) || P <- Profiles] of
+ ["global"] -> {?MODULE:global_cache_dir(State), [""]};
+ ["default"] -> {rebar_state:get(State, base_dir, ?DEFAULT_BASE_DIR), ["default"]};
%% drop `default` from the profile dir if it's implicit and reverse order
%% of profiles to match order passed to `as`
- ["default"|Rest] -> Rest
+ ["default"|Rest] -> {rebar_state:get(State, base_dir, ?DEFAULT_BASE_DIR), Rest}
end,
ProfilesDir = string:join(ProfilesStrings, "+"),
- filename:join(rebar_state:get(State, base_dir, ?DEFAULT_BASE_DIR), ProfilesDir).
+ filename:join(BaseDir, ProfilesDir).
-spec deps_dir(rebar_state:t()) -> file:filename_all().
@@ -81,11 +82,11 @@ global_config_dir(State) ->
rebar_state:get(State, global_rebar_dir, filename:join([Home, ".config", "rebar3"])).
global_config(State) ->
- filename:join(global_config_dir(State), "config").
+ filename:join(global_config_dir(State), "rebar.config").
global_config() ->
Home = home_dir(),
- filename:join([Home, ".config", "rebar3", "config"]).
+ filename:join([Home, ".config", "rebar3", "rebar.config"]).
global_cache_dir(State) ->
Home = home_dir(),