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

ruby-changes:67464

From: David <ko1@a...>
Date: Tue, 31 Aug 2021 19:07:40 +0900 (JST)
Subject: [ruby-changes:67464] 3a9dd795a7 (master): [rubygems/rubygems] Move some logic to a `save_plugin` method

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

From 3a9dd795a70705d130fb856db148b068d26821c1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...>
Date: Fri, 20 Aug 2021 13:45:17 +0200
Subject: [rubygems/rubygems] Move some logic to a `save_plugin` method

https://github.com/rubygems/rubygems/commit/9620bee2a5
---
 lib/bundler/plugin.rb | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/lib/bundler/plugin.rb b/lib/bundler/plugin.rb
index bfe4fd7..ab4b209 100644
--- a/lib/bundler/plugin.rb
+++ b/lib/bundler/plugin.rb
@@ -246,9 +246,8 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/plugin.rb#L246
     def save_plugins(plugins, specs, optional_plugins = [])
       plugins.each do |name|
         spec = specs[name]
-        validate_plugin! Pathname.new(spec.full_gem_path)
-        installed = register_plugin(name, spec, optional_plugins.include?(name))
-        Bundler.ui.info "Installed plugin #{name}" if installed
+
+        save_plugin(name, spec, optional_plugins.include?(name))
       end
     end
 
@@ -263,6 +262,20 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/plugin.rb#L262
       raise MalformattedPlugin, "#{PLUGIN_FILE_NAME} was not found in the plugin." unless plugin_file.file?
     end
 
+    # Validates and registers a plugin.
+    #
+    # @param [String] name the name of the plugin
+    # @param [Specification] spec of installed plugin
+    # @param [Boolean] optional_plugin, removed if there is conflict with any
+    #                     other plugin (used for default source plugins)
+    #
+    # @raise [MalformattedPlugin] if validation or registration raises any error
+    def save_plugin(name, spec, optional_plugin = false)
+      validate_plugin! Pathname.new(spec.full_gem_path)
+      installed = register_plugin(name, spec, optional_plugin)
+      Bundler.ui.info "Installed plugin #{name}" if installed
+    end
+
     # Runs the plugins.rb file in an isolated namespace, records the plugin
     # actions it registers for and then passes the data to index to be stored.
     #
-- 
cgit v1.1


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

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