ruby-changes:61063
From: bronzdoc <ko1@a...>
Date: Fri, 8 May 2020 07:39:28 +0900 (JST)
Subject: [ruby-changes:61063] 42c91de9ce (master): [rubygems/rubygems] Use the next major version as default for deprecations
https://git.ruby-lang.org/ruby.git/commit/?id=42c91de9ce From 42c91de9ce97556a9be2c702f317cf1d6107bc03 Mon Sep 17 00:00:00 2001 From: bronzdoc <lsagastume1990@g...> Date: Sat, 28 Mar 2020 17:46:20 -0600 Subject: [rubygems/rubygems] Use the next major version as default for deprecations https://github.com/rubygems/rubygems/commit/b679ab27af diff --git a/lib/rubygems/deprecate.rb b/lib/rubygems/deprecate.rb index d7e07da..57501e1 100644 --- a/lib/rubygems/deprecate.rb +++ b/lib/rubygems/deprecate.rb @@ -47,7 +47,10 @@ module Gem::Deprecate https://github.com/ruby/ruby/blob/trunk/lib/rubygems/deprecate.rb#L47 # telling the user of +repl+ (unless +repl+ is :none) and the # Rubygems version that it is planned to go away. - def deprecate(name:, replacement:) + def deprecate(name, replacement=:none) + current_major = Gem::Version.new(Gem.rubygems_version.segments.first) + next_rubygems_major_version = current_major.bump + class_eval do old = "_deprecated_#{name}" alias_method old, name @@ -55,8 +58,8 @@ module Gem::Deprecate https://github.com/ruby/ruby/blob/trunk/lib/rubygems/deprecate.rb#L58 klass = self.kind_of? Module target = klass ? "#{self}." : "#{self.class}#" msg = [ "NOTE: #{target}#{name} is deprecated", - repl == :none ? " with no replacement" : "; use #{replacement} instead", - ". It will be removed in Rubygems #{rubygems_version}", + replacement == :none ? " with no replacement" : "; use #{replacement} instead", + ". It will be removed in Rubygems #{next_rubygems_major_version}", "\n#{target}#{name} called from #{Gem.location_of_caller.join(":")}", ] warn "#{msg.join}." unless Gem::Deprecate.skip @@ -67,7 +70,9 @@ module Gem::Deprecate https://github.com/ruby/ruby/blob/trunk/lib/rubygems/deprecate.rb#L70 # Deprecation method to deprecate Rubygems commands def deprecate_command - next_rubygems_major_version = Gem.rubygems_version + 1 + current_major = Gem::Version.new(Gem.rubygems_version.segments.first) + next_rubygems_major_version = current_major.bump + class_eval do define_method "deprecated?" do true -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/