summaryrefslogtreecommitdiff
path: root/src/rebar_utils.erl
diff options
context:
space:
mode:
authorTristan Sloughter <t@crashfast.com>2014-11-29 17:05:21 -0600
committerTristan Sloughter <t@crashfast.com>2014-11-29 17:05:21 -0600
commit9afd6e89b2dde0f8261bfd9eb371ffd33af0d889 (patch)
tree42c8e6670831e3d469c5667d069e35603762bc26 /src/rebar_utils.erl
parentbdd5d902d9e66cd466a86c94d9484e68d637f888 (diff)
global plugins install to global config directory
Diffstat (limited to 'src/rebar_utils.erl')
-rw-r--r--src/rebar_utils.erl14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl
index d28d761..c84dcf2 100644
--- a/src/rebar_utils.erl
+++ b/src/rebar_utils.erl
@@ -36,6 +36,7 @@
default_profile_dir/1,
default_profile_deps/1,
home_dir/0,
+ global_config_dir/1,
droplast/1,
filtermap/2,
@@ -108,10 +109,13 @@ lib_dirs(State) ->
default_profile_dir(State) ->
filename:join(base_dir(State), "default").
--spec profile_dir(rebar_state:t()) -> file:filename_all().
profile_dir(State) ->
- Profile = rebar_state:current_profile(State),
- filename:join(base_dir(State), atom_to_list(Profile)).
+ case rebar_state:current_profile(State) of
+ global ->
+ global_config_dir(State);
+ Profile ->
+ filename:join(base_dir(State), atom_to_list(Profile))
+ end.
-spec default_profile_deps(rebar_state:t()) -> file:filename_all().
default_profile_deps(State) ->
@@ -121,6 +125,10 @@ home_dir() ->
{ok, [[Home]]} = init:get_argument(home),
Home.
+global_config_dir(State) ->
+ Home = home_dir(),
+ rebar_state:get(State, global_rebar_dir, filename:join(Home, ?CONFIG_DIR)).
+
droplast(L) ->
lists:reverse(tl(lists:reverse(L))).