ruby-changes:67396
From: David <ko1@a...>
Date: Tue, 31 Aug 2021 19:06:45 +0900 (JST)
Subject: [ruby-changes:67396] d298ef40f2 (master): [rubygems/rubygems] Small refactor by DRYing up some logic
https://git.ruby-lang.org/ruby.git/commit/?id=d298ef40f2 From d298ef40f252165f76bfd8c677e1aa907e4c0007 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...> Date: Fri, 23 Jul 2021 23:06:29 +0200 Subject: [rubygems/rubygems] Small refactor by DRYing up some logic https://github.com/rubygems/rubygems/commit/c7e3c092e1 --- lib/bundler/definition.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index 81cd94e..06f73dd 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -190,7 +190,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/definition.rb#L190 # # @return [Bundler::SpecSet] def specs - @specs ||= add_bundler_to(resolve.materialize(requested_dependencies)) + @specs ||= materialize(requested_dependencies) rescue GemNotFound => e # Handle yanked gem gem_name, gem_version = extract_gem_info(e) locked_gem = @locked_specs[gem_name].last @@ -246,7 +246,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/definition.rb#L246 def specs_for(groups) groups = requested_groups if groups.empty? deps = dependencies_for(groups) - add_bundler_to(resolve.materialize(expand_dependencies(deps))) + materialize(expand_dependencies(deps)) end def dependencies_for(groups) @@ -496,7 +496,9 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/definition.rb#L496 private - def add_bundler_to(specs) + def materialize(dependencies) + specs = resolve.materialize(dependencies) + unless specs["bundler"].any? bundler = sources.metadata_source.specs.search(Gem::Dependency.new("bundler", VERSION)).last specs["bundler"] = bundler -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/