rubygems-update 3.3.19 → 3.3.20

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +20 -0
  3. data/bin/update_rubygems +1 -1
  4. data/bundler/CHANGELOG.md +26 -0
  5. data/bundler/lib/bundler/build_metadata.rb +2 -2
  6. data/bundler/lib/bundler/cli/install.rb +5 -2
  7. data/bundler/lib/bundler/cli/outdated.rb +12 -3
  8. data/bundler/lib/bundler/cli/platform.rb +1 -1
  9. data/bundler/lib/bundler/cli.rb +5 -3
  10. data/bundler/lib/bundler/definition.rb +61 -11
  11. data/bundler/lib/bundler/fetcher.rb +6 -6
  12. data/bundler/lib/bundler/gem_helpers.rb +7 -1
  13. data/bundler/lib/bundler/installer/standalone.rb +1 -1
  14. data/bundler/lib/bundler/installer.rb +8 -1
  15. data/bundler/lib/bundler/lazy_specification.rb +21 -21
  16. data/bundler/lib/bundler/man/bundle-cache.1 +6 -0
  17. data/bundler/lib/bundler/man/bundle-cache.1.ronn +7 -0
  18. data/bundler/lib/bundler/man/bundle-config.1 +2 -2
  19. data/bundler/lib/bundler/man/bundle-config.1.ronn +3 -3
  20. data/bundler/lib/bundler/man/bundle-install.1 +4 -0
  21. data/bundler/lib/bundler/man/bundle-install.1.ronn +6 -0
  22. data/bundler/lib/bundler/man/bundle-platform.1 +15 -5
  23. data/bundler/lib/bundler/man/bundle-platform.1.ronn +14 -7
  24. data/bundler/lib/bundler/man/bundle.1 +3 -6
  25. data/bundler/lib/bundler/man/bundle.1.ronn +3 -4
  26. data/bundler/lib/bundler/resolver.rb +2 -1
  27. data/bundler/lib/bundler/ruby_dsl.rb +1 -1
  28. data/bundler/lib/bundler/ruby_version.rb +5 -5
  29. data/bundler/lib/bundler/rubygems_ext.rb +13 -0
  30. data/bundler/lib/bundler/source/metadata.rb +1 -1
  31. data/bundler/lib/bundler/source_list.rb +4 -0
  32. data/bundler/lib/bundler/spec_set.rb +15 -28
  33. data/bundler/lib/bundler/version.rb +1 -1
  34. data/lib/rubygems/available_set.rb +3 -3
  35. data/lib/rubygems/basic_specification.rb +2 -2
  36. data/lib/rubygems/command.rb +6 -6
  37. data/lib/rubygems/commands/cert_command.rb +1 -1
  38. data/lib/rubygems/commands/cleanup_command.rb +1 -1
  39. data/lib/rubygems/commands/contents_command.rb +1 -1
  40. data/lib/rubygems/commands/dependency_command.rb +4 -4
  41. data/lib/rubygems/commands/fetch_command.rb +2 -2
  42. data/lib/rubygems/commands/generate_index_command.rb +2 -2
  43. data/lib/rubygems/commands/install_command.rb +7 -7
  44. data/lib/rubygems/commands/pristine_command.rb +5 -5
  45. data/lib/rubygems/commands/setup_command.rb +4 -4
  46. data/lib/rubygems/commands/sources_command.rb +3 -3
  47. data/lib/rubygems/commands/specification_command.rb +2 -2
  48. data/lib/rubygems/commands/uninstall_command.rb +4 -4
  49. data/lib/rubygems/commands/update_command.rb +5 -5
  50. data/lib/rubygems/commands/which_command.rb +1 -1
  51. data/lib/rubygems/config_file.rb +7 -7
  52. data/lib/rubygems/core_ext/kernel_warn.rb +1 -1
  53. data/lib/rubygems/defaults.rb +1 -1
  54. data/lib/rubygems/dependency.rb +5 -5
  55. data/lib/rubygems/dependency_installer.rb +5 -5
  56. data/lib/rubygems/dependency_list.rb +4 -4
  57. data/lib/rubygems/doctor.rb +4 -4
  58. data/lib/rubygems/exceptions.rb +1 -1
  59. data/lib/rubygems/ext/ext_conf_builder.rb +2 -2
  60. data/lib/rubygems/gemcutter_utilities.rb +1 -1
  61. data/lib/rubygems/indexer.rb +3 -3
  62. data/lib/rubygems/installer.rb +5 -13
  63. data/lib/rubygems/name_tuple.rb +3 -3
  64. data/lib/rubygems/package/tar_header.rb +17 -17
  65. data/lib/rubygems/package/tar_writer.rb +1 -1
  66. data/lib/rubygems/package.rb +19 -8
  67. data/lib/rubygems/platform.rb +15 -15
  68. data/lib/rubygems/query_utils.rb +6 -6
  69. data/lib/rubygems/remote_fetcher.rb +3 -3
  70. data/lib/rubygems/request/connection_pools.rb +2 -2
  71. data/lib/rubygems/request/http_pool.rb +1 -1
  72. data/lib/rubygems/request.rb +1 -1
  73. data/lib/rubygems/request_set/gem_dependency_api.rb +3 -3
  74. data/lib/rubygems/request_set/lockfile/parser.rb +12 -12
  75. data/lib/rubygems/request_set/lockfile/tokenizer.rb +2 -2
  76. data/lib/rubygems/request_set.rb +3 -3
  77. data/lib/rubygems/requirement.rb +1 -1
  78. data/lib/rubygems/resolver/api_specification.rb +4 -4
  79. data/lib/rubygems/resolver/best_set.rb +3 -3
  80. data/lib/rubygems/resolver/conflict.rb +3 -3
  81. data/lib/rubygems/resolver/git_specification.rb +3 -3
  82. data/lib/rubygems/resolver/index_specification.rb +3 -2
  83. data/lib/rubygems/resolver/installed_specification.rb +2 -2
  84. data/lib/rubygems/resolver/installer_set.rb +7 -12
  85. data/lib/rubygems/resolver/lock_set.rb +1 -1
  86. data/lib/rubygems/resolver/lock_specification.rb +1 -1
  87. data/lib/rubygems/resolver/vendor_specification.rb +3 -3
  88. data/lib/rubygems/resolver.rb +4 -4
  89. data/lib/rubygems/security/policy.rb +6 -6
  90. data/lib/rubygems/security/signer.rb +1 -1
  91. data/lib/rubygems/security.rb +1 -1
  92. data/lib/rubygems/source/git.rb +4 -4
  93. data/lib/rubygems/source.rb +1 -1
  94. data/lib/rubygems/spec_fetcher.rb +1 -1
  95. data/lib/rubygems/specification.rb +26 -24
  96. data/lib/rubygems/specification_policy.rb +4 -4
  97. data/lib/rubygems/uninstaller.rb +4 -4
  98. data/lib/rubygems/user_interaction.rb +2 -2
  99. data/lib/rubygems/version.rb +12 -4
  100. data/lib/rubygems.rb +8 -8
  101. data/rubygems-update.gemspec +1 -1
  102. data/setup.rb +1 -1
  103. data/test/rubygems/helper.rb +5 -5
  104. data/test/rubygems/test_gem_config_file.rb +17 -5
  105. data/test/rubygems/test_gem_dependency_installer.rb +2 -2
  106. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock +4 -4
  107. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.toml +1 -1
  108. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/build.rb +1 -1
  109. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock +4 -4
  110. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml +1 -1
  111. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/build.rb +1 -1
  112. data/test/rubygems/test_gem_installer.rb +6 -3
  113. data/test/rubygems/test_gem_package.rb +22 -0
  114. data/test/rubygems/test_gem_package_tar_reader.rb +1 -1
  115. data/test/rubygems/test_gem_requirement.rb +9 -3
  116. data/test/rubygems/test_gem_resolver_index_specification.rb +1 -1
  117. data/test/rubygems/test_gem_resolver_installer_set.rb +44 -0
  118. data/test/rubygems/test_gem_specification.rb +11 -2
  119. data/test/rubygems/test_gem_version.rb +9 -2
  120. data/test/rubygems/test_require.rb +1 -1
  121. data/test/rubygems/utilities.rb +4 -4
  122. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c1c91fd55482e23e4eccd9bb36bf89d1452f1ca38d271f74818acebea8e041b7
