Clean up rebar_utils

This commit is contained in:
Tuncer Ayaz 2012-01-10 11:04:33 +01:00
parent 4d2d3c3af3
commit 87669b6b7f
3 changed files with 32 additions and 32 deletions

View file

@ -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 file

@ -42,7 +42,7 @@
find_executable/1, find_executable/1,
prop_check/3, prop_check/3,
expand_code_path/0, expand_code_path/0,
deprecated/4, deprecated/5, deprecated/3, deprecated/4,
expand_env_variable/3, expand_env_variable/3,
vcs_vsn/2, vcs_vsn/2,
get_deprecated_global/3]). get_deprecated_global/3]).
@ -110,18 +110,6 @@ sh(Command0, Options0) ->
ErrorHandler(Command, Err) ErrorHandler(Command, Err)
end. 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) ->
find_files(Dir, Regex, true). find_files(Dir, Regex, true).
@ -240,17 +228,45 @@ get_deprecated_global(OldOpt, NewOpt, When) ->
undefined -> undefined ->
undefined; undefined;
Old -> Old ->
deprecated(OldOpt, OldOpt, NewOpt, When), deprecated(OldOpt, NewOpt, When),
Old Old
end; end;
New -> New ->
New New
end. 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 %% 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) -> expand_sh_flag(return_on_error) ->
{error_handler, {error_handler,
fun(_Command, Err) -> fun(_Command, Err) ->
@ -332,22 +348,6 @@ emulate_escript_foldl(Fun, Acc, File) ->
Error Error
end. 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) -> vcs_vsn_cmd(git) ->
%% Explicitly git-describe a committish to accommodate for projects %% Explicitly git-describe a committish to accommodate for projects
%% in subdirs which don't have a GIT_DIR. In that case we will %% in subdirs which don't have a GIT_DIR. In that case we will

View file

@ -1,2 +1,2 @@
==> rebar (xref) ==> 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