Cleanup and simplify deprecated option handling

This commit is contained in:
Tuncer Ayaz 2012-01-01 15:04:26 +01:00
parent c046d612a9
commit 27e5a0ae5b
2 changed files with 18 additions and 23 deletions

View file

@ -175,27 +175,7 @@ is_skipped_app(ThisApp, TargetApps) ->
end.
get_apps() ->
get_global_cs_opt(app, apps).
rebar_utils:get_deprecated_global(app, apps, "soon").
get_skip_apps() ->
get_global_cs_opt(skip_app, skip_apps).
get_global_cs_opt(Old, New) ->
Apps = rebar_config:get_global(New, undefined),
case rebar_config:get_global(Old, undefined) of
undefined ->
case Apps of
undefined ->
undefined;
Apps ->
Apps
end;
App ->
rebar_utils:deprecated(Old, Old, New, "soon"),
case Apps of
undefined ->
App;
Apps ->
string:join([App, Apps], ",")
end
end.
rebar_utils:get_deprecated_global(skip_app, skip_apps, "soon").

View file

@ -44,7 +44,8 @@
expand_code_path/0,
deprecated/4, deprecated/5,
expand_env_variable/3,
vcs_vsn/2]).
vcs_vsn/2,
get_deprecated_global/3]).
-include("rebar.hrl").
@ -232,6 +233,20 @@ vcs_vsn(Vcs, Dir) ->
end
end.
get_deprecated_global(OldOpt, NewOpt, When) ->
case rebar_config:get_global(OldOpt, undefined) of
undefined ->
case rebar_config:get_global(NewOpt, undefined) of
undefined ->
undefined;
New ->
New
end;
Old ->
deprecated(OldOpt, OldOpt, NewOpt, When),
Old
end.
%% ====================================================================
%% Internal functions
%% ====================================================================