summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Smith <dizzyd@dizzyd.com>2011-03-29 13:10:52 -0600
committerDave Smith <dizzyd@dizzyd.com>2011-04-10 16:12:50 -0600
commit4be3631687b4d19c9cd44c8067146b37e0f44ecb (patch)
treee767242dd49f9fda7cb2114fbc248d342c34d233
parent27de53125eb3bd4d349dcfe1cfd9213f8c35c23b (diff)
Make sure to pass dir of app when invoking git; enhance shell logging output
-rw-r--r--src/rebar_app_utils.erl7
-rw-r--r--src/rebar_utils.erl2
2 files changed, 5 insertions, 4 deletions
diff --git a/src/rebar_app_utils.erl b/src/rebar_app_utils.erl
index 27b9176..911f436 100644
--- a/src/rebar_app_utils.erl
+++ b/src/rebar_app_utils.erl
@@ -89,7 +89,8 @@ app_applications(AppFile) ->
app_vsn(AppFile) ->
case load_app_file(AppFile) of
{ok, _, AppInfo} ->
- vcs_vsn(get_value(vsn, AppInfo, AppFile));
+ AppDir = filename:dirname(filename:dirname(AppFile)),
+ vcs_vsn(get_value(vsn, AppInfo, AppFile), AppDir);
{error, Reason} ->
?ABORT("Failed to extract vsn from ~s: ~p\n",
[AppFile, Reason])
@@ -125,12 +126,12 @@ get_value(Key, AppInfo, AppFile) ->
Value
end.
-vcs_vsn(Vcs) ->
+vcs_vsn(Vcs, Dir) ->
case vcs_vsn_cmd(Vcs) of
{unknown, VsnString} ->
VsnString;
Cmd ->
- {ok, VsnString} = rebar_utils:sh(Cmd, [{use_stdout, false}]),
+ {ok, VsnString} = rebar_utils:sh(Cmd, [{cd, Dir}, {use_stdout, false}]),
string:strip(VsnString, right, $\n)
end.
diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl
index c65a99d..792c54f 100644
--- a/src/rebar_utils.erl
+++ b/src/rebar_utils.erl
@@ -75,7 +75,7 @@ get_arch() ->
%% Val = string() | false
%%
sh(Command0, Options0) ->
- ?INFO("sh: ~s\n~p\n", [Command0, Options0]),
+ ?INFO("sh info:\n\tcwd: ~p\n\tcmd: ~s\n\topts: ~p\n", [get_cwd(), Command0, Options0]),
DefaultOptions = [use_stdout, abort_on_error],
Options = [expand_sh_flag(V)