ruby-changes:69996
From: Hiroshi <ko1@a...>
Date: Wed, 1 Dec 2021 11:00:25 +0900 (JST)
Subject: [ruby-changes:69996] 0b53a8895f (master): Merge rubygems master fd676ac464491afaa0baf5435cb11b3f86229cbd
https://git.ruby-lang.org/ruby.git/commit/?id=0b53a8895f From 0b53a8895f143ecc3d97844f5eec685dbd709d85 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA <hsbt@r...> Date: Wed, 1 Dec 2021 11:00:10 +0900 Subject: Merge rubygems master fd676ac464491afaa0baf5435cb11b3f86229cbd --- lib/bundler/cli/gem.rb | 1 + lib/bundler/definition.rb | 19 ++----------- lib/bundler/resolver.rb | 2 -- lib/bundler/source/rubygems.rb | 10 +++---- lib/bundler/source_list.rb | 30 +++----------------- lib/bundler/templates/newgem/sig/newgem.rbs.tt | 8 ++++++ .../connection_pool/lib/connection_pool/wrapper.rb | 4 +-- lib/rubygems.rb | 32 +++++++++++----------- spec/bundler/commands/newgem_spec.rb | 7 +++++ spec/bundler/install/gemfile/sources_spec.rb | 4 +-- test/rubygems/test_require.rb | 10 ++++--- tool/bundler/rubocop_gems.rb.lock | 11 ++++---- tool/bundler/standard_gems.rb.lock | 15 +++++----- tool/bundler/test_gems.rb.lock | 3 +- 14 files changed, 70 insertions(+), 86 deletions(-) create mode 100644 lib/bundler/templates/newgem/sig/newgem.rbs.tt diff --git a/lib/bundler/cli/gem.rb b/lib/bundler/cli/gem.rb index e917ceb7d43..31e3af55806 100644 --- a/lib/bundler/cli/gem.rb +++ b/lib/bundler/cli/gem.rb @@ -76,6 +76,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli/gem.rb#L76 "#{Bundler.preferred_gemfile_name}.tt" => Bundler.preferred_gemfile_name, "lib/newgem.rb.tt" => "lib/#{namespaced_path}.rb", "lib/newgem/version.rb.tt" => "lib/#{namespaced_path}/version.rb", + "sig/newgem.rbs.tt" => "sig/#{namespaced_path}.rbs", "newgem.gemspec.tt" => "#{name}.gemspec", "Rakefile.tt" => "Rakefile", "README.md.tt" => "README.md", diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index 97b592da7eb..c74bb66c8fc 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -163,10 +163,6 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/definition.rb#L163 end end - def multisource_allowed? - @multisource_allowed - end - def resolve_only_locally! @remote = false sources.local_only! @@ -385,8 +381,8 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/definition.rb#L381 # Check if it is possible that the source is only changed thing if (new_deps.empty? && deleted_deps.empty?) && (!new_sources.empty? && !deleted_sources.empty?) - new_sources.reject! {|source| (source.path? && source.path.exist?) || equivalent_rubygems_remotes?(source) } - deleted_sources.reject! {|source| (source.path? && source.path.exist?) || equivalent_rubygems_remotes?(source) } + new_sources.reject! {|source| source.path? && source.path.exist? } + deleted_sources.reject! {|source| source.path? && source.path.exist? } end if @locked_sources != gemfile_sources @@ -718,11 +714,8 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/definition.rb#L714 deps << dep end - s.source = (dep && dep.source) || sources.get(s.source) unless multisource_allowed? + s.source = (dep && dep.source) || sources.get(s.source) || sources.default_source unless Bundler.frozen_bundle? - # Don't add a spec to the list if its source is expired. For example, - # if you change a Git gem to RubyGems. - next if s.source.nil? next if @unlock[:sources].include?(s.source.name) # If the spec is from a path source and it doesn't exist anymore @@ -859,12 +852,6 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/definition.rb#L852 end end - def equivalent_rubygems_remotes?(source) - return false unless source.is_a?(Source::Rubygems) - - Bundler.settings[:allow_deployment_source_credential_changes] && source.equivalent_remotes?(sources.rubygems_remotes) - end - def source_map @source_map ||= SourceMap.new(sources, dependencies) end diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb index d26e2feb109..56002ace60b 100644 --- a/lib/bundler/resolver.rb +++ b/lib/bundler/resolver.rb @@ -30,10 +30,8 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/resolver.rb#L30 @resolver = Molinillo::Resolver.new(self, self) @search_for = {} @base_dg = Molinillo::DependencyGraph.new - aggregate_global_source = @source_requirements[:default].is_a?(Source::RubygemsAggregate) @base.each do |ls| dep = Dependency.new(ls.name, ls.version) - ls.source = source_for(ls.name) unless aggregate_global_source @base_dg.add_vertex(ls.name, DepProxy.get_proxy(dep, ls.platform), true) end additional_base_requirements.each {|d| @base_dg.add_vertex(d.name, d) } diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb index b1dd9572c05..2f9d1f5a12f 100644 --- a/lib/bundler/source/rubygems.rb +++ b/lib/bundler/source/rubygems.rb @@ -262,10 +262,6 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/source/rubygems.rb#L262 @remotes.unshift(uri) unless @remotes.include?(uri) end - def equivalent_remotes?(other_remotes) - other_remotes.map(&method(:remove_auth)) == @remotes.map(&method(:remove_auth)) - end - def spec_names if @allow_remote && dependency_api_available? remote_specs.spec_names @@ -334,7 +330,11 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/source/rubygems.rb#L330 end def credless_remotes - remotes.map(&method(:suppress_configured_credentials)) + if Bundler.settings[:allow_deployment_source_credential_changes] + remotes.map(&method(:remove_auth)) + else + remotes.map(&method(:suppress_configured_credentials)) + end end def remotes_for_spec(spec) diff --git a/lib/bundler/source_list.rb b/lib/bundler/source_list.rb index d6310b78c06..ba356d40adc 100644 --- a/lib/bundler/source_list.rb +++ b/lib/bundler/source_list.rb @@ -98,7 +98,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/source_list.rb#L98 end def get(source) - source_list_for(source).find {|s| equal_source?(source, s) || equivalent_source?(source, s) } + source_list_for(source).find {|s| equivalent_source?(source, s) } end def lock_sources @@ -173,7 +173,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/source_list.rb#L173 end def different_sources?(lock_sources, replacement_sources) - !equal_sources?(lock_sources, replacement_sources) && !equivalent_sources?(lock_sources, replacement_sources) + !equivalent_sources?(lock_sources, replacement_sources) end def rubygems_aggregate_class @@ -210,34 +210,12 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/source_list.rb#L210 end end - def equal_sources?(lock_sources, replacement_sources) + def equivalent_sources?(lock_sources, replacement_sources) lock_sources.sort_by(&:to_s) == replacement_sources.sort_by(&:to_s) end - def equal_source?(source, other_source) - return source.include?(other_source) if source.is_a?(Source::Rubygems) && other_source.is_a?(Source::Rubygems) - - source == other_source - end - def equivalent_source?(source, other_source) - return false unless Bundler.settings[:allow_deployment_source_credential_changes] && source.is_a?(Source::Rubygems) - - equivalent_rubygems_sources?([source], [other_source]) - end - - def equivalent_sources?(lock_sources, replacement_sources) - return false unless Bundler.settings[:allow_deployment_source_credential_changes] - - lock_rubygems_sources, lock_other_sources = lock_sources.partition {|s| s.is_a?(Source::Rubygems) } - replacement_rubygems_sources, replacement_other_sources = replacement_sources.partition {|s| s.is_a?(Source::Rubygems) } - - equivalent_rubygems_sources?(lock_rubygems_sources, replacement_rubygems_sources) && equal_sources?(lock_other_sources, replacement_other_sources) - end - - def equivalent_rubygems_sources?(lock_sources, replacement_sources) - actual_remotes = replacement_sources.map(&:remotes).flatten.uniq - lock_sources.all? {|s| s.equivalent_remotes?(actual_remotes) } + source == other_source end end end diff --git a/lib/bundler/templates/newgem/sig/newgem.rbs.tt b/lib/bundler/templates/newgem/sig/newgem.rbs.tt new file mode 100644 index 00000000000..eb7b380bbb9 --- /dev/null +++ b/lib/bundler/templates/newgem/sig/newgem.rbs.tt @@ -0,0 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/lib/bundler/templates/newgem/sig/newgem.rbs.tt#L1 +<%- config[:constant_array].each_with_index do |c, i| -%> +<%= " " * i %>module <%= c %> +<%- end -%> +<%= " " * config[:constant_array].size %>VERSION: String +<%= " " * config[:constant_array].size %># See the writing guide of rbs: https://github.com/ruby/rbs#guides +<%- (config[:constant_array].size-1).downto(0) do |i| -%> +<%= " " * i %>end +<%- end -%> diff --git a/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb b/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb index 880170c06b0..9d94c2c0f09 100644 --- a/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +++ b/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb @@ -32,13 +32,13 @@ class Bundler::ConnectionPool https://github.com/ruby/ruby/blob/trunk/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb#L32 # rubocop:disable Style/MethodMissingSuper # rubocop:disable Style/MissingRespondToMissing - if ::RUBY (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/