rubygems-update 4.0.19 → 4.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +24 -0
  3. data/Manifest.txt +0 -2
  4. data/bundler/CHANGELOG.md +35 -0
  5. data/bundler/bundler.gemspec +1 -1
  6. data/bundler/lib/bundler/build_metadata.rb +2 -2
  7. data/bundler/lib/bundler/cli/doctor/diagnose.rb +1 -1
  8. data/bundler/lib/bundler/cli/exec.rb +15 -1
  9. data/bundler/lib/bundler/cli/init.rb +4 -0
  10. data/bundler/lib/bundler/cli/outdated.rb +37 -7
  11. data/bundler/lib/bundler/cli/update.rb +1 -1
  12. data/bundler/lib/bundler/cli.rb +2 -2
  13. data/bundler/lib/bundler/definition.rb +12 -2
  14. data/bundler/lib/bundler/dsl.rb +1 -1
  15. data/bundler/lib/bundler/fetcher/downloader.rb +9 -0
  16. data/bundler/lib/bundler/gem_helper.rb +2 -2
  17. data/bundler/lib/bundler/man/bundle-lock.1 +1 -1
  18. data/bundler/lib/bundler/man/bundle-lock.1.ronn +3 -2
  19. data/bundler/lib/bundler/man/bundle-outdated.1 +1 -1
  20. data/bundler/lib/bundler/man/bundle-outdated.1.ronn +7 -1
  21. data/bundler/lib/bundler/man/bundle-platform.1 +4 -0
  22. data/bundler/lib/bundler/man/bundle-platform.1.ronn +4 -0
  23. data/bundler/lib/bundler/man/bundle-update.1 +1 -1
  24. data/bundler/lib/bundler/man/bundle-update.1.ronn +3 -1
  25. data/bundler/lib/bundler/man/gemfile.5 +1 -1
  26. data/bundler/lib/bundler/man/gemfile.5.ronn +3 -1
  27. data/bundler/lib/bundler/runtime.rb +11 -11
  28. data/bundler/lib/bundler/self_manager.rb +15 -9
  29. data/bundler/lib/bundler/shared_helpers.rb +15 -0
  30. data/bundler/lib/bundler/source/git/git_proxy.rb +73 -4
  31. data/bundler/lib/bundler/source/git.rb +10 -8
  32. data/bundler/lib/bundler/source/path.rb +1 -1
  33. data/bundler/lib/bundler/source/rubygems.rb +1 -1
  34. data/bundler/lib/bundler/stub_specification.rb +3 -1
  35. data/bundler/lib/bundler/version.rb +1 -1
  36. data/bundler/lib/bundler.rb +15 -5
  37. data/lib/rubygems/command.rb +1 -1
  38. data/lib/rubygems/commands/contents_command.rb +14 -6
  39. data/lib/rubygems/commands/exec_command.rb +1 -1
  40. data/lib/rubygems/commands/setup_command.rb +11 -38
  41. data/lib/rubygems/commands/stale_command.rb +1 -1
  42. data/lib/rubygems/config_file.rb +21 -10
  43. data/lib/rubygems/ext/builder.rb +3 -1
  44. data/lib/rubygems/package.rb +1 -1
  45. data/lib/rubygems/security/signer.rb +1 -3
  46. data/lib/rubygems/update_suggestion.rb +6 -2
  47. data/lib/rubygems/util.rb +29 -5
  48. data/lib/rubygems/vendor/net-http/lib/net/http.rb +24 -2
  49. data/lib/rubygems.rb +1 -1
  50. metadata +2 -4
  51. data/lib/rubygems/vendor/resolv/COPYING +0 -56
  52. data/lib/rubygems/vendor/resolv/lib/resolv.rb +0 -3499
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fea8148baa9550b989b52e1b5a5bdd0331ce3f3658acd4e6a8655b4aca669d05
4
- data.tar.gz: d6873bcf37f0e87a7c35663e446b5a907a833d469270fce61e06e5c384b26b64
3
+ metadata.gz: d2ba10366f24f2128455224d595b4f144427d183daa7e729fa030baa5145abdf
4
+ data.tar.gz: 4e918f6f931c6979330094869a027604f951c0848a66e2677e2fdd5fec8e6453
5
5
  SHA512:
