summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTuncer Ayaz <tuncer.ayaz@gmail.com>2010-09-29 23:09:04 +0200
committerTuncer Ayaz <tuncer.ayaz@gmail.com>2010-09-29 23:09:04 +0200
commite33285aeafe04c07366d9f38d61acc46ef6e64a0 (patch)
tree388cb419d947f6553a1f851ee96efaa7d8b4b140
parentf8900aecc3e8d86fa17cccf10f3f377c71427e53 (diff)
Fix dialyzer warnings in scm client vsn checks
-rw-r--r--src/rebar_deps.erl21
-rw-r--r--src/rebar_utils.erl6
2 files changed, 14 insertions, 13 deletions
diff --git a/src/rebar_deps.erl b/src/rebar_deps.erl
index 9f7ea06..7da3069 100644
--- a/src/rebar_deps.erl
+++ b/src/rebar_deps.erl
@@ -1,3 +1,4 @@
+
%% -*- tab-width: 4;erlang-indent-level: 4;indent-tabs-mode: nil -*-
%% ex: ts=4 sw=4 et
%% -------------------------------------------------------------------
@@ -196,9 +197,7 @@ delete_dep(D) ->
require_source_engine(Source) ->
case source_engine_avail(Source) of
true ->
- ok;
- false ->
- ?ABORT("No command line interface available to process ~p\n", [Source])
+ ok
end.
@@ -295,14 +294,14 @@ download_source(AppDir, {svn, Url, Rev}) ->
%% Source helper functions
%% ===================================================================
-source_engine_avail({Name, _, _})
+source_engine_avail({Name, _, _}=Source)
when Name == hg; Name == git; Name == svn; Name == bzr ->
case scm_client_vsn(Name) >= required_scm_client_vsn(Name) of
true ->
true;
false ->
- ?ABORT("Rebar requires version ~p or higher of ~s\n",
- [required_scm_client_vsn(Name), Name])
+ ?ABORT("Rebar requires version ~p or higher of ~s to process ~p\n",
+ [required_scm_client_vsn(Name), Name, Source])
end.
scm_client_vsn(false, _VsnArg, _VsnRegex) ->
@@ -322,12 +321,10 @@ required_scm_client_vsn(bzr) -> {2, 0};
required_scm_client_vsn(svn) -> {1, 6}.
scm_client_vsn(hg) ->
- scm_client_vsn(rebar_utils:find_executable(hg), " --version", "version (\\d+).(\\d+)");
+ scm_client_vsn(rebar_utils:find_executable("hg"), " --version", "version (\\d+).(\\d+)");
scm_client_vsn(git) ->
- scm_client_vsn(rebar_utils:find_executable(git), " --version", "git version (\\d+).(\\d+)");
+ scm_client_vsn(rebar_utils:find_executable("git"), " --version", "git version (\\d+).(\\d+)");
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(rebar_utils:find_executable(svn), " --version", "svn, version (\\d+).(\\d+)");
-scm_client_vsn(_) ->
- undefined.
+ scm_client_vsn(rebar_utils:find_executable("svn"), " --version", "svn, version (\\d+).(\\d+)").
diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl
index 056618b..2e0796d 100644
--- a/src/rebar_utils.erl
+++ b/src/rebar_utils.erl
@@ -140,7 +140,11 @@ escript_foldl(Fun, Acc, File) ->
end.
find_executable(Name) ->
- "\"" ++ filename:nativename(os:find_executable(Name)) ++ "\"".
+ case os:find_executable(Name) of
+ false -> false;
+ Path ->
+ "\"" ++ filename:nativename(Path) ++ "\""
+ end.
%% ====================================================================
%% Internal functions