summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorbronzdoc <lsagastume1990@gmail.com>2020-03-27 21:43:21 -0600
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-05-08 07:38:50 +0900
commitfeb297400039e18637f31b8972eb3616d9bc9287 (patch)
tree12bcafa1e1ea10aacee8024266bd0b16eec90704 /lib
parenta7a7e7bea0183b0f7a21ffd60010563a97cf67e9 (diff)
[rubygems/rubygems] Remove deprecation methods by date
https://github.com/rubygems/rubygems/commit/3a14635cf5
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3087
Diffstat (limited to 'lib')
-rw-r--r--lib/rubygems/deprecate.rb49
1 files changed, 5 insertions, 44 deletions
diff --git a/lib/rubygems/deprecate.rb b/lib/rubygems/deprecate.rb
index d80bde0b5e..d7e07da67d 100644
--- a/lib/rubygems/deprecate.rb
+++ b/lib/rubygems/deprecate.rb
@@ -45,9 +45,9 @@ module Gem::Deprecate
# Simple deprecation method that deprecates +name+ by wrapping it up
# in a dummy method. It warns on each call to the dummy method
# telling the user of +repl+ (unless +repl+ is :none) and the
- #Rubygems version that it is planned to go away.
+ # Rubygems version that it is planned to go away.
- def deprecate(name:, replacement:, rubygems_version:)
+ def deprecate(name:, replacement:)
class_eval do
old = "_deprecated_#{name}"
alias_method old, name
@@ -66,7 +66,8 @@ module Gem::Deprecate
end
# Deprecation method to deprecate Rubygems commands
- def deprecate_command(rubygems_version:)
+ def deprecate_command
+ next_rubygems_major_version = Gem.rubygems_version + 1
class_eval do
define_method "deprecated?" do
true
@@ -74,7 +75,7 @@ module Gem::Deprecate
define_method "deprecation_warning" do
msg = [ "#{self.command} command is deprecated",
- ". It will be removed in Rubygems #{rubygems_version}.\n",
+ ". It will be removed in Rubygems #{next_rubygems_major_version}.\n",
]
alert_warning "#{msg.join}" unless Gem::Deprecate.skip
@@ -82,46 +83,6 @@ module Gem::Deprecate
end
end
- ##
- # Simple deprecation method that deprecates +name+ by wrapping it up
- # in a dummy method. It warns on each call to the dummy method
- # telling the user of +repl+ (unless +repl+ is :none) and the
- # year/month that it is planned to go away.
-
- def deprecate(name, repl, year, month)
- class_eval do
- old = "_deprecated_#{name}"
- alias_method old, name
- define_method name do |*args, &block|
- klass = self.kind_of? Module
- target = klass ? "#{self}." : "#{self.class}#"
- msg = [ "NOTE: #{target}#{name} is deprecated",
- repl == :none ? " with no replacement" : "; use #{repl} instead",
- ". It will be removed on or after %4d-%02d-01." % [year, month],
- "\n#{target}#{name} called from #{Gem.location_of_caller.join(":")}",
- ]
- warn "#{msg.join}." unless Gem::Deprecate.skip
- send old, *args, &block
- end
- end
- end
-
- # Deprecation method to deprecate Rubygems commands
- def deprecate_command(year, month)
- class_eval do
- define_method "deprecated?" do
- true
- end
-
- define_method "deprecation_warning" do
- msg = [ "#{self.command} command is deprecated",
- ". It will be removed on or after %4d-%02d-01.\n" % [year, month],
- ]
-
- alert_warning "#{msg.join}" unless Gem::Deprecate.skip
- end
- end
- end
module_function :deprecate, :deprecate_command, :skip_during
end