From 27e5a0ae5bce0f9754e4ee596eb01a5f8fab5717 Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Sun, 1 Jan 2012 15:04:26 +0100 Subject: [PATCH] Cleanup and simplify deprecated option handling --- src/rebar_app_utils.erl | 24 ++---------------------- src/rebar_utils.erl | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/src/rebar_app_utils.erl b/src/rebar_app_utils.erl index 2e801d2..dbc2c44 100644 --- a/src/rebar_app_utils.erl +++ b/src/rebar_app_utils.erl @@ -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"). diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl index 63404b0..b98eb94 100644 --- a/src/rebar_utils.erl +++ b/src/rebar_utils.erl @@ -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 %% ====================================================================