6
- metadata.gz: 959ce199999beef457228f6ca8ef0d74f6cd19cb433fe5fdf21ec42961df13b81b98209a21bb2c6c298521b201cf2f64161be7efd5a3ac92d155a6c0c17876d0
7
- data.tar.gz: eb602763996a439e8f8598b14c08ead139b527a814e11c9acdae89c4c1556ede07fed87cdde079509b124510f5f3844e394ef74e69e3a532c1900b271d684b14
6
+ metadata.gz: f4a911ffd341da70726247e72f242d4c9f8eb2ca4dfe366b0b60628e26f497505ad1e497516c4e1d472a04fd19bf5d67a8a83ad38f9a89b48bf8eca82df077c6
7
+ data.tar.gz: 02f63cf60c57dfceb1e49ef7997273d23ffe449de39ade9c2b85f81803e1ed5e092d99fc98569943d8b9c794a60360f9ff3027dda3a055ecc8f78dd380446421
data/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.0.21 / 2026-09-16
4
+
5
+ ### Enhancements:
6
+
7
+ * Stop vendoring resolv for two regexps. Pull request [#9877](https://github.com/ruby/rubygems/pull/9877) by Hiroshi SHIBATA
8
+ * Normalize absolute symlink targets during gem extraction. Pull request [#9860](https://github.com/ruby/rubygems/pull/9860) by Hiroshi SHIBATA
9
+ * Installs bundler 4.0.21 as a default gem.
10
+
11
+ ## 4.0.20 / 2026-09-02
12
+
13
+ ### Enhancements:
14
+
15
+ * Print a release notes link instead of the whole changelog on `gem update --system`. Pull request [#9794](https://github.com/ruby/rubygems/pull/9794) by hsbt
16
+ * Installs bundler 4.0.20 as a default gem.
17
+
18
+ ### Bug fixes:
19
+
20
+ * Only coerce exact true and false gemrc values to booleans. Pull request [#9822](https://github.com/ruby/rubygems/pull/9822) by hsbt
21
+ * Make the gem CLI work under RUBY_BOX=1. Pull request [#9810](https://github.com/ruby/rubygems/pull/9810) by hsbt
22
+
23
+ ### Documentation:
24
+
25
+ * Document and test all available gemrc configuration keys. Pull request [#9568](https://github.com/ruby/rubygems/pull/9568) by junaruga
26
+
3
27
  ## 4.0.19 / 2026-08-20
4
28
 
5
29
  ### Enhancements:
data/Manifest.txt CHANGED
@@ -578,8 +578,6 @@ lib/rubygems/vendor/optparse/lib/optparse/shellwords.rb
578
578
  lib/rubygems/vendor/optparse/lib/optparse/time.rb
579
579
  lib/rubygems/vendor/optparse/lib/optparse/uri.rb
580
580
  lib/rubygems/vendor/optparse/lib/optparse/version.rb
581
- lib/rubygems/vendor/resolv/COPYING
582
- lib/rubygems/vendor/resolv/lib/resolv.rb
583
581
  lib/rubygems/vendor/securerandom/COPYING
584
582
  lib/rubygems/vendor/securerandom/lib/securerandom.rb
585
583
  lib/rubygems/vendor/timeout/COPYING
data/bundler/CHANGELOG.md CHANGED
@@ -1,5 +1,40 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.0.21 / 2026-09-16
4
+
5
+ ### Enhancements:
6
+
7
+ * Don't update bundler to a prerelease unless asked for one. Pull request [#9869](https://github.com/ruby/rubygems/pull/9869) by Hiroshi SHIBATA
8
+ * Reject Bundler redirects that downgrade https to http. Pull request [#9859](https://github.com/ruby/rubygems/pull/9859) by Hiroshi SHIBATA
9
+
10
+ ### Bug fixes:
11
+
12
+ * Support `safe.bareRepository=explicit` in git sources. Pull request [#9876](https://github.com/ruby/rubygems/pull/9876) by Hiroshi SHIBATA
13
+ * Stop resolving locally for empty CHECKSUMS entries. Pull request [#9862](https://github.com/ruby/rubygems/pull/9862) by Hiroshi SHIBATA
14
+ * Expand the git source gemspec path before the chdir. Pull request [#9845](https://github.com/ruby/rubygems/pull/9845) by Hiroshi SHIBATA
15
+
16
+ ## 4.0.20 / 2026-09-02
17
+
18
+ ### Enhancements:
19
+
20
+ * Avoid duplicate relative path prefix in bundle exec. Pull request [#9596](https://github.com/ruby/rubygems/pull/9596) by samuel-williams-shopify
21
+ * Follow renamed default branch in git sources. Pull request [#9813](https://github.com/ruby/rubygems/pull/9813) by hsbt
22
+ * Bundler::Source::Git: avoid re-fetching the repo. Pull request [#9806](https://github.com/ruby/rubygems/pull/9806) by byroot
23
+ * Show the newest out-of-cooldown version in bundle outdated. Pull request [#9803](https://github.com/ruby/rubygems/pull/9803) by hsbt
24
+
25
+ ### Bug fixes:
26
+
27
+ * Error out when `bundle init --gemspec` gets no specification. Pull request [#9818](https://github.com/ruby/rubygems/pull/9818) by hsbt
28
+ * Fix relative gemspec paths being expanded twice. Pull request [#9814](https://github.com/ruby/rubygems/pull/9814) by hsbt
29
+ * Fix gemspec evaluation under Ruby::Box. Pull request [#9809](https://github.com/ruby/rubygems/pull/9809) by hsbt
30
+ * Fix release date extraction for the current changelog header format. Pull request [#9767](https://github.com/ruby/rubygems/pull/9767) by meganemura
31
+ * Resolve globbed entries literally in Gem::Util.glob_files_in_dir. Pull request [#9802](https://github.com/ruby/rubygems/pull/9802) by hsbt
32
+ * Preserve native extensions during implicit clean. Pull request [#9800](https://github.com/ruby/rubygems/pull/9800) by sjh9714
33
+
34
+ ### Documentation:
35
+
36
+ * Clarify :path expectations and cross-link platform docs in man pages. Pull request [#9724](https://github.com/ruby/rubygems/pull/9724) by hsbt
37
+
3
38
  ## 4.0.19 / 2026-08-20
4
39
 
5
40
  ### Enhancements:
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
24
24
 
25
25
  s.metadata = {
26
26
  "bug_tracker_uri" => "https://github.com/ruby/rubygems/issues?q=is%3Aopen+is%3Aissue+label%3ABundler",
27
- "changelog_uri" => "https://github.com/ruby/rubygems/blob/master/CHANGELOG-bundler.md",
27
+ "changelog_uri" => "https://github.com/ruby/rubygems/blob/master/CHANGELOG.md",
28
28
  "homepage_uri" => "https://bundler.io/",
29
29
  "source_code_uri" => "https://github.com/ruby/rubygems",
30
30
  }
@@ -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 = nil
8
- @git_commit_sha = "2d0e3df43a".freeze
7
+ @built_at = "2026-09-16".freeze
8
+ @git_commit_sha = "a15d54ed692".freeze
9
9
  # end ivars
10
10
 
11
11
  # A hash representation of the build metadata.
@@ -53,7 +53,7 @@ module Bundler
53
53
  end
54
54
 
55
55
  def bundles_for_gem(spec)
56
- Dir.glob("#{spec.full_gem_path}/**/*.bundle")
56
+ SharedHelpers.glob_files_in_dir("**/*.bundle", spec.full_gem_path)
57
57
  end
58
58
 
59
59
  def lookup_with_fiddle(path)
@@ -23,7 +23,7 @@ module Bundler
23
23
  bin_path.delete_suffix!(".bat") if Gem.win_platform?
24
24
  kernel_load(bin_path, *args)
25
25
  else
26
- bin_path = "./" + bin_path unless File.absolute_path?(bin_path)
26
+ bin_path = explicit_path(bin_path)
27
27
  kernel_exec(bin_path, *args)
28
28
  end
29
29
  else
@@ -71,6 +71,20 @@ module Bundler
71
71
  "#{file} #{args.join(" ")}".strip
72
72
  end
73
73
 
74
+ def explicit_path(path)
75
+ if File.absolute_path?(path) || explicit_relative_path?(path)
76
+ path
77
+ else
78
+ ".#{File::SEPARATOR}#{path}"
79
+ end
80
+ end
81
+
82
+ def explicit_relative_path?(path)
83
+ [File::SEPARATOR, File::ALT_SEPARATOR].compact.any? do |separator|
84
+ path.start_with?(".#{separator}", "..#{separator}")
85
+ end
86
+ end
87
+
74
88
  def directly_loadable?(file)
75
89
  if Gem.win_platform?
76
90
  script_wrapper?(file)
@@ -26,6 +26,10 @@ module Bundler
26
26
  end
27
27
 
28
28
  spec = Bundler.load_gemspec_uncached(gemspec)
29
+ unless spec
30
+ Bundler.ui.error "Gem specification #{gemspec} did not produce a specification"
31
+ exit 1
32
+ end
29
33
 
30
34
  File.open(gemfile, "wb") do |file|
31
35
  file << "# Generated from #{gemspec}\n"
@@ -158,11 +158,29 @@ module Bundler
158
158
 
159
159
  return active_spec if strict
160
160
 
161
- active_specs = active_spec.source.specs.search(current_spec.name).select {|spec| spec.installable_on_platform?(current_spec.platform) }.sort_by(&:version)
162
- if !current_spec.version.prerelease? && !options[:pre] && active_specs.size > 1
163
- active_specs.delete_if {|b| b.respond_to?(:version) && b.version.prerelease? }
161
+ matching_specs(active_spec, current_spec).last
162
+ end
163
+
164
+ def matching_specs(active_spec, current_spec)
165
+ @matching_specs ||= {}
166
+ @matching_specs[[active_spec.source, current_spec.name, current_spec.platform]] ||= begin
167
+ active_specs = active_spec.source.specs.search(current_spec.name).select {|spec| spec.installable_on_platform?(current_spec.platform) }.sort_by(&:version)
168
+ if !current_spec.version.prerelease? && !options[:pre] && active_specs.size > 1
169
+ active_specs.delete_if {|b| b.respond_to?(:version) && b.version.prerelease? }
170
+ end
171
+ active_specs
164
172
  end
165
- active_specs.last
173
+ end
174
+
175
+ # The newest version the cooldown setting would let bundler adopt right
176
+ # now, when the newest overall version is still inside the window. Only a
177
+ # version strictly between the installed one and the newest one is an
178
+ # adoptable update worth showing.
179
+ def newest_out_of_cooldown(active_spec, current_spec)
180
+ newest = matching_specs(active_spec, current_spec).reverse_each.find {|spec| cooldown_days_remaining(spec).nil? }
181
+ return unless newest
182
+ return if newest.version >= active_spec.version || newest.version <= current_spec.version
183
+ newest
166
184
  end
167
185
 
168
186
  def print_gems(gems_list)
@@ -208,7 +226,11 @@ module Bundler
208
226
  spec_outdated_info += ", released #{release_date}" unless release_date.empty?
209
227
 
210
228
  remaining = cooldown_days_remaining(active_spec)
211
- spec_outdated_info += ", in cooldown for #{remaining} more day#{"s" if remaining > 1}" if remaining
229
+ if remaining
230
+ spec_outdated_info += ", in cooldown for #{remaining} more day#{"s" if remaining > 1}"
231
+ adoptable = newest_out_of_cooldown(active_spec, current_spec)
232
+ spec_outdated_info += ", newest out of cooldown #{adoptable.version}" if adoptable
233
+ end
212
234
 
213
235
  spec_outdated_info += ")"
214
236
 
@@ -227,7 +249,11 @@ module Bundler
227
249
  current_version = "#{current_spec.version}#{current_spec.git_version}"
228
250
  spec_version = "#{active_spec.version}#{active_spec.git_version}"
229
251
  remaining = cooldown_days_remaining(active_spec)
230
- spec_version += " (cooldown #{remaining}d)" if remaining
252
+ if remaining
253
+ adoptable = newest_out_of_cooldown(active_spec, current_spec)
254
+ adoptable_note = adoptable ? ", #{adoptable.version} out of cooldown" : ""
255
+ spec_version += " (cooldown #{remaining}d#{adoptable_note})"
256
+ end
231
257
  dependency = dependency.requirement if dependency
232
258
 
233
259
  ret_val = [active_spec.name, current_version, spec_version, dependency.to_s, groups.to_s]
@@ -236,7 +262,7 @@ module Bundler
236
262
  ret_val
237
263
  end
238
264
 
239
- def cooldown_days_remaining(spec, now = Time.now)
265
+ def cooldown_days_remaining(spec, now = cooldown_now)
240
266
  return nil unless spec.respond_to?(:created_at) && spec.created_at
241
267
  return nil unless spec.respond_to?(:remote) && spec.remote
242
268
  days = spec.remote.effective_cooldown
@@ -245,6 +271,10 @@ module Bundler
245
271
  remaining > 0 ? remaining.ceil : nil
246
272
  end
247
273
 
274
+ def cooldown_now
275
+ @cooldown_now ||= Time.now
276
+ end
277
+
248
278
  def check_for_deployment_mode!
249
279
  return unless Bundler.frozen_bundle?
250
280
  suggested_command = if Bundler.settings.locations("frozen").keys.&([:global, :local]).any?
@@ -13,7 +13,7 @@ module Bundler
13
13
 
14
14
  update_bundler = options[:bundler]
15
15
 
16
- Bundler.self_manager.update_bundler_and_restart_with_it_if_needed(update_bundler) if update_bundler
16
+ Bundler.self_manager.update_bundler_and_restart_with_it_if_needed(update_bundler, pre: options[:pre]) if update_bundler
17
17
 
18
18
  Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.settings[:plugins]
19
19
 
@@ -317,7 +317,7 @@ module Bundler
317
317
  method_option "source", type: :array, banner: "Update a specific source (and all gems associated with it)"
318
318
  method_option "force", type: :boolean, aliases: "--redownload", banner: "Force reinstalling every gem, even if already installed"
319
319
  method_option "ruby", type: :boolean, banner: "Update ruby specified in Gemfile.lock"
320
- method_option "bundler", type: :string, lazy_default: "> 0.a", banner: "Update the locked version of bundler"
320
+ method_option "bundler", type: :string, lazy_default: ">= #{Bundler::VERSION}", banner: "Update the locked version of bundler"
321
321
  method_option "patch", type: :boolean, banner: "Prefer updating only to next patch version"
322
322
  method_option "minor", type: :boolean, banner: "Prefer updating only to next minor version"
323
323
  method_option "major", type: :boolean, banner: "Prefer updating to next major version (default)"
@@ -642,7 +642,7 @@ module Bundler
642
642
  method_option "pre", type: :boolean, banner: "If updating, always choose the highest allowed version, regardless of prerelease status"
643
643
  method_option "strict", type: :boolean, banner: "If updating, do not allow any gem to be updated past latest --patch | --minor | --major"
644
644
  method_option "conservative", type: :boolean, banner: "If updating, use bundle install conservative update behavior and do not allow shared dependencies to be updated"
645
- method_option "bundler", type: :string, lazy_default: "> 0.a", banner: "Update the locked version of bundler"
645
+ method_option "bundler", type: :string, lazy_default: ">= #{Bundler::VERSION}", banner: "Update the locked version of bundler"
646
646
  method_option "cooldown", type: :numeric, banner: "Only consider gem versions published at least N days ago. Use 0 to disable."
647
647
  def lock
648
648
  require_relative "cli/lock"
@@ -192,7 +192,7 @@ module Bundler
192
192
 
193
193
  sources.cached!
194
194
 
195
- if options[:add_checksums] || (!options[:local] && install_needed?)
195
+ if options[:add_checksums] || (!options[:local] && (install_needed? || @locked_spec_with_empty_checksums))
196
196
  sources.remote!
197
197
  true
198
198
  else
@@ -639,7 +639,7 @@ module Bundler
639
639
  @missing_lockfile_dep ||
640
640
  @unlocking_bundler ||
641
641
  @locked_spec_with_missing_checksums ||
642
- @locked_spec_with_empty_checksums ||
642
+ empty_checksums_actionable? ||
643
643
  @locked_spec_with_missing_deps ||
644
644
  @locked_spec_with_invalid_deps
645
645
  end
@@ -648,6 +648,16 @@ module Bundler
648
648
  unlocking? || something_changed?
649
649
  end
650
650
 
651
+ # Only a remote fetch can fill an empty CHECKSUMS entry, so it justifies a
652
+ # resolution only when one is coming. Resolving locally for it would repeat
653
+ # on every `Bundler.setup` without changing the lockfile. Frozen mode still
654
+ # has to refuse the entry.
655
+ def empty_checksums_actionable?
656
+ return false unless @locked_spec_with_empty_checksums
657
+
658
+ Bundler.frozen_bundle? || !sources.local_mode?
659
+ end
660
+
651
661
  def should_add_extra_platforms?
652
662
  !lockfile_exists? && Bundler::MatchPlatform.generic_local_platform_is_ruby? && !Bundler.settings[:force_ruby_platform]
653
663
  end
@@ -68,7 +68,7 @@ module Bundler
68
68
  development_group = opts[:development_group] || :development
69
69
  expanded_path = gemfile_root.join(path)
70
70
 
71
- gemspecs = Gem::Util.glob_files_in_dir("{,*}.gemspec", expanded_path).filter_map {|g| Bundler.load_gemspec(g) }
71
+ gemspecs = SharedHelpers.glob_files_in_dir("{,*}.gemspec", expanded_path).filter_map {|g| Bundler.load_gemspec(g) }
72
72
  gemspecs.reject! {|s| s.name != name } if name
73
73
  specs_by_name_and_version = gemspecs.group_by {|s| [s.name, s.version] }
74
74
 
@@ -46,6 +46,11 @@ module Bundler
46
46
  response
47
47
  when Gem::Net::HTTPRedirection
48
48
  new_uri = Gem::URI.parse(response["location"])
49
+ # Following a downgrade would put the credentials this request carries
50
+ # on a plaintext connection, so refuse it like Gem::RemoteFetcher does.
51
+ if https?(uri) && !https?(new_uri)
52
+ raise HTTPError, "Redirecting to a non-https URI is not allowed: #{URICredentialsFilter.credential_filtered_uri(new_uri)}"
53
+ end
49
54
  if new_uri.host == uri.host
50
55
  new_uri.user = uri.user
51
56
  new_uri.password = uri.password
@@ -105,6 +110,10 @@ module Bundler
105
110
 
106
111
  private
107
112
 
113
+ def https?(uri)
114
+ uri.scheme&.casecmp("https")&.zero?
115
+ end
116
+
108
117
  def validate_uri_scheme!(uri)
109
118
  return if /\Ahttps?\z/.match?(uri.scheme)
110
119
  raise InvalidOption,
@@ -32,7 +32,7 @@ module Bundler
32
32
 
33
33
  def initialize(base = nil, name = nil)
34
34
  @base = File.expand_path(base || SharedHelpers.pwd)
35
- gemspecs = name ? [File.join(@base, "#{name}.gemspec")] : Gem::Util.glob_files_in_dir("{,*}.gemspec", @base)
35
+ gemspecs = name ? [File.join(@base, "#{name}.gemspec")] : SharedHelpers.glob_files_in_dir("{,*}.gemspec", @base)
36
36
  raise "Unable to determine name from existing gemspec. Use :name => 'gemname' in #install_tasks to manually set it." unless gemspecs.size == 1
37
37
  @spec_path = gemspecs.first
38
38
  @gemspec = Bundler.load_gemspec(@spec_path)
@@ -124,7 +124,7 @@ module Bundler
124
124
  end
125
125
 
126
126
  def built_gem_path
127
- Gem::Util.glob_files_in_dir("#{name}-*.gem", base).sort_by {|f| File.mtime(f) }.last
127
+ SharedHelpers.glob_files_in_dir("#{name}-*.gem", base).sort_by {|f| File.mtime(f) }.last
128
128
  end
129
129
 
130
130
  def git_push(remote = nil)
@@ -13,7 +13,7 @@ Lock the gems specified in Gemfile\.
13
13
  Ignores the existing lockfile\. Resolve then updates lockfile\. Taking a list of gems or updating all gems if no list is given\.
14
14
  .TP
15
15
  \fB\-\-bundler[=BUNDLER]\fR
16
- Update the locked version of bundler to the given version or the latest version if no version is given\.
16
+ Update the locked version of bundler\. BUNDLER can be a version such as \fB4\.0\.20\fR, or a requirement such as \fB"> 0\.a"\fR\. With no argument, update to the latest released version, which never selects a prerelease\.
17
17
  .TP
18
18
  \fB\-\-local\fR
19
19
  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 a appropriate platform\-specific gem exists on \fBrubygems\.org\fR it will not be found\.
@@ -33,8 +33,9 @@ Lock the gems specified in Gemfile.
33
33
  of gems or updating all gems if no list is given.
34
34
 
35
35
  * `--bundler[=BUNDLER]`:
36
- Update the locked version of bundler to the given version or the latest
37
- version if no version is given.
36
+ Update the locked version of bundler. BUNDLER can be a version such as
37
+ `4.0.20`, or a requirement such as `"> 0.a"`. With no argument, update to the
38
+ latest released version, which never selects a prerelease.
38
39
 
39
40
  * `--local`:
40
41
  Do not attempt to connect to `rubygems.org`. Instead, Bundler will use the
@@ -55,7 +55,7 @@ Only list patch newer versions\.
55
55
  Only list gems specified in your Gemfile, not their dependencies\.
56
56
  .TP
57
57
  \fB\-\-cooldown=<number>\fR
58
- Annotate (rather than hide) versions that are still inside the cooldown window of \fInumber\fR days\. The prose output appends "in cooldown for Nd more days" and the table form adds "(cooldown Nd)" to the Latest column\. See \fBcooldown\fR in bundle\-config(1)\.
58
+ Annotate (rather than hide) versions that are still inside the cooldown window of \fInumber\fR days\. The prose output appends "in cooldown for Nd more days" and the table form adds "(cooldown Nd)" to the Latest column\. When a version outside the window is newer than the installed one, the prose output also appends "newest out of cooldown X" and the table form becomes "(cooldown Nd, X out of cooldown)"\. With \fB\-\-filter\-strict\fR (or \fB\-\-patch\fR, \fB\-\-minor\fR, \fB\-\-major\fR, which imply it), "newest" is already the cooldown\-filtered resolved version, so none of these annotations appear\. See \fBcooldown\fR in bundle\-config(1)\.
59
59
  .SH "PATCH LEVEL OPTIONS"
60
60
  See bundle update(1) \fIbundle\-update\.1\.html\fR for details\.
61
61
  .SH "FILTERING OUTPUT"
@@ -76,7 +76,13 @@ are up to date, Bundler will exit with a status of 0. Otherwise, it will exit 1.
76
76
  Annotate (rather than hide) versions that are still inside the
77
77
  cooldown window of <number> days. The prose output appends "in
78
78
  cooldown for Nd more days" and the table form adds "(cooldown Nd)" to
79
- the Latest column. See `cooldown` in bundle-config(1).
79
+ the Latest column. When a version outside the window is newer than the
80
+ installed one, the prose output also appends "newest out of cooldown
81
+ X" and the table form becomes "(cooldown Nd, X out of cooldown)".
82
+ With `--filter-strict` (or `--patch`, `--minor`, `--major`, which
83
+ imply it), "newest" is already the cooldown-filtered resolved version,
84
+ so none of these annotations appear. See `cooldown` in
85
+ bundle-config(1).
80
86
 
81
87
  ## PATCH LEVEL OPTIONS
82
88
 
@@ -38,6 +38,8 @@ Your current platform satisfies the Ruby version requirement\.
38
38
  .IP "" 0
39
39
  .P
40
40
  \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\.
41
+ .P
42
+ For a detailed explanation of how bundler handles platforms, see the \fBPLATFORMS\fR section in Gemfile(5)\.
41
43
  .SH "OPTIONS"
42
44
  .TP
43
45
  \fB\-\-ruby\fR
@@ -45,5 +47,7 @@ It will display the ruby directive information, so you don't have to parse it fr
45
47
  .SH "SEE ALSO"
46
48
  .IP "\(bu" 4
47
49
  bundle\-lock(1) \fIbundle\-lock\.1\.html\fR
50
+ .IP "\(bu" 4
51
+ Gemfile(5) \fIgemfile\.5\.html\fR
48
52
  .IP "" 0
49
53
 
@@ -38,6 +38,9 @@ If you run `bundle platform` on Ruby 3.1.2, it displays the following output:
38
38
  if the `ruby` directive requirement has been met. If `ruby` directive doesn't
39
39
  match the running Ruby VM, it tells you what part does not.
40
40
 
41
+ For a detailed explanation of how bundler handles platforms, see the
42
+ `PLATFORMS` section in Gemfile(5).
43
+
41
44
  ## OPTIONS
42
45
 
43
46
  * `--ruby`:
@@ -47,3 +50,4 @@ match the running Ruby VM, it tells you what part does not.
47
50
  ## SEE ALSO
48
51
 
49
52
  * [bundle-lock(1)](bundle-lock.1.html)
53
+ * [Gemfile(5)](gemfile.5.html)
@@ -27,7 +27,7 @@ Do not attempt to fetch gems remotely and use the gem cache instead\.
27
27
  Update the locked version of Ruby to the current version of Ruby\.
28
28
  .TP
29
29
  \fB\-\-bundler[=BUNDLER]\fR
30
- Update the locked version of bundler to the invoked bundler version\.
30
+ Update the locked version of bundler\. BUNDLER can be a version such as \fB4\.0\.20\fR, or a requirement such as \fB"> 0\.a"\fR\. With no argument, update to the latest released version, which never selects a prerelease\.
31
31
  .TP
32
32
  \fB\-\-force\fR, \fB\-\-redownload\fR
33
33
  Force reinstalling every gem, even if already installed\.
@@ -53,7 +53,9 @@ gem.
53
53
  Update the locked version of Ruby to the current version of Ruby.
54
54
 
55
55
  * `--bundler[=BUNDLER]`:
56
- Update the locked version of bundler to the invoked bundler version.
56
+ Update the locked version of bundler. BUNDLER can be a version such as
57
+ `4.0.20`, or a requirement such as `"> 0.a"`. With no argument, update to the
58
+ latest released version, which never selects a prerelease.
57
59
 
58
60
  * `--force`, `--redownload`:
59
61
  Force reinstalling every gem, even if already installed.
@@ -392,7 +392,7 @@ gem "rails", git: "https://rails@bitbucket\.org/rails/rails\.git"
392
392
  .P
393
393
  Since the \fBbitbucket\fR method is a specialization of \fBgit_source\fR, it accepts a \fB:branch\fR named argument\.
394
394
  .SS "PATH"
395
- You can specify that a gem is located in a particular location on the file system\. Relative paths are resolved relative to the directory containing the \fBGemfile\fR\.
395
+ You can specify that a gem is located in a particular location on the file system\. Relative paths are resolved relative to the directory containing the \fBGemfile\fR\. The path must point to a directory containing the gem's unpacked source code, not to a packaged \fB\.gem\fR file\.
396
396
  .P
397
397
  Similar to the semantics of the \fB:git\fR option, the \fB:path\fR option requires that the directory in question either contains a \fB\.gemspec\fR for the gem, or that you specify an explicit version that bundler should use\.
398
398
  .P
@@ -451,7 +451,9 @@ Since the `bitbucket` method is a specialization of `git_source`, it accepts a `
451
451
 
452
452
  You can specify that a gem is located in a particular location
453
453
  on the file system. Relative paths are resolved relative to the
454
- directory containing the `Gemfile`.
454
+ directory containing the `Gemfile`. The path must point to a
455
+ directory containing the gem's unpacked source code, not to a
456
+ packaged `.gem` file.
455
457
 
456
458
  Similar to the semantics of the `:git` option, the `:path`
457
459
  option requires that the directory in question either contains
@@ -141,7 +141,7 @@ module Bundler
141
141
  end
142
142
  end
143
143
 
144
- Gem::Util.glob_files_in_dir("*/.git", cache_path.to_s).each do |git_dir|
144
+ SharedHelpers.glob_files_in_dir("*/.git", cache_path.to_s).each do |git_dir|
145
145
  FileUtils.rm_rf(git_dir)
146
146
  FileUtils.touch(File.expand_path("../.bundlecache", git_dir))
147
147
  end
@@ -159,13 +159,13 @@ module Bundler
159
159
  end
160
160
 
161
161
  def clean(dry_run = false)
162
- gem_bins = Gem::Util.glob_files_in_dir("bin/*", Gem.dir)
163
- git_dirs = Gem::Util.glob_files_in_dir("bundler/gems/*", Gem.dir)
164
- git_cache_dirs = Gem::Util.glob_files_in_dir("cache/bundler/git/*", Gem.dir)
165
- gem_dirs = Gem::Util.glob_files_in_dir("gems/*", Gem.dir)
166
- gem_files = Gem::Util.glob_files_in_dir("cache/*.gem", Gem.dir)
167
- gemspec_files = Gem::Util.glob_files_in_dir("specifications/*.gemspec", Gem.dir)
168
- extension_dirs = Gem::Util.glob_files_in_dir("extensions/*/*/*", Gem.dir) + Gem::Util.glob_files_in_dir("bundler/gems/extensions/*/*/*", Gem.dir)
162
+ gem_bins = SharedHelpers.glob_files_in_dir("bin/*", Gem.dir)
163
+ git_dirs = SharedHelpers.glob_files_in_dir("bundler/gems/*", Gem.dir)
164
+ git_cache_dirs = SharedHelpers.glob_files_in_dir("cache/bundler/git/*", Gem.dir)
165
+ gem_dirs = SharedHelpers.glob_files_in_dir("gems/*", Gem.dir)
166
+ gem_files = SharedHelpers.glob_files_in_dir("cache/*.gem", Gem.dir)
167
+ gemspec_files = SharedHelpers.glob_files_in_dir("specifications/*.gemspec", Gem.dir)
168
+ extension_dirs = SharedHelpers.glob_files_in_dir("extensions/*/*/*", Gem.dir) + SharedHelpers.glob_files_in_dir("bundler/gems/extensions/*/*/*", Gem.dir)
169
169
  spec_gem_paths = []
170
170
  # need to keep git sources around
171
171
  spec_git_paths = @definition.spec_git_paths
@@ -232,7 +232,7 @@ module Bundler
232
232
  private
233
233
 
234
234
  def prune_gem_cache(resolve, cache_path)
235
- cached = Gem::Util.glob_files_in_dir("*.gem", cache_path.to_s)
235
+ cached = SharedHelpers.glob_files_in_dir("*.gem", cache_path.to_s)
236
236
 
237
237
  cached = cached.delete_if do |path|
238
238
  spec = Bundler.rubygems.spec_from_gem path
@@ -257,7 +257,7 @@ module Bundler
257
257
  end
258
258
 
259
259
  def prune_git_and_path_cache(resolve, cache_path)
260
- cached = Gem::Util.glob_files_in_dir("*/.bundlecache", cache_path.to_s)
260
+ cached = SharedHelpers.glob_files_in_dir("*/.bundlecache", cache_path.to_s)
261
261
 
262
262
  cached = cached.delete_if do |path|
263
263
  name = File.basename(File.dirname(path))
@@ -283,7 +283,7 @@ module Bundler
283
283
  # Add man/ subdirectories from activated bundles to MANPATH for man(1)
284
284
  manuals = $LOAD_PATH.filter_map do |path|
285
285
  man_subdir = path.sub(/lib$/, "man")
286
- man_subdir unless Dir.glob("man?/", base: man_subdir).empty?
286
+ man_subdir unless SharedHelpers.glob_files_in_dir("man?/", man_subdir).empty?
287
287
  end
288
288
 
289
289
  return if manuals.empty?
@@ -30,8 +30,8 @@ module Bundler
30
30
  install_and_restart_with(restart_version)
31
31
  end
32
32
 
33
- def update_bundler_and_restart_with_it_if_needed(target)
34
- spec = resolve_update_version_from(target)
33
+ def update_bundler_and_restart_with_it_if_needed(target, pre: false)
34
+ spec = resolve_update_version_from(target, pre: pre)
35
35
  return unless spec
36
36
 
37
37
  version = spec.version
@@ -108,9 +108,9 @@ module Bundler
108
108
  lockfile_version
109
109
  end
110
110
 
111
- def resolve_update_version_from(target)
111
+ def resolve_update_version_from(target, pre: false)
112
112
  requirement = Gem::Requirement.new(target)
113
- update_candidate = find_latest_matching_spec(requirement)
113
+ update_candidate = find_latest_matching_spec(requirement, pre: pre)
114
114
 
115
115
  if update_candidate.nil?
116
116
  raise InvalidOption, "The `bundle update --bundler` target version (#{target}) does not exist"
@@ -137,18 +137,24 @@ module Bundler
137
137
  end
138
138
  end
139
139
 
140
- def find_latest_matching_spec(requirement)
140
+ def find_latest_matching_spec(requirement, pre: false)
141
141
  Bundler.configure
142
- local_result = find_latest_matching_spec_from_collection(local_specs, requirement)
142
+ # A bare `bundle update --bundler` must stay on releases, like `gem update
143
+ # --system`, so only `--pre` or a prerelease requirement opts into one.
144
+ allow_prerelease = pre || requirement.prerelease?
145
+
146
+ local_result = find_latest_matching_spec_from_collection(local_specs, requirement, allow_prerelease)
143
147
  return local_result if local_result && requirement.specific?
144
148
 
145
- remote_result = find_latest_matching_spec_from_collection(remote_specs, requirement)
149
+ remote_result = find_latest_matching_spec_from_collection(remote_specs, requirement, allow_prerelease)
146
150
  return remote_result if local_result.nil?
147
151
 
148
- [local_result, remote_result].max
152
+ [local_result, remote_result].compact.max
149
153
  end
150
154
 
151
- def find_latest_matching_spec_from_collection(specs, requirement)
155
+ def find_latest_matching_spec_from_collection(specs, requirement, allow_prerelease)
156
+ specs = specs.reject {|spec| spec.version.prerelease? } unless allow_prerelease
157
+
152
158
  specs.sort.reverse_each.find {|spec| requirement.satisfied_by?(spec.version) }
153
159
  end
154
160
 
@@ -231,6 +231,21 @@ module Bundler
231
231
  destination
232
232
  end
233
233
 
234
+ # Globs for entries matching +glob+ inside of +base_path+, returning
235
+ # absolute paths. Glob metacharacters in +base_path+ are not treated as
236
+ # part of the pattern, and matched entries are joined literally, so an
237
+ # entry starting with `~` is not expanded into the home directory.
238
+ #
239
+ # Bundler runs against whatever RubyGems the host provides, so this cannot
240
+ # delegate to Gem::Util.glob_files_in_dir, which only gained the literal
241
+ # join in RubyGems 4.1.
242
+ def glob_files_in_dir(glob, base_path)
243
+ expanded_path = nil
244
+ Dir.glob(glob, base: base_path).map! do |f|
245
+ File.join(expanded_path ||= File.expand_path(base_path), f)
246
+ end
247
+ end
248
+
234
249
  private
235
250
 
236
251
  def validate_bundle_path