From a7a7e7bea0183b0f7a21ffd60010563a97cf67e9 Mon Sep 17 00:00:00 2001 From: bronzdoc Date: Sun, 22 Mar 2020 18:37:38 -0600 Subject: [rubygems/rubygems] Make the deprecate_command method recieve a Rubygems version instead of a date https://github.com/rubygems/rubygems/commit/bf95b1de78 --- lib/rubygems/deprecate.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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 -- cgit v1.2.3