summaryrefslogtreecommitdiff
path: root/src/rebar_dir.erl
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2014-12-16 14:53:26 -0500
committerFred Hebert <mononcqc@ferd.ca>2014-12-16 14:53:26 -0500
commitb5500c7301eb6017d956b041daf4001d7b6cb3ff (patch)
treeb698186b6cfe8d64c3a8951748f838a734932998 /src/rebar_dir.erl
parent0672fc45b797b9a496e5bf7797d2b7168f16ca42 (diff)
parent3998dfb049f8e48c4595b72913837a0b8095a0fe (diff)
Merge pull request #56 from tsloughter/profile_deps
rewrite profiles
Diffstat (limited to 'src/rebar_dir.erl')
-rw-r--r--src/rebar_dir.erl35
1 files changed, 7 insertions, 28 deletions
diff --git a/src/rebar_dir.erl b/src/rebar_dir.erl
index e692c65..58ce716 100644
--- a/src/rebar_dir.erl
+++ b/src/rebar_dir.erl
@@ -5,10 +5,6 @@
deps_dir/2,
plugins_dir/1,
lib_dirs/1,
- profile_dir/1,
- default_deps_dir/1,
- default_profile_dir/1,
- default_profile_deps/1,
home_dir/0,
global_config_dir/1,
get_cwd/0,
@@ -26,42 +22,25 @@ base_dir(State) ->
-spec deps_dir(rebar_state:t()) -> file:filename_all().
deps_dir(State) ->
- DepsDir = rebar_state:get(State, deps_dir, ?DEFAULT_DEPS_DIR),
- filename:join(profile_dir(State), DepsDir).
+ filename:join(base_dir(State), rebar_state:get(State, deps_dir, ?DEFAULT_DEPS_DIR)).
-spec deps_dir(file:filename_all(), file:filename_all()) -> file:filename_all().
deps_dir(DepsDir, App) ->
filename:join(DepsDir, App).
--spec default_deps_dir(rebar_state:t()) -> file:filename_all().
-default_deps_dir(State) ->
- DepsDir = rebar_state:get(State, deps_dir, ?DEFAULT_DEPS_DIR),
- filename:join([base_dir(State), "default", DepsDir]).
-
-spec plugins_dir(rebar_state:t()) -> file:filename_all().
plugins_dir(State) ->
- filename:join(base_dir(State), rebar_state:get(State, plugins_dir, ?DEFAULT_PLUGINS_DIR)).
+ case lists:member(global, rebar_state:current_profiles(State)) of
+ true ->
+ filename:join([base_dir(State), global_config_dir(State), rebar_state:get(State, plugins_dir, ?DEFAULT_PLUGINS_DIR)]);
+ false ->
+ filename:join(base_dir(State), rebar_state:get(State, plugins_dir, ?DEFAULT_PLUGINS_DIR))
+ end.
-spec lib_dirs(rebar_state:t()) -> file:filename_all().
lib_dirs(State) ->
rebar_state:get(State, project_app_dirs, ?DEFAULT_PROJECT_APP_DIRS).
--spec default_profile_dir(rebar_state:t()) -> file:filename_all().
-default_profile_dir(State) ->
- filename:join(base_dir(State), "default").
-
-profile_dir(State) ->
- 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) ->
- filename:join(default_profile_dir(State), ?DEFAULT_DEPS_DIR).
-
home_dir() ->
{ok, [[Home]]} = init:get_argument(home),
Home.