4
- data.tar.gz: 6cd3ad94c91573c9df933b600e4bdaba8e9f1a1355e8803aa79ce8582f781910
3
+ metadata.gz: dc65c31b014e044c18c88ecaa1f33d67f76bfa85ecfef9d14862927ac1e71a65
4
+ data.tar.gz: 42df47941fe52b6823e6c3d141e22ce56d95b0d9f0daf2d85dcb5e44e0734236
5
5
  SHA512:
6
- metadata.gz: 620a673d4caef7c550ff2f020a059e378366a4201fe3405b62d67b2411cf0ba4d2c98c4d763c6e93104123ce27275b21a4234fdac60f2b2449c69dc918a8970e
7
- data.tar.gz: 9db79232319706dd63ddfab73535912d820a506a08e1d0aad6166b3a070df6ce2b9653815e619261b5c1f51eda2250beb86541eff5b2b4c6e15e55fe5f6f0329
6
+ metadata.gz: 6eab654922f526914bd55529959bfb3dc5edd87e80854908c68287715aca56fe26d6f84f3f68d0069019e8624ae111edd58fa1f50a4345d230a76c628c980869
7
+ data.tar.gz: 1b01ba8a540044973d27c763826a12165314c53841d4ccadd9e3eac5cdb14be59f319eaf3657a95649c40769b8bbec5af9a86be1f851c8045f738a2217e0337f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
1
+ # 3.3.20 / 2022-08-10
2
+
3
+ ## Enhancements:
4
+
5
+ * Include backtrace with crashes by default. Pull request #5811 by
6
+ deivid-rodriguez
7
+ * Don't create broken symlinks when a gem includes them, but print a
8
+ warning instead. Pull request #5801 by deivid-rodriguez
9
+ * Warn (rather than crash) when setting `nil` specification versions. Pull
10
+ request #5794 by deivid-rodriguez
11
+ * Installs bundler 2.3.20 as a default gem.
12
+
13
+ ## Bug fixes:
14
+
15
+ * Always consider installed specs for resolution, even if prereleases.
16
+ Pull request #5821 by deivid-rodriguez
17
+ * Fix `gem install` with `--platform` flag not matching simulated platform
18
+ correctly. Pull request #5820 by deivid-rodriguez
19
+ * Fix platform matching for index specs. Pull request #5795 by Ilushkanama
20
+
1
21
  # 3.3.19 / 2022-07-27
