Merge branch 'master' of git://github.com/basho/rebar

Conflicts:
	priv/templates/simplenode.runner
This commit is contained in:
Alexey Romanov 2010-12-11 15:58:20 +03:00
commit 2ceeb32721
5 changed files with 58 additions and 10 deletions

4
THANKS
View file

@ -30,3 +30,7 @@ Misha Gorodnitzky
Adam Kocoloski Adam Kocoloski
Joseph Wayne Norton Joseph Wayne Norton
Mihai Balea Mihai Balea
Matthew Batema
Alexey Romanov
Benjamin Nortier
Magnus Klaar

View file

@ -66,7 +66,22 @@ case "$1" in
stop) stop)
# Wait for the node to completely stop... # Wait for the node to completely stop...
PID=`ps -ef|grep "$RUNNER_BASE_DIR/.*/[b]eam"|awk '{print $2}'` case `uname -s` in
Linux|Darwin|FreeBSD|DragonFly|NetBSD|OpenBSD)
# PID COMMAND
PID=`ps ax -o pid= -o command=|\
grep "$RUNNER_BASE_DIR/.*/[b]eam"|cut -d' ' -f1`
;;
SunOS)
# PID COMMAND
PID=`ps -ef -o pid= -o args=|\
grep "$RUNNER_BASE_DIR/.*/[b]eam"|cut -d' ' -f1`
;;
CYGWIN*)
# UID PID PPID TTY STIME COMMAND
PID=`ps -efW|grep "$RUNNER_BASE_DIR/.*/[b]eam"|cut -d' ' -f2`
;;
esac
$NODETOOL stop $NODETOOL stop
while `kill -0 $PID 2>/dev/null`; while `kill -0 $PID 2>/dev/null`;
do do

View file

@ -190,8 +190,6 @@ to_s(Val) when is_integer(Val) ->
integer_to_list(Val); integer_to_list(Val);
to_s(Val) when is_float(Val) -> to_s(Val) when is_float(Val) ->
io_lib:format("~.2f", [Val]); io_lib:format("~.2f", [Val]);
to_s(Val) when is_boolean(Val) ->
Val;
to_s(Val) when is_atom(Val) -> to_s(Val) when is_atom(Val) ->
atom_to_list(Val); atom_to_list(Val);
to_s(Val) -> to_s(Val) ->

View file

@ -130,13 +130,22 @@ make_cmd(TestDir, Config) ->
Include = "" Include = ""
end, end,
%% Add the code path of the rebar process to the code path. This
%% includes the dependencies in the code path. The directories
%% that are part of the root Erlang install are filtered out to
%% avoid duplication
R = code:root_dir(),
NonLibCodeDirs = [P || P <- code:get_path(), lists:prefix(R, P) == false],
CodeDirs = [io_lib:format("\"~s\"", [Dir]) ||
Dir <- [EbinDir|NonLibCodeDirs]],
CodePathString = string:join(CodeDirs, " "),
Cmd = ?FMT("erl " % should we expand ERL_PATH? Cmd = ?FMT("erl " % should we expand ERL_PATH?
" -noshell -pa \"~s\" ~s" " -noshell -pa ~s ~s"
" -s ct_run script_start -s erlang halt" " -s ct_run script_start -s erlang halt"
" -name test@~s" " -name test@~s"
" -logdir \"~s\"" " -logdir \"~s\""
" -env TEST_DIR \"~s\"", " -env TEST_DIR \"~s\"",
[EbinDir, [CodePathString,
Include, Include,
net_adm:localhost(), net_adm:localhost(),
LogDir, LogDir,

View file

@ -297,11 +297,21 @@ download_source(AppDir, {svn, Url, Rev}) ->
filename:dirname(AppDir)). filename:dirname(AppDir)).
update_source(Dep) -> update_source(Dep) ->
%% It's possible when updating a source, that a given dep does not have a
%% VCS directory, such as when a source archive is built of a project, with
%% all deps already downloaded/included. So, verify that the necessary VCS
%% directory exists before attempting to do the update.
AppDir = filename:join(get_deps_dir(), Dep#dep.app),
case has_vcs_dir(element(1, Dep#dep.source), AppDir) of
true ->
?CONSOLE("Updating ~p from ~p\n", [Dep#dep.app, Dep#dep.source]), ?CONSOLE("Updating ~p from ~p\n", [Dep#dep.app, Dep#dep.source]),
require_source_engine(Dep#dep.source), require_source_engine(Dep#dep.source),
update_source(filename:join(get_deps_dir(), Dep#dep.app), update_source(AppDir, Dep#dep.source),
Dep#dep.source), Dep;
Dep. false ->
?WARN("Skipping update for ~p: no VCS directory available!\n", [Dep]),
Dep
end.
update_source(AppDir, {git, _Url, {branch, Branch}}) -> update_source(AppDir, {git, _Url, {branch, Branch}}) ->
rebar_utils:sh(?FMT("git fetch origin", []), [], AppDir), rebar_utils:sh(?FMT("git fetch origin", []), [], AppDir),
@ -358,3 +368,15 @@ scm_client_vsn(bzr) ->
scm_client_vsn(rebar_utils:find_executable("bzr"), " --version", "Bazaar \\(bzr\\) (\\d+).(\\d+)"); scm_client_vsn(rebar_utils:find_executable("bzr"), " --version", "Bazaar \\(bzr\\) (\\d+).(\\d+)");
scm_client_vsn(svn) -> scm_client_vsn(svn) ->
scm_client_vsn(rebar_utils:find_executable("svn"), " --version", "svn, version (\\d+).(\\d+)"). scm_client_vsn(rebar_utils:find_executable("svn"), " --version", "svn, version (\\d+).(\\d+)").
has_vcs_dir(git, Dir) ->
filelib:is_dir(filename:join(Dir, ".git"));
has_vcs_dir(hg, Dir) ->
filelib:is_dir(filename:join(Dir, ".hg"));
has_vcs_dir(bzr, Dir) ->
filelib:is_dir(filename:join(Dir, ".bzr"));
has_vcs_dir(svn, Dir) ->
filelib:is_dir(filename:join(Dir, ".svn"))
orelse filelib:is_dir(filename:join(Dir, "_svn"));
has_vcs_dir(_, _) ->
true.