Browse files

Clean up rebar_utils

  • Loading branch information...
1 parent 4d2d3c3 commit 87669b6b7fd4b70d3e9a8fb87c58e470b4cc8c8a @tuncer tuncer committed Jan 10, 2012
Showing with 32 additions and 32 deletions.
  1. +1 −1 dialyzer_reference
  2. +30 −30 src/rebar_utils.erl
  3. +1 −1 xref_reference
View
2 dialyzer_reference
@@ -1,2 +1,2 @@
-rebar_utils.erl:163: Call to missing or unexported function escript:foldl/3
+rebar_utils.erl:151: Call to missing or unexported function escript:foldl/3
View
60 src/rebar_utils.erl
@@ -42,7 +42,7 @@
find_executable/1,
prop_check/3,
expand_code_path/0,
- deprecated/4, deprecated/5,
+ deprecated/3, deprecated/4,
expand_env_variable/3,
vcs_vsn/2,
get_deprecated_global/3]).
@@ -110,18 +110,6 @@ sh(Command0, Options0) ->
ErrorHandler(Command, Err)
end.
-%% We do the shell variable substitution ourselves on Windows and hope that the
-%% command doesn't use any other shell magic.
-patch_on_windows(Cmd, Env) ->
- case os:type() of
- {win32,nt} ->
- "cmd /q /c " ++ lists:foldl(fun({Key, Value}, Acc) ->
- expand_env_variable(Acc, Key, Value)
- end, Cmd, Env);
- _ ->
- Cmd
- end.
-
find_files(Dir, Regex) ->
find_files(Dir, Regex, true).
@@ -240,17 +228,45 @@ get_deprecated_global(OldOpt, NewOpt, When) ->
undefined ->
undefined;
Old ->
- deprecated(OldOpt, OldOpt, NewOpt, When),
+ deprecated(OldOpt, NewOpt, When),
Old
end;
New ->
New
end.
+deprecated(Old, New, Opts, When) ->
+ case lists:member(Old, Opts) of
+ true ->
+ deprecated(Old, New, When);
+ false ->
+ ok
+ end.
+
+deprecated(Old, New, When) ->
+ io:format(
+ <<"WARNING: deprecated ~p option used~n"
+ "Option '~p' has been deprecated~n"
+ "in favor of '~p'.~n"
+ "'~p' will be removed ~s.~n~n">>,
+ [Old, Old, New, Old, When]).
+
%% ====================================================================
%% Internal functions
%% ====================================================================
+%% We do the shell variable substitution ourselves on Windows and hope that the
+%% command doesn't use any other shell magic.
+patch_on_windows(Cmd, Env) ->
+ case os:type() of
+ {win32,nt} ->
+ "cmd /q /c " ++ lists:foldl(fun({Key, Value}, Acc) ->
+ expand_env_variable(Acc, Key, Value)
+ end, Cmd, Env);
+ _ ->
+ Cmd
+ end.
+
expand_sh_flag(return_on_error) ->
{error_handler,
fun(_Command, Err) ->
@@ -332,22 +348,6 @@ emulate_escript_foldl(Fun, Acc, File) ->
Error
end.
-deprecated(Key, Old, New, Opts, When) ->
- case lists:member(Old, Opts) of
- true ->
- deprecated(Key, Old, New, When);
- false ->
- ok
- end.
-
-deprecated(Key, Old, New, When) ->
- io:format(
- <<"WARNING: deprecated ~p option used~n"
- "Option '~p' has been deprecated~n"
- "in favor of '~p'.~n"
- "'~p' will be removed ~s.~n~n">>,
- [Key, Old, New, Old, When]).
-
vcs_vsn_cmd(git) ->
%% Explicitly git-describe a committish to accommodate for projects
%% in subdirs which don't have a GIT_DIR. In that case we will
View
2 xref_reference
@@ -1,2 +1,2 @@
==> rebar (xref)
-src/rebar_utils.erl:157: Warning escript_foldl/3 calls undefined function escript:foldl/3
+src/rebar_utils.erl:145: Warning escript_foldl/3 calls undefined function escript:foldl/3

0 comments on commit 87669b6

Please sign in to comment.