diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2022-07-13 14:36:57 +0900 |
---|---|---|
committer | nagachika <nagachika@ruby-lang.org> | 2022-09-03 15:54:07 +0900 |
commit | d7862a5de43f7412ab41cdae6709c8a30b988621 (patch) | |
tree | 9380b0239b29f05fbdc1b0aff66caae066b5e71f /lib | |
parent | ffd3d83ea8ccf111061a0f03036e5a093bb03674 (diff) | |
download | ruby-d7862a5de43f7412ab41cdae6709c8a30b988621.tar.gz |
Merge RubyGems-3.3.14 and Bundler-2.3.14
Diffstat (limited to 'lib')
54 files changed, 102 insertions, 86 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb index 47b352177d..0be01d1808 100644 --- a/lib/bundler.rb +++ b/lib/bundler.rb @@ -19,7 +19,7 @@ require_relative "bundler/build_metadata" # # Since Ruby 2.6, Bundler is a part of Ruby's standard library. # -# Bunder is used by creating _gemfiles_ listing all the project dependencies +# Bundler is used by creating _gemfiles_ listing all the project dependencies # and (optionally) their versions and then using # # require 'bundler/setup' diff --git a/lib/bundler/cli/common.rb b/lib/bundler/cli/common.rb index 1a469f1d34..b547619c6a 100644 --- a/lib/bundler/cli/common.rb +++ b/lib/bundler/cli/common.rb @@ -40,7 +40,7 @@ module Bundler end def self.verbalize_groups(groups) - groups.map!{|g| "'#{g}'" } + groups.map! {|g| "'#{g}'" } group_list = [groups[0...-1].join(", "), groups[-1..-1]]. reject {|s| s.to_s.empty? }.join(" and ") group_str = groups.size == 1 ? "group" : "groups" diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index d862877c2e..4fca763bcc 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -261,7 +261,7 @@ module Bundler @locked_specs elsif !unlocking? && nothing_changed? Bundler.ui.debug("Found no changes, using resolution from the lockfile") - SpecSet.new(filter_specs(@locked_specs, @dependencies.select{|dep| @locked_specs[dep].any? })) + SpecSet.new(filter_specs(@locked_specs, @dependencies.select {|dep| @locked_specs[dep].any? })) else last_resolve = converge_locked_specs # Run a resolve against the locally available gems @@ -731,7 +731,7 @@ module Bundler end end - SpecSet.new(filter_specs(converged, deps).reject{|s| @unlock[:gems].include?(s.name) }) + SpecSet.new(filter_specs(converged, deps).reject {|s| @unlock[:gems].include?(s.name) }) end def metadata_dependencies diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb index f7922b1fba..8983ef3e2b 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.rb @@ -46,7 +46,7 @@ module Bundler @gemfile = expanded_gemfile_path @gemfiles << expanded_gemfile_path contents ||= Bundler.read_file(@gemfile.to_s) - instance_eval(contents.dup.tap{|x| x.untaint if RUBY_VERSION < "2.7" }, gemfile.to_s, 1) + instance_eval(contents.dup.tap {|x| x.untaint if RUBY_VERSION < "2.7" }, gemfile.to_s, 1) rescue Exception => e # rubocop:disable Lint/RescueException message = "There was an error " \ "#{e.is_a?(GemfileEvalError) ? "evaluating" : "parsing"} " \ diff --git a/lib/bundler/gem_helpers.rb b/lib/bundler/gem_helpers.rb index b271b8d229..632698482f 100644 --- a/lib/bundler/gem_helpers.rb +++ b/lib/bundler/gem_helpers.rb @@ -48,7 +48,7 @@ module Bundler sorted_matching = matching.sort_by {|spec| platform_specificity_match(spec.platform, platform) } exemplary_spec = sorted_matching.first - sorted_matching.take_while{|spec| same_specificity(platform, spec, exemplary_spec) && same_deps(spec, exemplary_spec) } + sorted_matching.take_while {|spec| same_specificity(platform, spec, exemplary_spec) && same_deps(spec, exemplary_spec) } end module_function :select_best_platform_match diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb index ca9df4a21e..915a04c0dc 100644 --- a/lib/bundler/installer.rb +++ b/lib/bundler/installer.rb @@ -13,7 +13,7 @@ module Bundler Installer.ambiguous_gems = [] end - attr_reader :post_install_messages + attr_reader :post_install_messages, :definition # Begins the installation process for Bundler. # For more information see the #run method on this class. diff --git a/lib/bundler/installer/gem_installer.rb b/lib/bundler/installer/gem_installer.rb index 13a1356f56..9a013eea4d 100644 --- a/lib/bundler/installer/gem_installer.rb +++ b/lib/bundler/installer/gem_installer.rb @@ -51,7 +51,20 @@ module Bundler end def install - spec.source.install(spec, :force => force, :ensure_builtin_gems_cached => standalone, :build_args => Array(spec_settings)) + spec.source.install( + spec, + :force => force, + :ensure_builtin_gems_cached => standalone, + :build_args => Array(spec_settings), + :previous_spec => previous_spec, + ) + end + + def previous_spec + locked_gems = installer.definition.locked_gems + return unless locked_gems + + locked_gems.specs.find {|s| s.name == spec.name } end def out_of_space_message diff --git a/lib/bundler/lazy_specification.rb b/lib/bundler/lazy_specification.rb index fd7c8defdc..198906b987 100644 --- a/lib/bundler/lazy_specification.rb +++ b/lib/bundler/lazy_specification.rb @@ -94,7 +94,7 @@ module Bundler (spec.required_ruby_version.satisfied_by?(Gem.ruby_version) && spec.required_rubygems_version.satisfied_by?(Gem.rubygems_version)) end - search = installable_candidates.last + search = installable_candidates.last || same_platform_candidates.last search.dependencies = dependencies if search && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification)) search end diff --git a/lib/bundler/man/bundle-add.1 b/lib/bundler/man/bundle-add.1 index 7ad5443cae..5ed5cf6f68 100644 --- a/lib/bundler/man/bundle-add.1 +++ b/lib/bundler/man/bundle-add.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-ADD" "1" "March 2022" "" "" +.TH "BUNDLE\-ADD" "1" "May 2022" "" "" . .SH "NAME" \fBbundle\-add\fR \- Add gem to the Gemfile and run bundle install @@ -45,6 +45,10 @@ Specify the group(s) for the added gem\. Multiple groups should be separated by Specify the source for the added gem\. . .TP +\fB\-\-require\fR, \fB\-r\fR +Adds require path to gem\. Provide false, or a path as a string\. +. +.TP \fB\-\-git\fR Specify the git source for the added gem\. . @@ -66,9 +70,9 @@ Adds the gem to the Gemfile but does not install it\. . .TP \fB\-\-optimistic\fR -Adds optimistic declaration of version +Adds optimistic declaration of version\. . .TP \fB\-\-strict\fR -Adds strict declaration of version +Adds strict declaration of version\. diff --git a/lib/bundler/man/bundle-add.1.ronn b/lib/bundler/man/bundle-add.1.ronn index 6547297c86..7571a431ab 100644 --- a/lib/bundler/man/bundle-add.1.ronn +++ b/lib/bundler/man/bundle-add.1.ronn @@ -30,6 +30,9 @@ bundle add rails --group "development, test" * `--source`, , `-s`: Specify the source for the added gem. +* `--require`, `-r`: + Adds require path to gem. Provide false, or a path as a string. + * `--git`: Specify the git source for the added gem. @@ -46,7 +49,7 @@ bundle add rails --group "development, test" Adds the gem to the Gemfile but does not install it. * `--optimistic`: - Adds optimistic declaration of version + Adds optimistic declaration of version. * `--strict`: - Adds strict declaration of version + Adds strict declaration of version. diff --git a/lib/bundler/man/bundle-binstubs.1 b/lib/bundler/man/bundle-binstubs.1 index 20ad1c5cc8..7800b1ca3d 100644 --- a/lib/bundler/man/bundle-binstubs.1 +++ b/lib/bundler/man/bundle-binstubs.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-BINSTUBS" "1" "March 2022" "" "" +.TH "BUNDLE\-BINSTUBS" "1" "May 2022" "" "" . .SH "NAME" \fBbundle\-binstubs\fR \- Install the binstubs of the listed gems diff --git a/lib/bundler/man/bundle-cache.1 b/lib/bundler/man/bundle-cache.1 index 7929885924..47f53c62fb 100644 --- a/lib/bundler/man/bundle-cache.1 +++ b/lib/bundler/man/bundle-cache.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-CACHE" "1" "March 2022" "" "" +.TH "BUNDLE\-CACHE" "1" "May 2022" "" "" . .SH "NAME" \fBbundle\-cache\fR \- Package your needed \fB\.gem\fR files into your application diff --git a/lib/bundler/man/bundle-check.1 b/lib/bundler/man/bundle-check.1 index b3a1a06b59..92a6d52d30 100644 --- a/lib/bundler/man/bundle-check.1 +++ b/lib/bundler/man/bundle-check.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-CHECK" "1" "March 2022" "" "" +.TH "BUNDLE\-CHECK" "1" "May 2022" "" "" . .SH "NAME" \fBbundle\-check\fR \- Verifies if dependencies are satisfied by installed gems diff --git a/lib/bundler/man/bundle-clean.1 b/lib/bundler/man/bundle-clean.1 index f48b453149..56e8cef3ac 100644 --- a/lib/bundler/man/bundle-clean.1 +++ b/lib/bundler/man/bundle-clean.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-CLEAN" "1" "March 2022" "" "" +.TH "BUNDLE\-CLEAN" "1" "May 2022" "" "" . .SH "NAME" \fBbundle\-clean\fR \- Cleans up unused gems in your bundler directory diff --git a/lib/bundler/man/bundle-config.1 b/lib/bundler/man/bundle-config.1 index d657910e83..22c2b76f39 100644 --- a/lib/bundler/man/bundle-config.1 +++ b/lib/bundler/man/bundle-config.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-CONFIG" "1" "March 2022" "" "" +.TH "BUNDLE\-CONFIG" "1" "May 2022" "" "" . .SH "NAME" \fBbundle\-config\fR \- Set bundler configuration options diff --git a/lib/bundler/man/bundle-doctor.1 b/lib/bundler/man/bundle-doctor.1 index d638275a02..5b5f785c46 100644 --- a/lib/bundler/man/bundle-doctor.1 +++ b/lib/bundler/man/bundle-doctor.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-DOCTOR" "1" "March 2022" "" "" +.TH "BUNDLE\-DOCTOR" "1" "May 2022" "" "" . .SH "NAME" \fBbundle\-doctor\fR \- Checks the bundle for common problems diff --git a/lib/bundler/man/bundle-exec.1 b/lib/bundler/man/bundle-exec.1 index 90118c1fff..d71cb473e1 100644 --- a/lib/bundler/man/bundle-exec.1 +++ b/lib/bundler/man/bundle-exec.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-EXEC" "1" "March 2022" "" "" +.TH "BUNDLE\-EXEC" "1" "May 2022" "" "" . .SH "NAME" \fBbundle\-exec\fR \- Execute a command in the context of the bundle diff --git a/lib/bundler/man/bundle-gem.1 b/lib/bundler/man/bundle-gem.1 index 10681e3696..6927702af3 100644 --- a/lib/bundler/man/bundle-gem.1 +++ b/lib/bundler/man/bundle-gem.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-GEM" "1" "March 2022" "" "" +.TH "BUNDLE\-GEM" "1" "May 2022" "" "" . .SH "NAME" \fBbundle\-gem\fR \- Generate a project skeleton for creating a rubygem diff --git a/lib/bundler/man/bundle-info.1 b/lib/bundler/man/bundle-info.1 index 57bdc6bd93..ad1a1293aa 100644 --- a/lib/bundler/man/bundle-info.1 +++ b/lib/bundler/man/bundle-info.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-INFO" "1" "March 2022" "" "" +.TH "BUNDLE\-INFO" "1" "May 2022" "" "" . .SH "NAME" \fBbundle\-info\fR \- Show information for the given gem in your bundle diff --git a/lib/bundler/man/bundle-init.1 b/lib/bundler/man/bundle-init.1 index 1524980762..03a20be6b5 100644 --- a/lib/bundler/man/bundle-init.1 +++ b/lib/bundler/man/bundle-init.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-INIT" "1" "March 2022" "" "" +.TH "BUNDLE\-INIT" "1" "May 2022" "" "" . .SH "NAME" \fBbundle\-init\fR \- Generates a Gemfile into the current working directory diff --git a/lib/bundler/man/bundle-inject.1 b/lib/bundler/man/bundle-inject.1 index bb8123d175..d3868e3f8c 100644 --- a/lib/bundler/man/bundle-inject.1 +++ b/lib/bundler/man/bundle-inject.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-INJECT" "1" "March 2022" "" "" +.TH "BUNDLE\-INJECT" "1" "May 2022" "" "" . .SH "NAME" \fBbundle\-inject\fR \- Add named gem(s) with version requirements to Gemfile diff --git a/lib/bundler/man/bundle-install.1 b/lib/bundler/man/bundle-install.1 index 734d4e2479..60e832bfb1 100644 --- a/lib/bundler/man/bundle-install.1 +++ b/lib/bundler/man/bundle-install.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-INSTALL" "1" "March 2022" "" "" +.TH "BUNDLE\-INSTALL" "1" "May 2022" "" "" . .SH "NAME" \fBbundle\-install\fR \- Install the dependencies specified in your Gemfile diff --git a/lib/bundler/man/bundle-list.1 b/lib/bundler/man/bundle-list.1 index aee07e7284..924b6f56b1 100644 --- a/lib/bundler/man/bundle-list.1 +++ b/lib/bundler/man/bundle-list.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-LIST" "1" "March 2022" "" "" +.TH "BUNDLE\-LIST" "1" "May 2022" "" "" . .SH "NAME" \fBbundle\-list\fR \- List all the gems in the bundle diff --git a/lib/bundler/man/bundle-lock.1 b/lib/bundler/man/bundle-lock.1 index d107073c9c..42299230b7 100644 --- a/lib/bundler/man/bundle-lock.1 +++ b/lib/bundler/man/bundle-lock.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-LOCK" "1" "March 2022" "" "" +.TH "BUNDLE\-LOCK" "1" "May 2022" "" "" . .SH "NAME" \fBbundle\-lock\fR \- Creates / Updates a lockfile without installing diff --git a/lib/bundler/man/bundle-open.1 b/lib/bundler/man/bundle-open.1 index 41c58544e2..339606276c 100644 --- a/lib/bundler/man/bundle-open.1 +++ b/lib/bundler/man/bundle-open.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-OPEN" "1" "March 2022" "" "" +.TH "BUNDLE\-OPEN" "1" "May 2022" "" "" . .SH "NAME" \fBbundle\-open\fR \- Opens the source directory for a gem in your bundle diff --git a/lib/bundler/man/bundle-outdated.1 b/lib/bundler/man/bundle-outdated.1 index bb6149df34..9e17daaee4 100644 --- a/lib/bundler/man/bundle-outdated.1 +++ b/lib/bundler/man/bundle-outdated.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-OUTDATED" "1" "March 2022" "" "" +.TH "BUNDLE\-OUTDATED" "1" "May 2022" "" "" . .SH "NAME" \fBbundle\-outdated\fR \- List installed gems with newer versions available diff --git a/lib/bundler/man/bundle-platform.1 b/lib/bundler/man/bundle-platform.1 index fa9aa9c624..e4310bc567 100644 --- a/lib/bundler/man/bundle-platform.1 +++ b/lib/bundler/man/bundle-platform.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-PLATFORM" "1" "March 2022" "" "" +.TH "BUNDLE\-PLATFORM" "1" "May 2022" "" "" . .SH "NAME" \fBbundle\-platform\fR \- Displays platform compatibility information diff --git a/lib/bundler/man/bundle-pristine.1 b/lib/bundler/man/bundle-pristine.1 index 23fc4ad279..5a30f7c61c 100644 --- a/lib/bundler/man/bundle-pristine.1 +++ b/lib/bundler/man/bundle-pristine.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-PRISTINE" "1" "March 2022" "" "" +.TH "BUNDLE\-PRISTINE" "1" "May 2022" "" "" . .SH "NAME" \fBbundle\-pristine\fR \- Restores installed gems to their pristine condition diff --git a/lib/bundler/man/bundle-remove.1 b/lib/bundler/man/bundle-remove.1 index 47e5555860..2ac47fd256 100644 --- a/lib/bundler/man/bundle-remove.1 +++ b/lib/bundler/man/bundle-remove.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-REMOVE" "1" "March 2022" "" "" +.TH "BUNDLE\-REMOVE" "1" "May 2022" "" "" . .SH "NAME" \fBbundle\-remove\fR \- Removes gems from the Gemfile diff --git a/lib/bundler/man/bundle-show.1 b/lib/bundler/man/bundle-show.1 index 21f8879e7b..5e2cdeae54 100644 --- a/lib/bundler/man/bundle-show.1 +++ b/lib/bundler/man/bundle-show.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-SHOW" "1" "March 2022" "" "" +.TH "BUNDLE\-SHOW" "1" "May 2022" "" "" . .SH "NAME" \fBbundle\-show\fR \- Shows all the gems in your bundle, or the path to a gem diff --git a/lib/bundler/man/bundle-update.1 b/lib/bundler/man/bundle-update.1 index 0e410cb8ce..4172b8dce5 100644 --- a/lib/bundler/man/bundle-update.1 +++ b/lib/bundler/man/bundle-update.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-UPDATE" "1" "March 2022" "" "" +.TH "BUNDLE\-UPDATE" "1" "May 2022" "" "" . .SH "NAME" \fBbundle\-update\fR \- Update your gems to the latest available versions diff --git a/lib/bundler/man/bundle-viz.1 b/lib/bundler/man/bundle-viz.1 index e6333aa478..13374f31d5 100644 --- a/lib/bundler/man/bundle-viz.1 +++ b/lib/bundler/man/bundle-viz.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-VIZ" "1" "March 2022" "" "" +.TH "BUNDLE\-VIZ" "1" "May 2022" "" "" . .SH "NAME" \fBbundle\-viz\fR \- Generates a visual dependency graph for your Gemfile diff --git a/lib/bundler/man/bundle.1 b/lib/bundler/man/bundle.1 index ef0b09f260..b5af10f469 100644 --- a/lib/bundler/man/bundle.1 +++ b/lib/bundler/man/bundle.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE" "1" "March 2022" "" "" +.TH "BUNDLE" "1" "May 2022" "" "" . .SH "NAME" \fBbundle\fR \- Ruby Dependency Management diff --git a/lib/bundler/man/gemfile.5 b/lib/bundler/man/gemfile.5 index cf98f48f67..4987fb58ea 100644 --- a/lib/bundler/man/gemfile.5 +++ b/lib/bundler/man/gemfile.5 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "GEMFILE" "5" "March 2022" "" "" +.TH "GEMFILE" "5" "May 2022" "" "" . .SH "NAME" \fBGemfile\fR \- A format for describing gem dependencies for Ruby programs diff --git a/lib/bundler/plugin/installer/git.rb b/lib/bundler/plugin/installer/git.rb index fbb6c5e40e..deec5e99b3 100644 --- a/lib/bundler/plugin/installer/git.rb +++ b/lib/bundler/plugin/installer/git.rb @@ -20,10 +20,6 @@ module Bundler end end - def version_message(spec) - "#{spec.name} #{spec.version}" - end - def root Plugin.root end diff --git a/lib/bundler/plugin/installer/rubygems.rb b/lib/bundler/plugin/installer/rubygems.rb index e144c14b24..7277234d9a 100644 --- a/lib/bundler/plugin/installer/rubygems.rb +++ b/lib/bundler/plugin/installer/rubygems.rb @@ -4,10 +4,6 @@ module Bundler module Plugin class Installer class Rubygems < Bundler::Source::Rubygems - def version_message(spec) - "#{spec.name} #{spec.version}" - end - private def requires_sudo? diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb index 433a5e53e1..2285114c57 100644 --- a/lib/bundler/resolver.rb +++ b/lib/bundler/resolver.rb @@ -21,7 +21,7 @@ module Bundler base = SpecSet.new(base) unless base.is_a?(SpecSet) resolver = new(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms) result = resolver.start(requirements) - SpecSet.new(SpecSet.new(result).for(requirements.reject{|dep| dep.name.end_with?("\0") })) + SpecSet.new(SpecSet.new(result).for(requirements.reject {|dep| dep.name.end_with?("\0") })) end def initialize(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms) diff --git a/lib/bundler/rubygems_ext.rb b/lib/bundler/rubygems_ext.rb index b0e35e005e..af669d7d0b 100644 --- a/lib/bundler/rubygems_ext.rb +++ b/lib/bundler/rubygems_ext.rb @@ -34,7 +34,7 @@ module Gem def full_gem_path if source.respond_to?(:root) - Pathname.new(loaded_from).dirname.expand_path(source.root).to_s.tap{|x| x.untaint if RUBY_VERSION < "2.7" } + Pathname.new(loaded_from).dirname.expand_path(source.root).to_s.tap {|x| x.untaint if RUBY_VERSION < "2.7" } else rg_full_gem_path end diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb index ffdbdee503..8c4e26f074 100644 --- a/lib/bundler/shared_helpers.rb +++ b/lib/bundler/shared_helpers.rb @@ -13,13 +13,13 @@ module Bundler def root gemfile = find_gemfile raise GemfileNotFound, "Could not locate Gemfile" unless gemfile - Pathname.new(gemfile).tap{|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path.parent + Pathname.new(gemfile).tap {|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path.parent end def default_gemfile gemfile = find_gemfile raise GemfileNotFound, "Could not locate Gemfile" unless gemfile - Pathname.new(gemfile).tap{|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path + Pathname.new(gemfile).tap {|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path end def default_lockfile @@ -28,7 +28,7 @@ module Bundler case gemfile.basename.to_s when "gems.rb" then Pathname.new(gemfile.sub(/.rb$/, ".locked")) else Pathname.new("#{gemfile}.lock") - end.tap{|x| x.untaint if RUBY_VERSION < "2.7" } + end.tap {|x| x.untaint if RUBY_VERSION < "2.7" } end def default_bundle_dir @@ -100,7 +100,7 @@ module Bundler # # @see {Bundler::PermissionError} def filesystem_access(path, action = :write, &block) - yield(path.dup.tap{|x| x.untaint if RUBY_VERSION < "2.7" }) + yield(path.dup.tap {|x| x.untaint if RUBY_VERSION < "2.7" }) rescue Errno::EACCES raise PermissionError.new(path, action) rescue Errno::EAGAIN @@ -236,7 +236,7 @@ module Bundler def search_up(*names) previous = nil - current = File.expand_path(SharedHelpers.pwd).tap{|x| x.untaint if RUBY_VERSION < "2.7" } + current = File.expand_path(SharedHelpers.pwd).tap {|x| x.untaint if RUBY_VERSION < "2.7" } until !File.directory?(current) || current == previous if ENV["BUNDLER_SPEC_RUN"] diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb index 2a2b332cff..69804a2e63 100644 --- a/lib/bundler/source.rb +++ b/lib/bundler/source.rb @@ -15,13 +15,12 @@ module Bundler specs.unmet_dependency_names end - def version_message(spec) + def version_message(spec, locked_spec = nil) message = "#{spec.name} #{spec.version}" message += " (#{spec.platform})" if spec.platform != Gem::Platform::RUBY && !spec.platform.nil? - if Bundler.locked_gems - locked_spec = Bundler.locked_gems.specs.find {|s| s.name == spec.name } - locked_spec_version = locked_spec.version if locked_spec + if locked_spec + locked_spec_version = locked_spec.version if locked_spec_version && spec.version != locked_spec_version message += Bundler.ui.add_color(" (was #{locked_spec_version})", version_color(spec.version, locked_spec_version)) end diff --git a/lib/bundler/source/git.rb b/lib/bundler/source/git.rb index a41a2f23e9..eb82544b86 100644 --- a/lib/bundler/source/git.rb +++ b/lib/bundler/source/git.rb @@ -181,7 +181,7 @@ module Bundler def install(spec, options = {}) force = options[:force] - print_using_message "Using #{version_message(spec)} from #{self}" + print_using_message "Using #{version_message(spec, options[:previous_spec])} from #{self}" if (requires_checkout? && !@copied) || force Bundler.ui.debug " * Checking out revision: #{ref}" @@ -336,7 +336,7 @@ module Bundler def load_gemspec(file) stub = Gem::StubSpecification.gemspec_stub(file, install_path.parent, install_path.parent) - stub.full_gem_path = Pathname.new(file).dirname.expand_path(root).to_s.tap{|x| x.untaint if RUBY_VERSION < "2.7" } + stub.full_gem_path = Pathname.new(file).dirname.expand_path(root).to_s.tap {|x| x.untaint if RUBY_VERSION < "2.7" } StubSpecification.from_stub(stub) end diff --git a/lib/bundler/source/path.rb b/lib/bundler/source/path.rb index 01f89b204d..672ecfd13b 100644 --- a/lib/bundler/source/path.rb +++ b/lib/bundler/source/path.rb @@ -82,7 +82,7 @@ module Bundler end def install(spec, options = {}) - using_message = "Using #{version_message(spec)} from #{self}" + using_message = "Using #{version_message(spec, options[:previous_spec])} from #{self}" using_message += " and installing its executables" unless spec.executables.empty? print_using_message using_message generate_bin(spec, :disable_extensions => true) diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb index 8bc3aa17e9..b37bfbccb9 100644 --- a/lib/bundler/source/rubygems.rb +++ b/lib/bundler/source/rubygems.rb @@ -135,9 +135,9 @@ module Bundler end end - def install(spec, opts = {}) - force = opts[:force] - ensure_builtin_gems_cached = opts[:ensure_builtin_gems_cached] + def install(spec, options = {}) + force = options[:force] + ensure_builtin_gems_cached = options[:ensure_builtin_gems_cached] if ensure_builtin_gems_cached && spec.default_gem? if !cached_path(spec) @@ -162,7 +162,7 @@ module Bundler uris.uniq! Installer.ambiguous_gems << [spec.name, *uris] if uris.length > 1 - path = fetch_gem(spec) + path = fetch_gem(spec, options[:previous_spec]) begin s = Bundler.rubygems.spec_from_gem(path, Bundler.settings["trust-policy"]) spec.__swap__(s) @@ -173,7 +173,7 @@ module Bundler end unless Bundler.settings[:no_install] - message = "Installing #{version_message(spec)}" + message = "Installing #{version_message(spec, options[:previous_spec])}" message += " with native extensions" if spec.extensions.any? Bundler.ui.confirm message @@ -198,7 +198,7 @@ module Bundler :ignore_dependencies => true, :wrappers => true, :env_shebang => true, - :build_args => opts[:build_args], + :build_args => options[:build_args], :bundler_expected_checksum => spec.respond_to?(:checksum) && spec.checksum, :bundler_extension_cache_path => extension_cache_path(spec) ).install @@ -458,7 +458,7 @@ module Bundler end end - def fetch_gem(spec) + def fetch_gem(spec, previous_spec = nil) return false unless spec.remote spec.fetch_platform @@ -476,7 +476,7 @@ module Bundler SharedHelpers.filesystem_access(download_cache_path) do |p| FileUtils.mkdir_p(p) end - download_gem(spec, download_cache_path) + download_gem(spec, download_cache_path, previous_spec) if requires_sudo? SharedHelpers.filesystem_access(cache_path) do |p| @@ -521,9 +521,12 @@ module Bundler # @param [String] download_cache_path # the local directory the .gem will end up in. # - def download_gem(spec, download_cache_path) + # @param [Specification] previous_spec + # the spec previously locked + # + def download_gem(spec, download_cache_path, previous_spec = nil) uri = spec.remote.uri - Bundler.ui.confirm("Fetching #{version_message(spec)}") + Bundler.ui.confirm("Fetching #{version_message(spec, previous_spec)}") Bundler.rubygems.download_gem(spec, uri, download_cache_path) end diff --git a/lib/bundler/spec_set.rb b/lib/bundler/spec_set.rb index a19d18388a..0dfaed9807 100644 --- a/lib/bundler/spec_set.rb +++ b/lib/bundler/spec_set.rb @@ -18,13 +18,13 @@ module Bundler loop do break unless dep = deps.shift - next if handled.any?{|d| d.name == dep.name && (match_current_platform || d.__platform == dep.__platform) } || dep.name == "bundler" + next if handled.any? {|d| d.name == dep.name && (match_current_platform || d.__platform == dep.__platform) } || dep.name == "bundler" handled << dep specs_for_dep = spec_for_dependency(dep, match_current_platform) if specs_for_dep.any? - match_current_platform ? specs += specs_for_dep : specs |= specs_for_dep + specs.concat(specs_for_dep) specs_for_dep.first.dependencies.each do |d| next if d.type == :development @@ -40,6 +40,8 @@ module Bundler specs << spec end + specs.uniq! unless match_current_platform + check ? true : specs end @@ -172,7 +174,7 @@ module Bundler def spec_for_dependency(dep, match_current_platform) specs_for_platforms = lookup[dep.name] if match_current_platform - GemHelpers.select_best_platform_match(specs_for_platforms.select{|s| Gem::Platform.match_spec?(s) }, Bundler.local_platform) + GemHelpers.select_best_platform_match(specs_for_platforms.select {|s| Gem::Platform.match_spec?(s) }, Bundler.local_platform) else GemHelpers.select_best_platform_match(specs_for_platforms, dep.__platform) end diff --git a/lib/bundler/version.rb b/lib/bundler/version.rb index aa9c29199d..492cd1d751 100644 --- a/lib/bundler/version.rb +++ b/lib/bundler/version.rb @@ -1,7 +1,7 @@ # frozen_string_literal: false module Bundler - VERSION = "2.3.13".freeze + VERSION = "2.3.14".freeze def self.bundler_major_version @bundler_major_version ||= VERSION.split(".").first.to_i diff --git a/lib/rubygems.rb b/lib/rubygems.rb index 2cbb6a2410..0b83b1f0ed 100644 --- a/lib/rubygems.rb +++ b/lib/rubygems.rb @@ -8,7 +8,7 @@ require 'rbconfig' module Gem - VERSION = "3.3.13".freeze + VERSION = "3.3.14".freeze end # Must be first since it unloads the prelude from 1.9.2 @@ -117,7 +117,7 @@ module Gem # Taint support is deprecated in Ruby 2.7. # This allows switching ".untaint" to ".tap(&Gem::UNTAINT)", # to avoid deprecation warnings in Ruby 2.7. - UNTAINT = RUBY_VERSION < '2.7' ? :untaint.to_sym : proc{} + UNTAINT = RUBY_VERSION < '2.7' ? :untaint.to_sym : proc {} # When https://bugs.ruby-lang.org/issues/17259 is available, there is no need to override Kernel#warn KERNEL_WARN_IGNORES_INTERNAL_ENTRIES = RUBY_ENGINE == "truffleruby" || diff --git a/lib/rubygems/commands/pristine_command.rb b/lib/rubygems/commands/pristine_command.rb index 3cf496ba5b..030c1bffce 100644 --- a/lib/rubygems/commands/pristine_command.rb +++ b/lib/rubygems/commands/pristine_command.rb @@ -113,7 +113,7 @@ extensions will be restored. end.flatten end - specs = specs.select{|spec| RUBY_ENGINE == spec.platform || Gem::Platform.local === spec.platform || spec.platform == Gem::Platform::RUBY } + specs = specs.select {|spec| RUBY_ENGINE == spec.platform || Gem::Platform.local === spec.platform || spec.platform == Gem::Platform::RUBY } if specs.to_a.empty? raise Gem::Exception, diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb index 7b6890013c..84e9210cfb 100644 --- a/lib/rubygems/commands/setup_command.rb +++ b/lib/rubygems/commands/setup_command.rb @@ -475,7 +475,7 @@ By default, this RubyGems will install gem as: def files_in(dir) Dir.chdir dir do Dir.glob(File.join('**', '*'), File::FNM_DOTMATCH). - select{|f| !File.directory?(f) } + select {|f| !File.directory?(f) } end end diff --git a/lib/rubygems/commands/specification_command.rb b/lib/rubygems/commands/specification_command.rb index 6f24787962..6fba3a36ec 100644 --- a/lib/rubygems/commands/specification_command.rb +++ b/lib/rubygems/commands/specification_command.rb @@ -129,7 +129,7 @@ Specific fields in the specification can be extracted in YAML format: platform = get_platform_from_requirements(options) if platform - specs = specs.select{|s| s.platform.to_s == platform } + specs = specs.select {|s| s.platform.to_s == platform } end unless options[:all] diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb index 5c1674f2e8..0613399890 100644 --- a/lib/rubygems/installer.rb +++ b/lib/rubygems/installer.rb @@ -725,11 +725,11 @@ class Gem::Installer raise Gem::InstallError, "#{spec} has an invalid name" end - if spec.raw_require_paths.any?{|path| path =~ /\R/ } + if spec.raw_require_paths.any? {|path| path =~ /\R/ } raise Gem::InstallError, "#{spec} has an invalid require_paths" end - if spec.extensions.any?{|ext| ext =~ /\R/ } + if spec.extensions.any? {|ext| ext =~ /\R/ } raise Gem::InstallError, "#{spec} has an invalid extensions" end diff --git a/lib/rubygems/local_remote_options.rb b/lib/rubygems/local_remote_options.rb index 0b8b0ee1a6..9811c8f948 100644 --- a/lib/rubygems/local_remote_options.rb +++ b/lib/rubygems/local_remote_options.rb @@ -26,7 +26,7 @@ module Gem::LocalRemoteOptions valid_uri_schemes = ["http", "https", "file", "s3"] unless valid_uri_schemes.include?(uri.scheme) - msg = "Invalid uri scheme for #{value}\nPreface URLs with one of #{valid_uri_schemes.map{|s| "#{s}://" }}" + msg = "Invalid uri scheme for #{value}\nPreface URLs with one of #{valid_uri_schemes.map {|s| "#{s}://" }}" raise ArgumentError, msg end diff --git a/lib/rubygems/query_utils.rb b/lib/rubygems/query_utils.rb index f4cfea3087..e0c71c43cb 100644 --- a/lib/rubygems/query_utils.rb +++ b/lib/rubygems/query_utils.rb @@ -61,7 +61,7 @@ module Gem::QueryUtils gem_names = if args.empty? [options[:name]] else - options[:exact] ? args.map{|arg| /\A#{Regexp.escape(arg)}\Z/ } : args.map{|arg| /#{arg}/i } + options[:exact] ? args.map {|arg| /\A#{Regexp.escape(arg)}\Z/ } : args.map {|arg| /#{arg}/i } end terminate_interaction(check_installed_gems(gem_names)) if check_installed_gems? diff --git a/lib/rubygems/spec_fetcher.rb b/lib/rubygems/spec_fetcher.rb index 15bfbb6f8d..4033e2efa3 100644 --- a/lib/rubygems/spec_fetcher.rb +++ b/lib/rubygems/spec_fetcher.rb @@ -91,8 +91,8 @@ class Gem::SpecFetcher list.each do |source, specs| if dependency.name.is_a?(String) && specs.respond_to?(:bsearch) - start_index = (0 ... specs.length).bsearch{|i| specs[i].name >= dependency.name } - end_index = (0 ... specs.length).bsearch{|i| specs[i].name > dependency.name } + start_index = (0 ... specs.length).bsearch {|i| specs[i].name >= dependency.name } + end_index = (0 ... specs.length).bsearch {|i| specs[i].name > dependency.name } specs = specs[start_index ... end_index] if start_index && end_index end diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb index 7e7599f7db..9b533caf54 100644 --- a/lib/rubygems/specification.rb +++ b/lib/rubygems/specification.rb @@ -1110,7 +1110,7 @@ class Gem::Specification < Gem::BasicSpecification result[spec.name] = spec end - result.map(&:last).flatten.sort_by{|tup| tup.name } + result.map(&:last).flatten.sort_by {|tup| tup.name } end ## |