[前][次][番号順一覧][スレッド一覧]

ruby-changes:61059

From: bronzdoc <ko1@a...>
Date: Fri, 8 May 2020 07:39:24 +0900 (JST)
Subject: [ruby-changes:61059] feb2974000 (master): [rubygems/rubygems] Remove deprecation methods by date

https://git.ruby-lang.org/ruby.git/commit/?id=feb2974000

From feb297400039e18637f31b8972eb3616d9bc9287 Mon Sep 17 00:00:00 2001
From: bronzdoc <lsagastume1990@g...>
Date: Fri, 27 Mar 2020 21:43:21 -0600
Subject: [rubygems/rubygems] Remove deprecation methods by date

https://github.com/rubygems/rubygems/commit/3a14635cf5

diff --git a/lib/rubygems/deprecate.rb b/lib/rubygems/deprecate.rb
index d80bde0..d7e07da 100644
--- a/lib/rubygems/deprecate.rb
+++ b/lib/rubygems/deprecate.rb
@@ -45,9 +45,9 @@ module Gem::Deprecate https://github.com/ruby/ruby/blob/trunk/lib/rubygems/deprecate.rb#L45
   # 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 https://github.com/ruby/ruby/blob/trunk/lib/rubygems/deprecate.rb#L66
   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 https://github.com/ruby/ruby/blob/trunk/lib/rubygems/deprecate.rb#L75
 
       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 https://github.com/ruby/ruby/blob/trunk/lib/rubygems/deprecate.rb#L83
     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
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]