Pārlūkot izejas kodu

Add support for installing to a target directory as alternative to Erlang base dir

pull/3/head
Dave Smith pirms 15 gadiem
vecāks
revīzija
496851cefd
1 mainītis faili ar 7 papildinājumiem un 2 dzēšanām
  1. +7
    -2
      src/rebar_otp_app.erl

+ 7
- 2
src/rebar_otp_app.erl Parādīt failu

@ -53,14 +53,19 @@ install(Config, File) ->
validate_name(AppName, File), validate_name(AppName, File),
validate_modules(AppName, proplists:get_value(modules, AppData)), 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 %% Pull out the vsn and construct identifier
Vsn = proplists:get_value(vsn, AppData), Vsn = proplists:get_value(vsn, AppData),
AppId = ?FMT("~s-~s", [AppName, Vsn]), 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 %% Check the erlang lib directory to see if this app identifier
%% is already present. %% is already present.
AppDir = filename:join([code:lib_dir(), AppId]),
AppDir = filename:join([TargetDir, AppId]),
case filelib:is_dir(AppDir) of case filelib:is_dir(AppDir) of
true -> true ->
%% Already exists -- check for force=1 global flag and only %% Already exists -- check for force=1 global flag and only

Notiek ielāde…
Atcelt
Saglabāt