summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Smith <dizzyd@dizzyd.com>2010-02-20 13:42:44 -0700
committerDave Smith <dizzyd@dizzyd.com>2010-02-20 13:42:44 -0700
commit496851cefd64d23445535e7bc8c519eaab739ac0 (patch)
tree79070097b9970a563a5453e98e7abd6e7ae71073
parent00c855d030123dcdced313aa388fecf5740a8a35 (diff)
Add support for installing to a target directory as alternative to Erlang base dir
-rw-r--r--src/rebar_otp_app.erl9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/rebar_otp_app.erl b/src/rebar_otp_app.erl
index f20ce0c..8db1044 100644
--- a/src/rebar_otp_app.erl
+++ b/src/rebar_otp_app.erl
@@ -53,14 +53,19 @@ install(Config, File) ->
validate_name(AppName, File),
validate_modules(AppName, proplists:get_value(modules, AppData)),
+ %% Get the target directory. The user can specify a target= directory
+ %% on the command line for convenience, or it defaults to the Erlang
+ %% install dir
+ TargetDir = rebar_config:get_global(target, code:lib_dir()),
+
%% Pull out the vsn and construct identifier
Vsn = proplists:get_value(vsn, AppData),
AppId = ?FMT("~s-~s", [AppName, Vsn]),
- ?CONSOLE("Installing: ~s\n", [AppId]),
+ ?CONSOLE("Installing: ~s to ~s\n", [AppId, TargetDir]),
%% Check the erlang lib directory to see if this app identifier
%% is already present.
- AppDir = filename:join([code:lib_dir(), AppId]),
+ AppDir = filename:join([TargetDir, AppId]),
case filelib:is_dir(AppDir) of
true ->
%% Already exists -- check for force=1 global flag and only