diff options
-rw-r--r-- | lib/rubygems/deprecate.rb | 17 |
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 |