summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorbronzdoc <lsagastume1990@gmail.com>2020-03-22 18:37:38 -0600
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-05-08 07:38:50 +0900
commita7a7e7bea0183b0f7a21ffd60010563a97cf67e9 (patch)
tree01d0c29ec0aed9f0a1369da1fda5daec9513bcef /lib
parent2f7865bb6e9eaadb86f159c220478adc73883a90 (diff)
[rubygems/rubygems] Make the deprecate_command method recieve a Rubygems version instead of a date
https://github.com/rubygems/rubygems/commit/bf95b1de78
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3087
Diffstat (limited to 'lib')
-rw-r--r--lib/rubygems/deprecate.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/rubygems/deprecate.rb b/lib/rubygems/deprecate.rb
index 3504dbec4f..d80bde0b5e 100644
--- a/lib/rubygems/deprecate.rb
+++ b/lib/rubygems/deprecate.rb
@@ -65,6 +65,23 @@ module Gem::Deprecate
end
end
+ # Deprecation method to deprecate Rubygems commands
+ def deprecate_command(rubygems_version:)
+ class_eval do
+ define_method "deprecated?" do
+ true
+ end
+
+ define_method "deprecation_warning" do
+ msg = [ "#{self.command} command is deprecated",
+ ". It will be removed in Rubygems #{rubygems_version}.\n",
+ ]
+
+ alert_warning "#{msg.join}" unless Gem::Deprecate.skip
+ end
+ 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