diff options
| author | Tuncer Ayaz <tuncer.ayaz@gmail.com> | 2012-01-10 11:04:33 +0100 | 
|---|---|---|
| committer | Tuncer Ayaz <tuncer.ayaz@gmail.com> | 2012-01-10 11:15:55 +0100 | 
| commit | 87669b6b7fd4b70d3e9a8fb87c58e470b4cc8c8a (patch) | |
| tree | 99f68f9a261a3a8c1dd0168a0a4600f55aa93b2b /src | |
| parent | 4d2d3c3af31188b68f0c045ae1b25f1e5a7223e1 (diff) | |
Clean up rebar_utils
Diffstat (limited to 'src')
| -rw-r--r-- | src/rebar_utils.erl | 60 | 
1 files changed, 30 insertions, 30 deletions
| diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl index 787264c..1222adc 100644 --- a/src/rebar_utils.erl +++ b/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 | 
