summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTuncer Ayaz <tuncer.ayaz@gmail.com>2012-01-01 15:04:26 +0100
committerTuncer Ayaz <tuncer.ayaz@gmail.com>2012-01-01 15:10:35 +0100
commit27e5a0ae5bce0f9754e4ee596eb01a5f8fab5717 (patch)
treeee4988ff31136eb47a3ca133d9b02354d35b9e62
parentc046d612a9ffb75f9165891782237d9dbefadc4b (diff)
Cleanup and simplify deprecated option handling
-rw-r--r--src/rebar_app_utils.erl24
-rw-r--r--src/rebar_utils.erl17
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
%% ====================================================================