2
22
 
3
23
  ## Enhancements:
data/bin/update_rubygems CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
  require "rubygems"
9
9
 
10
- if ARGV.include? "-h" or ARGV.include? "--help"
10
+ if ARGV.include?("-h") || ARGV.include?("--help")
11
11
  $stderr.puts "rubygems_update [options]"
12
12
  $stderr.puts
13
13
  $stderr.puts "This will install the latest version of RubyGems."
data/bundler/CHANGELOG.md CHANGED
@@ -1,3 +1,29 @@
1
+ # 2.3.20 (August 10, 2022)
2
+
3
+ ## Enhancements:
4
+
5
+ - Consistently ignore patchlevel when reporting `bundle platform --ruby` [#5793](https://github.com/rubygems/rubygems/pull/5793)
6
+ - Make `--standalone` play nice with `--local` [#5762](https://github.com/rubygems/rubygems/pull/5762)
7
+ - Implement `bundle install --prefer-local` [#5761](https://github.com/rubygems/rubygems/pull/5761)
8
+
9
+ ## Bug fixes:
10
+
11
+ - Fix regression where yanked gems are now unintentionally updated when other gems are unlocked [#5812](https://github.com/rubygems/rubygems/pull/5812)
12
+ - Automatically remove "ruby" from lockfile if incomplete [#5807](https://github.com/rubygems/rubygems/pull/5807)
13
+ - Fix `bundle outdated --strict` showing too many outdated gems [#5798](https://github.com/rubygems/rubygems/pull/5798)
14
+ - Don't discard candidates matching Ruby metadata [#5784](https://github.com/rubygems/rubygems/pull/5784)
15
+ - Fix `bundle outdated` crash in debug mode [#5796](https://github.com/rubygems/rubygems/pull/5796)
16
+ - Fix `ruby` DSL requirement matching for head and prerelease rubies [#5766](https://github.com/rubygems/rubygems/pull/5766)
17
+
18
+ ## Documentation:
19
+
20
+ - Update Bundler support policies to match what we do these days [#5813](https://github.com/rubygems/rubygems/pull/5813)
21
+ - Fix arguments for bundle-config(1) docs [#5804](https://github.com/rubygems/rubygems/pull/5804)
22
+ - Improve `bundle platform` man page [#5788](https://github.com/rubygems/rubygems/pull/5788)
23
+ - Remove `bundle cache` from deprecated commands list, and consistently link to `bundle cache` in man pages [#5783](https://github.com/rubygems/rubygems/pull/5783)
24
+ - Add package/pack aliases to man pages for cache [#5785](https://github.com/rubygems/rubygems/pull/5785)
25
+ - Add deprecation notice of bundle console [#5775](https://github.com/rubygems/rubygems/pull/5775)
26
+
1
27
  # 2.3.19 (July 27, 2022)
2
28
 
3
29
  ## Enhancements:
@@ -4,8 +4,8 @@ module Bundler
4
4
  # Represents metadata from when the Bundler gem was built.
5
5
  module BuildMetadata
6
6
  # begin ivars
7
- @built_at = "2022-07-27".freeze
8
- @git_commit_sha = "4f496f93e6".freeze
7
+ @built_at = "2022-08-10".freeze
8
+ @git_commit_sha = "4fd2813f54".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -147,8 +147,11 @@ module Bundler
147
147
  def normalize_settings
148
148
  Bundler.settings.set_command_option :path, nil if options[:system]
149
149
  Bundler.settings.set_command_option_if_given :path, options[:path]
150
- Bundler.settings.temporary(:path_relative_to_cwd => false) do
151
- Bundler.settings.set_command_option :path, "bundle" if options["standalone"] && Bundler.settings[:path].nil?
150
+
151
+ if options["standalone"] && Bundler.settings[:path].nil? && !options["local"]
152
+ Bundler.settings.temporary(:path_relative_to_cwd => false) do
153
+ Bundler.settings.set_command_option :path, "bundle"
154
+ end
152
155
  end
153
156
 
154
157
  bin_option = options["binstubs"]
@@ -46,7 +46,7 @@ module Bundler
46
46
 
47
47
  Bundler::CLI::Common.configure_gem_version_promoter(
48
48
  Bundler.definition,
49
- options
49
+ options.merge(:strict => @strict)
50
50
  )
51
51
 
52
52
  definition_resolution = proc do
@@ -129,6 +129,12 @@ module Bundler
129
129
 
130
130
  private
131
131
 
132
+ def loaded_from_for(spec)
133
+ return unless spec.respond_to?(:loaded_from)
134
+
135
+ spec.loaded_from
136
+ end
137
+
132
138
  def groups_text(group_text, groups)
133
139
  "#{group_text}#{groups.split(",").size > 1 ? "s" : ""} \"#{groups}\""
134
140
  end
@@ -184,7 +190,10 @@ module Bundler
184
190
 
185
191
  def print_gem(current_spec, active_spec, dependency, groups)
186
192
  spec_version = "#{active_spec.version}#{active_spec.git_version}"
187
- spec_version += " (from #{active_spec.loaded_from})" if Bundler.ui.debug? && active_spec.loaded_from
193
+ if Bundler.ui.debug?
194
+ loaded_from = loaded_from_for(active_spec)
195
+ spec_version += " (from #{loaded_from})" if loaded_from
196
+ end
188
197
  current_version = "#{current_spec.version}#{current_spec.git_version}"
189
198
 
190
199
  if dependency && dependency.specific?
@@ -211,7 +220,7 @@ module Bundler
211
220
  dependency = dependency.requirement if dependency
212
221
 
213
222
  ret_val = [active_spec.name, current_version, spec_version, dependency.to_s, groups.to_s]
214
- ret_val << active_spec.loaded_from.to_s if Bundler.ui.debug?
223
+ ret_val << loaded_from_for(active_spec).to_s if Bundler.ui.debug?
215
224
  ret_val
216
225
  end
217
226
 
@@ -9,7 +9,7 @@ module Bundler
9
9
 
10
10
  def run
11
11
  platforms, ruby_version = Bundler.ui.silence do
12
- locked_ruby_version = Bundler.locked_gems && Bundler.locked_gems.ruby_version
12
+ locked_ruby_version = Bundler.locked_gems && Bundler.locked_gems.ruby_version.gsub(/p\d+\Z/, "")
13
13
  gemfile_ruby_version = Bundler.definition.ruby_version && Bundler.definition.ruby_version.single_version_string
14
14
  [Bundler.definition.platforms.map {|p| "* #{p}" },
15
15
  locked_ruby_version || gemfile_ruby_version]
@@ -218,6 +218,8 @@ module Bundler
218
218
  "Specify the number of jobs to run in parallel"
219
219
  method_option "local", :type => :boolean, :banner =>
220
220
  "Do not attempt to fetch gems remotely and use the gem cache instead"
221
+ method_option "prefer-local", :type => :boolean, :banner =>
222
+ "Only attempt to fetch gems remotely if not present locally, even if newer versions are available remotely"
221
223
  method_option "no-cache", :type => :boolean, :banner =>
222
224
  "Don't update the existing gem cache."
223
225
  method_option "redownload", :type => :boolean, :aliases => "--force", :banner =>
@@ -236,7 +238,7 @@ module Bundler
236
238
  "Install to the system location ($BUNDLE_PATH or $GEM_HOME) even if the bundle was previously installed somewhere else for this application"
237
239
  method_option "trust-policy", :alias => "P", :type => :string, :banner =>
238
240
  "Gem trust policy (like gem install -P). Must be one of " +
239
- Bundler.rubygems.security_policy_keys.join("|")
241
+ Bundler.rubygems.security_policy_keys.join("|")
240
242
  method_option "without", :type => :array, :banner =>
241
243
  "Exclude gems that are part of the specified named group."
242
244
  method_option "with", :type => :array, :banner =>
@@ -399,9 +401,9 @@ module Bundler
399
401
  "Do not attempt to fetch gems remotely and use the gem cache instead"
400
402
  method_option "pre", :type => :boolean, :banner => "Check for newer pre-release gems"
401
403
  method_option "source", :type => :array, :banner => "Check against a specific source"
402
- method_option "filter-strict", :type => :boolean, :banner =>
404
+ method_option "filter-strict", :type => :boolean, :aliases => "--strict", :banner =>
403
405
  "Only list newer versions allowed by your Gemfile requirements"
404
- method_option "strict", :type => :boolean, :aliases => "--update-strict", :banner =>
406
+ method_option "update-strict", :type => :boolean, :banner =>
405
407
  "Strict conservative resolution, do not allow any gem to be updated past latest --patch | --minor | --major"
406
408
  method_option "minor", :type => :boolean, :banner => "Prefer updating only to next minor version"
407
409
  method_option "major", :type => :boolean, :banner => "Prefer updating to next major version (default)"
@@ -70,6 +70,7 @@ module Bundler
70
70
  @unlock = unlock
71
71
  @optional_groups = optional_groups
72
72
  @remote = false
73
+ @prefer_local = false
73
74
  @specs = nil
74
75
  @ruby_version = ruby_version
75
76
  @gemfiles = gemfiles
@@ -170,6 +171,13 @@ module Bundler
170
171
  resolve
171
172
  end
172
173
 
174
+ def resolve_prefering_local!
175
+ @prefer_local = true
176
+ @remote = true
177
+ sources.remote!
178
+ resolve
179
+ end
180
+
173
181
  def resolve_with_cache!
174
182
  sources.cached!
175
183
  resolve
@@ -476,6 +484,7 @@ module Bundler
476
484
 
477
485
  def reresolve
478
486
  last_resolve = converge_locked_specs
487
+ remove_ruby_from_platforms_if_necessary!(dependencies)
479
488
  expanded_dependencies = expand_dependencies(dependencies + metadata_dependencies, true)
480
489
  Resolver.resolve(expanded_dependencies, source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve, platforms)
481
490
  end
@@ -516,10 +525,8 @@ module Bundler
516
525
  end
517
526
  end
518
527
 
519
- unless specs["bundler"].any?
520
- bundler = sources.metadata_source.specs.search(Gem::Dependency.new("bundler", VERSION)).last
521
- specs["bundler"] = bundler
522
- end
528
+ bundler = sources.metadata_source.specs.search(Gem::Dependency.new("bundler", VERSION)).last
529
+ specs["bundler"] = bundler
523
530
 
524
531
  specs
525
532
  end
@@ -528,6 +535,19 @@ module Bundler
528
535
  @remote && sources.non_global_rubygems_sources.all?(&:dependency_api_available?) && !sources.aggregate_global_source?
529
536
  end
530
537
 
538
+ def pin_locally_available_names(source_requirements)
539
+ source_requirements.each_with_object({}) do |(name, original_source), new_source_requirements|
540
+ local_source = original_source.dup
541
+ local_source.local_only!
542
+
543
+ new_source_requirements[name] = if local_source.specs.search(name).any?
544
+ local_source
545
+ else
546
+ original_source
547
+ end
548
+ end
549
+ end
550
+
531
551
  def current_ruby_platform_locked?
532
552
  return false unless generic_local_platform == Gem::Platform::RUBY
533
553
  return false if Bundler.settings[:force_ruby_platform] && !@platforms.include?(Gem::Platform::RUBY)
@@ -719,16 +739,24 @@ module Bundler
719
739
  specs[dep].any? {|s| s.satisfies?(dep) && (!dep.source || s.source.include?(dep.source)) }
720
740
  end
721
741
 
742
+ @specs_that_changed_sources = []
743
+
722
744
  specs.each do |s|
723
- # Replace the locked dependency's source with the equivalent source from the Gemfile
724
745
  dep = @dependencies.find {|d| s.satisfies?(d) }
725
746
 
726
- s.source = (dep && dep.source) || sources.get(s.source) || sources.default_source
747
+ # Replace the locked dependency's source with the equivalent source from the Gemfile
748
+ s.source = if dep && dep.source
749
+ gemfile_source = dep.source
750
+ lockfile_source = s.source
727
751
 
728
- next if @unlock[:sources].include?(s.source.name)
752
+ @specs_that_changed_sources << s if gemfile_source != lockfile_source
729
753
 
730
- # If the spec is from a path source and it doesn't exist anymore
731
- # then we unlock it.
754
+ gemfile_source
755
+ else
756
+ sources.get_with_fallback(s.source)
757
+ end
758
+
759
+ next if @unlock[:sources].include?(s.source.name)
732
760
 
733
761
  # Path sources have special logic
734
762
  if s.source.instance_of?(Source::Path) || s.source.instance_of?(Source::Gemspec)
@@ -765,7 +793,7 @@ module Bundler
765
793
 
766
794
  def metadata_dependencies
767
795
  @metadata_dependencies ||= [
768
- Dependency.new("Ruby\0", RubyVersion.system.gem_version),
796
+ Dependency.new("Ruby\0", Gem.ruby_version),
769
797
  Dependency.new("RubyGems\0", Gem::VERSION),
770
798
  ]
771
799
  end
@@ -792,7 +820,9 @@ module Bundler
792
820
  # specs will be available later when the resolver knows where to
793
821
  # look for that gemspec (or its dependencies)
794
822
  source_requirements = if precompute_source_requirements_for_indirect_dependencies?
795
- { :default => sources.default_source }.merge(source_map.all_requirements)
823
+ all_requirements = source_map.all_requirements
824
+ all_requirements = pin_locally_available_names(all_requirements) if @prefer_local
825
+ { :default => sources.default_source }.merge(all_requirements)
796
826
  else
797
827
  { :default => Source::RubygemsAggregate.new(sources, source_map) }.merge(source_map.direct_requirements)
798
828
  end
@@ -802,9 +832,18 @@ module Bundler
802
832
  end
803
833
  source_requirements[:default_bundler] = source_requirements["bundler"] || sources.default_source
804
834
  source_requirements["bundler"] = sources.metadata_source # needs to come last to override
835
+ verify_changed_sources!
805
836
  source_requirements
806
837
  end
807
838
 
839
+ def verify_changed_sources!
840
+ @specs_that_changed_sources.each do |s|
841
+ if s.source.specs.search(s.name).empty?
842
+ raise GemNotFound, "Could not find gem '#{s.name}' in #{s.source}"
843
+ end
844
+ end
845
+ end
846
+
808
847
  def requested_groups
809
848
  values = groups - Bundler.settings[:without] - @optional_groups + Bundler.settings[:with]
810
849
  values &= Bundler.settings[:only] unless Bundler.settings[:only].empty?
@@ -844,6 +883,17 @@ module Bundler
844
883
  end
845
884
  end
846
885
 
886
+ def remove_ruby_from_platforms_if_necessary!(dependencies)
887
+ return if Bundler.frozen_bundle? ||
888
+ Bundler.local_platform == Gem::Platform::RUBY ||
889
+ !platforms.include?(Gem::Platform::RUBY) ||
890
+ (@new_platform && platforms.last == Gem::Platform::RUBY) ||
891
+ !@originally_locked_specs.incomplete_ruby_specs?(dependencies)
892
+
893
+ remove_platform(Gem::Platform::RUBY)
894
+ add_current_platform
895
+ end
896
+
847
897
  def source_map
848
898
  @source_map ||= SourceMap.new(sources, dependencies, @locked_specs)
849
899
  end
@@ -240,8 +240,8 @@ module Bundler
240
240
  def connection
241
241
  @connection ||= begin
242
242
  needs_ssl = remote_uri.scheme == "https" ||
243
- Bundler.settings[:ssl_verify_mode] ||
244
- Bundler.settings[:ssl_client_cert]
243
+ Bundler.settings[:ssl_verify_mode] ||
244
+ Bundler.settings[:ssl_client_cert]
245
245
  raise SSLError if needs_ssl && !defined?(OpenSSL::SSL)
246
246
 
247
247
  con = PersistentHTTP.new :name => "bundler", :proxy => :ENV
@@ -256,8 +256,8 @@ module Bundler
256
256
  end
257
257
 
258
258
  ssl_client_cert = Bundler.settings[:ssl_client_cert] ||
259
- (Gem.configuration.ssl_client_cert if
260
- Gem.configuration.respond_to?(:ssl_client_cert))
259
+ (Gem.configuration.ssl_client_cert if
260
+ Gem.configuration.respond_to?(:ssl_client_cert))
261
261
  if ssl_client_cert
262
262
  pem = File.read(ssl_client_cert)
263
263
  con.cert = OpenSSL::X509::Certificate.new(pem)
@@ -288,8 +288,8 @@ module Bundler
288
288
  def bundler_cert_store
289
289
  store = OpenSSL::X509::Store.new
290
290
  ssl_ca_cert = Bundler.settings[:ssl_ca_cert] ||
291
- (Gem.configuration.ssl_ca_cert if
292
- Gem.configuration.respond_to?(:ssl_ca_cert))
291
+ (Gem.configuration.ssl_ca_cert if
292
+ Gem.configuration.respond_to?(:ssl_ca_cert))
293
293
  if ssl_ca_cert
294
294
  if File.directory? ssl_ca_cert
295
295
  store.add_path ssl_ca_cert
@@ -44,6 +44,12 @@ module Bundler
44
44
 
45
45
  def select_best_platform_match(specs, platform)
46
46
  matching = specs.select {|spec| spec.match_platform(platform) }
47
+
48
+ sort_best_platform_match(matching, platform)
49
+ end
50
+ module_function :select_best_platform_match
51
+
52
+ def sort_best_platform_match(matching, platform)
47
53
  exact = matching.select {|spec| spec.platform == platform }
48
54
  return exact if exact.any?
49
55
 
@@ -52,7 +58,7 @@ module Bundler
52
58
 
53
59
  sorted_matching.take_while {|spec| same_specificity(platform, spec, exemplary_spec) && same_deps(spec, exemplary_spec) }
54
60
  end
55
- module_function :select_best_platform_match
61
+ module_function :sort_best_platform_match
56
62
 
57
63
  class PlatformMatch
58
64
  def self.specificity_score(spec_platform, user_platform)
@@ -47,7 +47,7 @@ module Bundler
47
47
  end
48
48
 
49
49
  def bundler_path
50
- Bundler.root.join(Bundler.settings[:path], "bundler")
50
+ Bundler.root.join(Bundler.settings[:path].to_s, "bundler")
51
51
  end
52
52
 
53
53
  def gem_path(path, spec)
@@ -268,7 +268,14 @@ module Bundler
268
268
  return false if @definition.nothing_changed? && !@definition.missing_specs?
269
269
  end
270
270
 
271
- options["local"] ? @definition.resolve_with_cache! : @definition.resolve_remotely!
271
+ if options["local"]
272
+ @definition.resolve_with_cache!
273
+ elsif options["prefer-local"]
274
+ @definition.resolve_prefering_local!
275
+ else
276
+ @definition.resolve_remotely!
277
+ end
278
+
272
279
  true
273
280
  end
274
281
 
@@ -76,35 +76,35 @@ module Bundler
76
76
  end
77
77
 
78
78
  def materialize_for_installation
79
- __materialize__(ruby_platform_materializes_to_ruby_platform? ? platform : Bundler.local_platform)
80
- end
79
+ source.local!
80
+
81
+ candidates = if source.is_a?(Source::Path) || !ruby_platform_materializes_to_ruby_platform?
82
+ target_platform = ruby_platform_materializes_to_ruby_platform? ? platform : Bundler.local_platform
83
+
84
+ source.specs.search(Dependency.new(name, version)).select do |spec|
85
+ MatchPlatform.platforms_match?(spec.platform, target_platform)
86
+ end
87
+ else
88
+ source.specs.search(self)
89
+ end
81
90
 
82
- def materialize_for_resolution
83
- return self unless Gem::Platform.match_spec?(self)
91
+ return self if candidates.empty?
84
92
 
85
- __materialize__(platform)
93
+ __materialize__(candidates)
86
94
  end
87
95
 
88
- def __materialize__(platform)
89
- @specification = if source.is_a?(Source::Gemspec) && source.gemspec.name == name
90
- source.gemspec.tap {|s| s.source = source }
91
- else
92
- search_object = if source.is_a?(Source::Path)
93
- Dependency.new(name, version)
94
- else
95
- ruby_platform_materializes_to_ruby_platform? ? self : Dependency.new(name, version)
96
- end
97
- candidates = source.specs.search(search_object)
98
- same_platform_candidates = candidates.select do |spec|
99
- MatchPlatform.platforms_match?(spec.platform, platform)
100
- end
101
- installable_candidates = same_platform_candidates.select do |spec|
96
+ def __materialize__(candidates)
97
+ @specification = begin
98
+ search = candidates.reverse.find do |spec|
102
99
  spec.is_a?(StubSpecification) ||
103
100
  (spec.required_ruby_version.satisfied_by?(Gem.ruby_version) &&
104
101
  spec.required_rubygems_version.satisfied_by?(Gem.rubygems_version))
105
102
  end
106
- search = installable_candidates.last || same_platform_candidates.last
107
- search.dependencies = dependencies if search && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification))
103
+ if search.nil? && Bundler.frozen_bundle?
104
+ search = candidates.last
105
+ else
106
+ search.dependencies = dependencies if search && search.full_name == full_name && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification))
107
+ end
108
108
  search
109
109
  end
110
110
  end
@@ -9,6 +9,9 @@
9
9
  .SH "SYNOPSIS"
10
10
  \fBbundle cache\fR
11
11
  .
12
+ .P
13
+ alias: \fBpackage\fR, \fBpack\fR
14
+ .
12
15
  .SH "DESCRIPTION"
13
16
  Copy all of the \fB\.gem\fR files needed to run the application into the \fBvendor/cache\fR directory\. In the future, when running [bundle install(1)][bundle\-install], use the gems in the cache in preference to the ones on \fBrubygems\.org\fR\.
14
17
  .
@@ -53,3 +56,6 @@ One way to be sure that you have the right platformed versions of all your gems
53
56
  .
54
57
  .P
55
58
  By default, bundle cache(1) \fIbundle\-cache\.1\.html\fR fetches and also installs the gems to the default location\. To package the dependencies to \fBvendor/cache\fR without installing them to the local install location, you can run \fBbundle cache \-\-no\-install\fR\.
59
+ .
60
+ .SH "HISTORY"
61
+ In Bundler 2\.1, \fBcache\fR took in the functionalities of \fBpackage\fR and now \fBpackage\fR and \fBpack\fR are aliases of \fBcache\fR\.
@@ -5,6 +5,8 @@ bundle-cache(1) -- Package your needed `.gem` files into your application
5
5
 
6
6
  `bundle cache`
7
7
 
8
+ alias: `package`, `pack`
9
+
8
10
  ## DESCRIPTION
9
11
 
10
12
  Copy all of the `.gem` files needed to run the application into the
@@ -70,3 +72,8 @@ By default, [bundle cache(1)](bundle-cache.1.html) fetches and also
70
72
  installs the gems to the default location. To package the
71
73
  dependencies to `vendor/cache` without installing them to the
72
74
  local install location, you can run `bundle cache --no-install`.
75
+
76
+ ## HISTORY
77
+
78
+ In Bundler 2.1, `cache` took in the functionalities of `package` and now
79
+ `package` and `pack` are aliases of `cache`.
@@ -51,7 +51,7 @@ Executing \fBbundle config unset <name>\fR will delete the configuration in both
51
51
  Executing \fBbundle config unset \-\-global <name>\fR will delete the configuration only from the user configuration\.
52
52
  .
53
53
  .P
54
- Executing \fBbundle config unset \-\-local <name> <value>\fR will delete the configuration only from the local application\.
54
+ Executing \fBbundle config unset \-\-local <name>\fR will delete the configuration only from the local application\.
55
55
  .
56
56
  .P
57
57
  Executing bundle with the \fBBUNDLE_IGNORE_CONFIG\fR environment variable set will cause it to ignore all configuration\.
@@ -298,7 +298,7 @@ The following is a list of all configuration keys and their purpose\. You can le
298
298
  .IP "" 0
299
299
  .
300
300
  .P
301
- In general, you should set these settings per\-application by using the applicable flag to the bundle install(1) \fIbundle\-install\.1\.html\fR or bundle package(1) \fIbundle\-package\.1\.html\fR command\.
301
+ In general, you should set these settings per\-application by using the applicable flag to the bundle install(1) \fIbundle\-install\.1\.html\fR or bundle cache(1) \fIbundle\-cache\.1\.html\fR command\.
302
302
  .
303
303
  .P
304
304
  You can set them globally either via environment variables or \fBbundle config\fR, whichever is preferable for your setup\. If you use both, environment variables will take preference over global settings\.
@@ -43,8 +43,8 @@ local and global sources.
43
43
  Executing `bundle config unset --global <name>` will delete the configuration
44
44
  only from the user configuration.
45
45
 
46
- Executing `bundle config unset --local <name> <value>` will delete the
47
- configuration only from the local application.
46
+ Executing `bundle config unset --local <name>` will delete the configuration
47
+ only from the local application.
48
48
 
49
49
  Executing bundle with the `BUNDLE_IGNORE_CONFIG` environment variable set will
50
50
  cause it to ignore all configuration.
@@ -280,7 +280,7 @@ learn more about their operation in [bundle install(1)](bundle-install.1.html).
280
280
  A `:`-separated list of groups whose gems bundler should not install.
281
281
 
282
282
  In general, you should set these settings per-application by using the applicable
283
- flag to the [bundle install(1)](bundle-install.1.html) or [bundle package(1)](bundle-package.1.html) command.
283
+ flag to the [bundle install(1)](bundle-install.1.html) or [bundle cache(1)](bundle-cache.1.html) command.
284
284
 
285
285
  You can set them globally either via environment variables or `bundle config`,
286
286
  whichever is preferable for your setup. If you use both, environment variables
@@ -70,6 +70,10 @@ The maximum number of parallel download and install jobs\. The default is the nu
70
70
  Do not attempt to connect to \fBrubygems\.org\fR\. Instead, Bundler will use the gems already present in Rubygems\' cache or in \fBvendor/cache\fR\. Note that if an appropriate platform\-specific gem exists on \fBrubygems\.org\fR it will not be found\.
71
71
  .
72
72
  .TP
73
+ \fB\-\-prefer\-local\fR
74
+ Force using locally installed gems, or gems already present in Rubygems\' cache or in \fBvendor/cache\fR, when resolving, even if newer versions are available remotely\. Only attempt to connect to \fBrubygems\.org\fR for gems that are not present locally\.
75
+ .
76
+ .TP
73
77
  \fB\-\-no\-cache\fR
74
78
  Do not update the cache in \fBvendor/cache\fR with the newly bundled gems\. This does not remove any gems in the cache but keeps the newly bundled gems from being cached during the install\.
75
79
  .
@@ -109,6 +109,12 @@ automatically and that requires `bundler` to silently remember them. Since
109
109
  appropriate platform-specific gem exists on `rubygems.org` it will not be
110
110
  found.
111
111
 
112
+ * `--prefer-local`:
113
+ Force using locally installed gems, or gems already present in Rubygems' cache
114
+ or in `vendor/cache`, when resolving, even if newer versions are available
115
+ remotely. Only attempt to connect to `rubygems.org` for gems that are not
116
+ present locally.
117
+
112
118
  * `--no-cache`:
113
119
  Do not update the cache in `vendor/cache` with the newly bundled gems. This
114
120
  does not remove any gems in the cache but keeps the newly bundled gems from
@@ -10,7 +10,7 @@
10
10
  \fBbundle platform\fR [\-\-ruby]
11
11
  .
12
12
  .SH "DESCRIPTION"
13
- \fBplatform\fR will display information from your Gemfile, Gemfile\.lock, and Ruby VM about your platform\.
13
+ \fBplatform\fR displays information from your Gemfile, Gemfile\.lock, and Ruby VM about your platform\.
14
14
  .
15
15
  .P
16
16
  For instance, using this Gemfile(5):
@@ -21,7 +21,7 @@ For instance, using this Gemfile(5):
21
21
 
22
22
  source "https://rubygems\.org"
23
23
 
24
- ruby "1\.9\.3"
24
+ ruby "3\.1\.2"
25
25
 
26
26
  gem "rack"
27
27
  .
@@ -30,7 +30,7 @@ gem "rack"
30
30
  .IP "" 0
31
31
  .
32
32
  .P
33
- If you run \fBbundle platform\fR on Ruby 1\.9\.3, it will display the following output:
33
+ If you run \fBbundle platform\fR on Ruby 3\.1\.2, it displays the following output:
34
34
  .
35
35
  .IP "" 4
36
36
  .
@@ -39,10 +39,13 @@ If you run \fBbundle platform\fR on Ruby 1\.9\.3, it will display the following
39
39
  Your platform is: x86_64\-linux
40
40
 
41
41
  Your app has gems that work on these platforms:
42
+ * arm64\-darwin\-21
42
43
  * ruby
44
+ * x64\-mingw\-ucrt
45
+ * x86_64\-linux
43
46
 
44
47
  Your Gemfile specifies a Ruby version requirement:
45
- * ruby 1\.9\.3
48
+ * ruby 3\.1\.2
46
49
 
47
50
  Your current platform satisfies the Ruby version requirement\.
48
51
  .
@@ -51,11 +54,18 @@ Your current platform satisfies the Ruby version requirement\.
51
54
  .IP "" 0
52
55
  .
53
56
  .P
54
- \fBplatform\fR will list all the platforms in your \fBGemfile\.lock\fR as well as the \fBruby\fR directive if applicable from your Gemfile(5)\. It will also let you know if the \fBruby\fR directive requirement has been met\. If \fBruby\fR directive doesn\'t match the running Ruby VM, it will tell you what part does not\.
57
+ \fBplatform\fR lists all the platforms in your \fBGemfile\.lock\fR as well as the \fBruby\fR directive if applicable from your Gemfile(5)\. It also lets you know if the \fBruby\fR directive requirement has been met\. If \fBruby\fR directive doesn\'t match the running Ruby VM, it tells you what part does not\.
55
58
  .
56
59
  .SH "OPTIONS"
57
60
  .
58
61
  .TP
59
62
  \fB\-\-ruby\fR
60
63
  It will display the ruby directive information, so you don\'t have to parse it from the Gemfile(5)\.
64
+ .
65
+ .SH "SEE ALSO"
66
+ .
67
+ .IP "\(bu" 4
68
+ bundle\-lock(1) \fIbundle\-lock\.1\.ronn\fR
69
+ .
70
+ .IP "" 0
61
71