summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Lavrik <alavrik@piqi.org>2011-05-08 23:46:44 -0500
committerTuncer Ayaz <tuncer.ayaz@gmail.com>2011-09-02 19:21:11 +0200
commit7b90cc47075bfd35dd757d6db6202adf4a72bbe0 (patch)
tree7d64168c795207241c590c350c16de838614f8d5 /src
parented94237dde2de1c9ebfaecdca759b939386c393f (diff)
Export $REBAR_DEPS_DIR and $ERL_LIBS variables
Export two extra environment variables when executing shell commands. These variables are useful for rebar hooks that rely on Erlang applications installed as rebar dependencies. $REBAR_DEPS_DIR contains a fully-qualified name of the directory where rebar stores dependencies. $ERL_LIBS is set to $REBAR_DEPS_DIR or to "$REBAR_DEPS_DIR:$ERL_LIBS", if $ERL_LIBS was defined before.
Diffstat (limited to 'src')
-rw-r--r--src/rebar_deps.erl13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/rebar_deps.erl b/src/rebar_deps.erl
index 63f12d5..21313e3 100644
--- a/src/rebar_deps.erl
+++ b/src/rebar_deps.erl
@@ -31,6 +31,7 @@
-export([preprocess/2,
postprocess/2,
compile/2,
+ setup_env/1,
'check-deps'/2,
'get-deps'/2,
'update-deps'/2,
@@ -92,6 +93,18 @@ postprocess(_Config, _) ->
compile(Config, AppFile) ->
'check-deps'(Config, AppFile).
+%% set REBAR_DEPS_DIR and ERL_LIBS environment variables
+setup_env(_Config) ->
+ {true, DepsDir} = get_deps_dir(),
+ %% include rebar's DepsDir in ERL_LIBS
+ ERL_LIBS = case os:getenv("ERL_LIBS") of
+ false ->
+ {"ERL_LIBS", DepsDir};
+ PrevValue ->
+ {"ERL_LIBS", DepsDir ++ ":" ++ PrevValue}
+ end,
+ [{"REBAR_DEPS_DIR", DepsDir}, ERL_LIBS].
+
'check-deps'(Config, _) ->
%% Get the list of immediate (i.e. non-transitive) deps that are missing
Deps = rebar_config:get_local(Config, deps, []),