bundler 4.1.0.beta1 → 4.1.0.beta3

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 (61) hide show
  1. checksums.yaml +4 -4
  2. data/lib/bundler/build_metadata.rb +2 -2
  3. data/lib/bundler/cli/common.rb +4 -0
  4. data/lib/bundler/cli/doctor/ssl.rb +4 -8
  5. data/lib/bundler/cli/info.rb +1 -1
  6. data/lib/bundler/cli/lock.rb +19 -4
  7. data/lib/bundler/cli/open.rb +7 -1
  8. data/lib/bundler/cli/outdated.rb +8 -10
  9. data/lib/bundler/cli/platform.rb +15 -1
  10. data/lib/bundler/cli/show.rb +5 -1
  11. data/lib/bundler/cli/update.rb +1 -1
  12. data/lib/bundler/cli.rb +22 -7
  13. data/lib/bundler/constants.rb +1 -1
  14. data/lib/bundler/definition.rb +102 -16
  15. data/lib/bundler/dsl.rb +76 -5
  16. data/lib/bundler/fetcher/downloader.rb +14 -4
  17. data/lib/bundler/fetcher.rb +4 -1
  18. data/lib/bundler/gem_helper.rb +1 -1
  19. data/lib/bundler/installer/parallel_installer.rb +2 -1
  20. data/lib/bundler/installer.rb +5 -1
  21. data/lib/bundler/lazy_specification.rb +1 -1
  22. data/lib/bundler/lockfile_generator.rb +6 -0
  23. data/lib/bundler/lockfile_parser.rb +18 -2
  24. data/lib/bundler/man/bundle-info.1 +4 -1
  25. data/lib/bundler/man/bundle-info.1.ronn +4 -0
  26. data/lib/bundler/man/bundle-lock.1 +2 -2
  27. data/lib/bundler/man/bundle-lock.1.ronn +4 -3
  28. data/lib/bundler/man/bundle-open.1 +4 -1
  29. data/lib/bundler/man/bundle-open.1.ronn +4 -1
  30. data/lib/bundler/man/bundle-outdated.1 +1 -1
  31. data/lib/bundler/man/bundle-outdated.1.ronn +1 -1
  32. data/lib/bundler/man/bundle-show.1 +4 -1
  33. data/lib/bundler/man/bundle-show.1.ronn +4 -0
  34. data/lib/bundler/man/bundle-update.1 +3 -3
  35. data/lib/bundler/man/bundle-update.1.ronn +5 -3
  36. data/lib/bundler/man/gemfile.5 +43 -2
  37. data/lib/bundler/man/gemfile.5.ronn +69 -4
  38. data/lib/bundler/match_platform.rb +12 -3
  39. data/lib/bundler/materialization.rb +3 -1
  40. data/lib/bundler/override.rb +83 -2
  41. data/lib/bundler/resolver.rb +28 -4
  42. data/lib/bundler/rubygems_ext.rb +15 -4
  43. data/lib/bundler/self_manager.rb +15 -9
  44. data/lib/bundler/settings.rb +10 -26
  45. data/lib/bundler/source/git/git_proxy.rb +39 -2
  46. data/lib/bundler/source/git.rb +34 -7
  47. data/lib/bundler/source/rubygems.rb +2 -2
  48. data/lib/bundler/source/rubygems_aggregate.rb +1 -1
  49. data/lib/bundler/source_map.rb +7 -3
  50. data/lib/bundler/spec_set.rb +8 -4
  51. data/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +1 -1
  52. data/lib/bundler/vendor/fileutils/lib/fileutils.rb +54 -29
  53. data/lib/bundler/version.rb +1 -1
  54. data/lib/bundler.rb +1 -3
  55. data/lib/rubygems/compact_index_client/http_fetcher.rb +5 -3
  56. data/lib/rubygems/compact_index_client/parser.rb +1 -0
  57. data/lib/rubygems/vendor/uri/lib/uri/common.rb +1 -1
  58. data/lib/rubygems/vendor/uri/lib/uri/generic.rb +15 -3
  59. data/lib/rubygems/vendor/uri/lib/uri/version.rb +1 -1
  60. data/lib/rubygems/yaml_serializer.rb +131 -103
  61. metadata +391 -390
data/lib/bundler/dsl.rb CHANGED
@@ -17,7 +17,7 @@ module Bundler
17
17
  VALID_PLATFORMS = Bundler::CurrentRuby::PLATFORM_MAP.keys.freeze
18
18
 
19
19
  VALID_KEYS = %w[group groups git path glob name branch ref tag require submodules
20
- platform platforms source install_if force_ruby_platform].freeze
20
+ platform platforms source install_if force_ruby_platform sparse_checkout].freeze
21
21
 
22
22
  GITHUB_PULL_REQUEST_URL = %r{\Ahttps://github\.com/([A-Za-z0-9_\-\.]+/[A-Za-z0-9_\-\.]+)/pull/(\d+)\z}
23
23
  GITLAB_MERGE_REQUEST_URL = %r{\Ahttps://gitlab\.com/([A-Za-z0-9_\-\./]+)/-/merge_requests/(\d+)\z}
@@ -200,6 +200,17 @@ module Bundler
200
200
 
201
201
  def override(target, **operations)
202
202
  validate_override_target!(target)
203
+ source_location = caller_locations(1, 1)&.first
204
+
205
+ # 4.1.0.beta2 spelled `with:` and `in:` as `to:` and `from:`.
206
+ if operations.key?(:from)
207
+ raise ArgumentError, "`from:` and `to:` of `override` are now `in:` and `with:`; write `override #{target.inspect}, with: #{operations.fetch(:to, "<gem>").inspect}, in: #{operations[:from].inspect}`"
208
+ end
209
+
210
+ if operations.key?(:in) || operations.key?(:with)
211
+ add_dependency_override(target, operations, source_location)
212
+ return
213
+ end
203
214
 
204
215
  if target == :all && operations.key?(:version)
205
216
  raise ArgumentError, "`override :all, version:` is not allowed; version requirements are per-gem"
@@ -211,7 +222,6 @@ module Bundler
211
222
  validate_override_uniqueness!(target, field)
212
223
  end
213
224
 
214
- source_location = caller_locations(1, 1)&.first
215
225
  operations.each do |field, operation|
216
226
  @overrides << Override.new(target, field, operation, source_location: source_location)
217
227
  end
@@ -219,6 +229,7 @@ module Bundler
219
229
 
220
230
  def to_definition(lockfile, unlock)
221
231
  check_primary_source_safety
232
+ check_dropped_dependencies
222
233
  lockfile = @lockfile unless @lockfile.nil?
223
234
  Definition.new(lockfile, @dependencies, @sources, unlock, @ruby_version, @optional_groups, @gemfiles, @overrides)
224
235
  end
@@ -286,8 +297,16 @@ module Bundler
286
297
 
287
298
  def validate_override_target!(target)
288
299
  return if target == :all
289
- return if target.is_a?(String)
290
- raise ArgumentError, "override target must be :all or a gem name string, got #{target.inspect}"
300
+ raise ArgumentError, "override target must be :all or a gem name string, got #{target.inspect}" unless target.is_a?(String)
301
+ validate_override_gem_name!(target)
302
+ end
303
+
304
+ # Override names are recorded in the lockfile's OVERRIDES section, so they
305
+ # must be valid gem names.
306
+ def validate_override_gem_name!(name)
307
+ validate_gem_name!(name)
308
+ return if Gem::Specification::VALID_NAME_PATTERN.match?(name)
309
+ raise GemfileError, "#{name.inspect} is not a valid gem name"
291
310
  end
292
311
 
293
312
  def validate_override_field!(field)
@@ -317,6 +336,54 @@ module Bundler
317
336
  raise ArgumentError, "duplicate override for #{target.inspect} `#{field}:`"
318
337
  end
319
338
 
339
+ def add_dependency_override(target, operations, source_location)
340
+ unless operations.key?(:in)
341
+ raise ArgumentError, "`override #{target.inspect}, with:` requires `in:` naming the gem whose dependency is rewritten"
342
+ end
343
+ unless operations.key?(:with)
344
+ raise ArgumentError, "`override #{target.inspect}, in:` requires `with:`; use `with: nil` to drop the dependency or `with: \"<gem>\"` to replace it"
345
+ end
346
+
347
+ from = operations[:in]
348
+ with = operations[:with]
349
+ requirement = operations[:version]
350
+
351
+ raise ArgumentError, "`override :all` does not accept `in:`" if target == :all
352
+ raise ArgumentError, "`in:` must be a gem name string, got #{from.inspect}" unless from.is_a?(String)
353
+ raise ArgumentError, "`with:` must be a gem name string or nil, got #{with.inspect}" unless with.nil? || with.is_a?(String)
354
+ raise ArgumentError, "`with:` must name a gem other than #{target.inspect} and #{from.inspect}" if with == target || with == from
355
+ validate_override_gem_name!(from)
356
+ validate_override_gem_name!(with) if with
357
+
358
+ unsupported = operations.keys - [:in, :with, :version]
359
+ if unsupported.any?
360
+ raise ArgumentError, "unsupported override field `#{unsupported.first}:` with `in:`; supported fields: `with:`, `version:`"
361
+ end
362
+
363
+ if operations.key?(:version)
364
+ raise ArgumentError, "`version:` with `in:` requires `with:` to name a replacement gem" if with.nil?
365
+ raise ArgumentError, "`version:` with `in:` must be a version requirement string, got #{requirement.inspect}" unless requirement.is_a?(String)
366
+ validate_override_operation!(requirement)
367
+ end
368
+
369
+ if @overrides.any? {|o| o.target == target && o.from == from }
370
+ raise ArgumentError, "duplicate override for #{target.inspect} `in: #{from.inspect}`"
371
+ end
372
+
373
+ @overrides << Override.new(target, :with, with, from: from, requirement: requirement, source_location: source_location)
374
+ end
375
+
376
+ # Dropping a gem the Gemfile requires directly would leave it installed
377
+ # anyway, with only the parent's requirement gone.
378
+ def check_dropped_dependencies
379
+ @overrides.each do |override|
380
+ next unless override.from && override.operation.nil?
381
+ next unless @dependencies.any? {|d| d.name == override.target }
382
+
383
+ raise GemfileError, "#{override} cannot drop #{override.target} because the Gemfile depends on it directly"
384
+ end
385
+ end
386
+
320
387
  def add_dependency(name, version = nil, options = {})
321
388
  options["gemfile"] = @gemfile
322
389
  options["source"] ||= @source
@@ -460,7 +527,7 @@ module Bundler
460
527
  @valid_keys ||= VALID_KEYS
461
528
  end
462
529
 
463
- def normalize_options(name, version, opts)
530
+ def validate_gem_name!(name)
464
531
  if name.is_a?(Symbol)
465
532
  raise GemfileError, %(You need to specify gem names as Strings. Use 'gem "#{name}"' instead)
466
533
  end
@@ -468,6 +535,10 @@ module Bundler
468
535
  raise GemfileError, %('#{name}' is not a valid gem name because it contains whitespace)
469
536
  end
470
537
  raise GemfileError, %(an empty gem name is not valid) if name.empty?
538
+ end
539
+
540
+ def normalize_options(name, version, opts)
541
+ validate_gem_name!(name)
471
542
 
472
543
  normalize_hash(opts)
473
544
 
@@ -56,12 +56,18 @@ module Bundler
56
56
  if https?(uri) && !https?(new_uri)
57
57
  raise HTTPError, "Redirecting to a non-https URI is not allowed: #{URICredentialsFilter.credential_filtered_uri(new_uri)}"
58
58
  end
59
- if new_uri.host == uri.host
59
+ if [new_uri.scheme, new_uri.host, new_uri.port] == [uri.scheme, uri.host, uri.port]
60
60
  new_uri.user = uri.user
61
61
  new_uri.password = uri.password
62
+ else
63
+ # see Gem::RemoteFetcher#fetch_http. A nil value removes the header
64
+ # that ConnectionPools adds from its override_headers.
65
+ headers = headers.merge("X-Gemfile-Source" => nil)
62
66
  end
63
67
  fetch(new_uri, headers, counter + 1)
64
68
  when Gem::Net::HTTPRequestedRangeNotSatisfiable
69
+ raise bad_response(response) unless headers.key?("Range")
70
+
65
71
  new_headers = headers.dup
66
72
  new_headers.delete("Range")
67
73
  fetch(uri, new_headers)
@@ -77,9 +83,7 @@ module Bundler
77
83
  when Gem::Net::HTTPNotFound
78
84
  raise FallbackError, "Gem::Net::HTTPNotFound: #{filtered_uri}"
79
85
  else
80
- message = "Gem::#{response.class.name.gsub(/\AGem::/, "")}"
81
- message += ": #{response.body}" unless response.body.empty?
82
- raise HTTPError, message
86
+ raise bad_response(response)
83
87
  end
84
88
  end
85
89
 
@@ -117,6 +121,12 @@ module Bundler
117
121
 
118
122
  private
119
123
 
124
+ def bad_response(response)
125
+ message = "Gem::#{response.class.name.gsub(/\AGem::/, "")}"
126
+ message += ": #{response.body}" unless response.body.empty?
127
+ HTTPError.new(message)
128
+ end
129
+
120
130
  def network_down_error(uri, filtered_uri)
121
131
  host = uri.host
122
132
  host_port = "#{host}:#{uri.port}"
@@ -157,7 +157,10 @@ module Bundler
157
157
  elsif cached_spec_path = gemspec_cached_path(spec_file_name)
158
158
  Bundler.load_gemspec(cached_spec_path)
159
159
  else
160
- Bundler.safe_load_marshal Bundler.rubygems.inflate(downloader.fetch(uri).body)
160
+ body = Bundler::Retry.new("fetcher", FAIL_ERRORS).attempts do
161
+ downloader.fetch(uri).body
162
+ end
163
+ Bundler.safe_load_marshal Bundler.rubygems.inflate(body)
161
164
  end
162
165
  raise MarshalError, "is #{spec.inspect}" unless spec.is_a?(Gem::Specification)
163
166
  spec
@@ -216,7 +216,7 @@ module Bundler
216
216
  Bundler.ui.debug(cmd)
217
217
  SharedHelpers.chdir(base) do
218
218
  outbuf = IO.popen(cmd, err: [:child, :out], &:read)
219
- status = $?
219
+ status = Process.last_status
220
220
  block&.call(outbuf) if status.success?
221
221
  [outbuf, status]
222
222
  end
@@ -69,7 +69,8 @@ module Bundler
69
69
  @specs = all_specs.map {|s| SpecInstallation.new(s) }
70
70
  specs_by_name = @specs.to_h {|s| [s.name, s] }
71
71
  @specs.each do |spec_install|
72
- spec_install.dependencies = spec_install.spec.dependencies.filter_map do |dep|
72
+ dependencies = Override.rewrite_dependencies(installer.definition.overrides, spec_install.name, spec_install.spec.dependencies)
73
+ spec_install.dependencies = dependencies.filter_map do |dep|
73
74
  specs_by_name[dep.name] unless dep.type == :development || dep.name == spec_install.name
74
75
  end
75
76
  end
@@ -103,7 +103,7 @@ module Bundler
103
103
 
104
104
  if options[:binstubs_cmd] && spec.executables.empty?
105
105
  options = {}
106
- spec.runtime_dependencies.each do |dep|
106
+ Override.rewrite_dependencies(@definition.overrides, spec.name, spec.runtime_dependencies).each do |dep|
107
107
  bins = @definition.specs[dep].first.executables
108
108
  options[dep.name] = bins unless bins.empty?
109
109
  end
@@ -127,6 +127,8 @@ module Bundler
127
127
  template_path = File.expand_path("templates/Executable", __dir__)
128
128
  template = File.read(template_path)
129
129
 
130
+ Bundler.mkdir_p(bin_path)
131
+
130
132
  exists = []
131
133
  spec.executables.each do |executable|
132
134
  binstub_path = "#{bin_path}/#{executable}"
@@ -173,6 +175,8 @@ module Bundler
173
175
  ruby_command = Thor::Util.ruby_command
174
176
  ruby_command = ruby_command
175
177
 
178
+ Bundler.mkdir_p(bin_path)
179
+
176
180
  spec.executables.each do |executable|
177
181
  next if executable == "bundle"
178
182
  executable_path = Pathname(spec.full_gem_path).join(spec.bindir, executable).relative_path_from(bin_path)
@@ -286,7 +286,7 @@ module Bundler
286
286
  # which would affect `bundler/setup` performance.
287
287
  def validate_dependencies(spec)
288
288
  if !@materialization_options[:strict] && spec.is_a?(StubSpecification)
289
- spec.dependencies = dependencies
289
+ spec.dependencies = Override.rewrite_dependencies(overrides, name, dependencies)
290
290
  else
291
291
  if !source.is_a?(Source::Path) && spec.runtime_dependencies.sort != dependencies.sort
292
292
  raise IncorrectLockfileDependencies.new(self, spec.runtime_dependencies, dependencies)
@@ -19,6 +19,7 @@ module Bundler
19
19
  add_sources
20
20
  add_platforms
21
21
  add_dependencies
22
+ add_overrides
22
23
  add_content_addresses
23
24
  add_checksums
24
25
  add_locked_ruby_version
@@ -67,6 +68,11 @@ module Bundler
67
68
  end
68
69
  end
69
70
 
71
+ def add_overrides
72
+ overrides = definition.overrides_to_lock
73
+ add_section("OVERRIDES", overrides) unless overrides.empty?
74
+ end
75
+
70
76
  def add_content_addresses
71
77
  content_addresses = definition.resolve.filter_map do |spec|
72
78
  next unless Gem::ContentAddress.content_addressed?(spec, validate_ruby_abi: false)
@@ -36,12 +36,14 @@ module Bundler
36
36
  :bundler_version,
37
37
  :ruby_version,
38
38
  :checksums,
39
+ :overrides,
39
40
  )
40
41
 
41
42
  BUNDLED = "BUNDLED WITH"
42
43
  DEPENDENCIES = "DEPENDENCIES"
43
44
  CHECKSUMS = "CHECKSUMS"
44
45
  CONTENT_ADDRESSES = "CONTENT ADDRESSES"
46
+ OVERRIDES = "OVERRIDES"
45
47
  PLATFORMS = "PLATFORMS"
46
48
  RUBY = "RUBY VERSION"
47
49
  GIT = "GIT"
@@ -49,7 +51,7 @@ module Bundler
49
51
  PATH = "PATH"
50
52
  PLUGIN = "PLUGIN SOURCE"
51
53
  SPECS = " specs:"
52
- OPTIONS = /^ ([a-z]+): (.*)$/i
54
+ OPTIONS = /^ ([a-z_]+): (.*)$/i
53
55
  SOURCE = [GIT, GEM, PATH, PLUGIN].freeze
54
56
 
55
57
  SECTIONS_BY_VERSION_INTRODUCED = {
@@ -61,7 +63,11 @@ module Bundler
61
63
  Gem::Version.create("4.1.0") => [CONTENT_ADDRESSES].freeze,
62
64
  }.freeze
63
65
 
64
- KNOWN_SECTIONS = SECTIONS_BY_VERSION_INTRODUCED.values.flatten!.freeze
66
+ # OVERRIDES is deliberately not in SECTIONS_BY_VERSION_INTRODUCED. Sections
67
+ # listed there are ignored when comparing a lockfile bundled with an older
68
+ # Bundler, so a lockfile still BUNDLED WITH 4.0 would never get its
69
+ # overrides recorded while the resolution stays the same.
70
+ KNOWN_SECTIONS = (SECTIONS_BY_VERSION_INTRODUCED.values.flatten + [OVERRIDES]).freeze
65
71
 
66
72
  ENVIRONMENT_VERSION_SECTIONS = [BUNDLED, RUBY].freeze
67
73
  deprecate_constant(:ENVIRONMENT_VERSION_SECTIONS)
@@ -104,6 +110,7 @@ module Bundler
104
110
  @dependencies = {}
105
111
  @parse_method = nil
106
112
  @specs = {}
113
+ @overrides = nil
107
114
  @lockfile_path = lockfile_path || begin
108
115
  SharedHelpers.relative_lockfile_path
109
116
  rescue GemfileNotFound
@@ -144,6 +151,9 @@ module Bundler
144
151
  @parse_method = :parse_checksum
145
152
  elsif line == CONTENT_ADDRESSES
146
153
  @parse_method = :parse_content_address
154
+ elsif line == OVERRIDES
155
+ @overrides = []
156
+ @parse_method = :parse_override
147
157
  elsif line == PLATFORMS
148
158
  @parse_method = :parse_platform
149
159
  elsif line == RUBY
@@ -270,6 +280,12 @@ module Bundler
270
280
  @dependencies[dep.name] = dep
271
281
  end
272
282
 
283
+ def parse_override(line)
284
+ raise ArgumentError, "invalid override in lockfile: #{line.inspect}" unless line.start_with?(" ") && line[2] != " "
285
+
286
+ @overrides << Override.from_lock(line[2..])
287
+ end
288
+
273
289
  def parse_checksum(line)
274
290
  return unless line =~ NAME_VERSION
275
291
 
@@ -4,7 +4,7 @@
4
4
  .SH "NAME"
5
5
  \fBbundle\-info\fR \- Show information for the given gem in your bundle
6
6
  .SH "SYNOPSIS"
7
- \fBbundle info\fR [GEM_NAME] [\-\-path] [\-\-version]
7
+ \fBbundle info\fR [GEM_NAME] [\-\-path] [\-\-version] [\-\-exact\-match]
8
8
  .SH "DESCRIPTION"
9
9
  Given a gem name present in your bundle, print the basic information about it such as homepage, version, path and summary\.
10
10
  .SH "OPTIONS"
@@ -14,4 +14,7 @@ Print the path of the given gem
14
14
  .TP
15
15
  \fB\-\-version\fR
16
16
  Print gem version
17
+ .TP
18
+ \fB\-\-exact\-match\fR
19
+ Only match gems whose names exactly match the given name\.
17
20
 
@@ -6,6 +6,7 @@ bundle-info(1) -- Show information for the given gem in your bundle
6
6
  `bundle info` [GEM_NAME]
7
7
  [--path]
8
8
  [--version]
9
+ [--exact-match]
9
10
 
10
11
  ## DESCRIPTION
11
12
 
@@ -19,3 +20,6 @@ Given a gem name present in your bundle, print the basic information about it
19
20
 
20
21
  * `--version`:
21
22
  Print gem version
23
+
24
+ * `--exact-match`:
25
+ Only match gems whose names exactly match the given name.
@@ -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\.
@@ -49,7 +49,7 @@ If updating, prefer updating only to next patch version\.
49
49
  If updating, prefer updating only to next minor version\.
50
50
  .TP
51
51
  \fB\-\-major\fR
52
- If updating, prefer updating to next major version (default)\.
52
+ If updating, prefer updating to latest major version (default)\.
53
53
  .TP
54
54
  \fB\-\-pre\fR
55
55
  If updating, always choose the highest allowed version, regardless of prerelease status\.
@@ -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
@@ -74,7 +75,7 @@ Lock the gems specified in Gemfile.
74
75
  If updating, prefer updating only to next minor version.
75
76
 
76
77
  * `--major`:
77
- If updating, prefer updating to next major version (default).
78
+ If updating, prefer updating to latest major version (default).
78
79
 
79
80
  * `--pre`:
80
81
  If updating, always choose the highest allowed version, regardless of prerelease status.
@@ -4,7 +4,7 @@
4
4
  .SH "NAME"
5
5
  \fBbundle\-open\fR \- Opens the source directory for a gem in your bundle
6
6
  .SH "SYNOPSIS"
7
- \fBbundle open\fR [GEM] [\-\-path=PATH]
7
+ \fBbundle open\fR [GEM] [\-\-path=PATH] [\-\-exact\-match]
8
8
  .SH "DESCRIPTION"
9
9
  Opens the source directory of the provided GEM in your editor\.
10
10
  .P
@@ -29,4 +29,7 @@ Will open the README\.md file of the 'rack' gem source in your bundle\.
29
29
  .TP
30
30
  \fB\-\-path[=PATH]\fR
31
31
  Specify GEM source relative path to open\.
32
+ .TP
33
+ \fB\-\-exact\-match\fR
34
+ Only match gems whose names exactly match the given name\.
32
35
 
@@ -3,7 +3,7 @@ bundle-open(1) -- Opens the source directory for a gem in your bundle
3
3
 
4
4
  ## SYNOPSIS
5
5
 
6
- `bundle open` [GEM] [--path=PATH]
6
+ `bundle open` [GEM] [--path=PATH] [--exact-match]
7
7
 
8
8
  ## DESCRIPTION
9
9
 
@@ -26,3 +26,6 @@ Will open the README.md file of the 'rack' gem source in your bundle.
26
26
 
27
27
  * `--path[=PATH]`:
28
28
  Specify GEM source relative path to open.
29
+
30
+ * `--exact-match`:
31
+ Only match gems whose names exactly match the given name.
@@ -37,7 +37,7 @@ List gems organized by groups\.
37
37
  Prefer updating only to next minor version\.
38
38
  .TP
39
39
  \fB\-\-major\fR
40
- Prefer updating to next major version (default)\.
40
+ Prefer updating to latest major version (default)\.
41
41
  .TP
42
42
  \fB\-\-patch\fR
43
43
  Prefer updating only to next patch version\.
@@ -55,7 +55,7 @@ are up to date, Bundler will exit with a status of 0. Otherwise, it will exit 1.
55
55
  Prefer updating only to next minor version.
56
56
 
57
57
  * `--major`:
58
- Prefer updating to next major version (default).
58
+ Prefer updating to latest major version (default).
59
59
 
60
60
  * `--patch`:
61
61
  Prefer updating only to next patch version.
@@ -4,7 +4,7 @@
4
4
  .SH "NAME"
5
5
  \fBbundle\-show\fR \- Shows all the gems in your bundle, or the path to a gem
6
6
  .SH "SYNOPSIS"
7
- \fBbundle show\fR [GEM] [\-\-paths]
7
+ \fBbundle show\fR [GEM] [\-\-paths] [\-\-exact\-match]
8
8
  .SH "DESCRIPTION"
9
9
  Without the [GEM] option, \fBshow\fR will print a list of the names and versions of all gems that are required by your [\fBGemfile(5)\fR][Gemfile(5)], sorted by name\.
10
10
  .P
@@ -13,4 +13,7 @@ Calling show with [GEM] will list the exact location of that gem on your machine
13
13
  .TP
14
14
  \fB\-\-paths\fR
15
15
  List the paths of all gems that are required by your [\fBGemfile(5)\fR][Gemfile(5)], sorted by gem name\.
16
+ .TP
17
+ \fB\-\-exact\-match\fR
18
+ Only match gems whose names exactly match the given name\.
16
19
 
@@ -5,6 +5,7 @@ bundle-show(1) -- Shows all the gems in your bundle, or the path to a gem
5
5
 
6
6
  `bundle show` [GEM]
7
7
  [--paths]
8
+ [--exact-match]
8
9
 
9
10
  ## DESCRIPTION
10
11
 
@@ -19,3 +20,6 @@ machine.
19
20
  * `--paths`:
20
21
  List the paths of all gems that are required by your [`Gemfile(5)`][Gemfile(5)],
21
22
  sorted by gem name.
23
+
24
+ * `--exact-match`:
25
+ Only match gems whose names exactly match the given name.
@@ -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\.
@@ -54,7 +54,7 @@ Prefer updating only to next patch version\.
54
54
  Prefer updating only to next minor version\.
55
55
  .TP
56
56
  \fB\-\-major\fR
57
- Prefer updating to next major version (default)\.
57
+ Prefer updating to latest major version (default)\.
58
58
  .TP
59
59
  \fB\-\-pre\fR
60
60
  Always choose the highest allowed version, regardless of prerelease status\.
@@ -175,7 +175,7 @@ Prefer updating only to next patch version\.
175
175
  Prefer updating only to next minor version\.
176
176
  .TP
177
177
  \fB\-\-major\fR
178
- Prefer updating to next major version (default)\.
178
+ Prefer updating to latest major version (default)\.
179
179
  .TP
180
180
  \fB\-\-strict\fR
181
181
  Do not allow any gem to be updated past latest \fB\-\-patch\fR | \fB\-\-minor\fR | \fB\-\-major\fR\.
@@ -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.
@@ -81,7 +83,7 @@ gem.
81
83
  Prefer updating only to next minor version.
82
84
 
83
85
  * `--major`:
84
- Prefer updating to next major version (default).
86
+ Prefer updating to latest major version (default).
85
87
 
86
88
  * `--pre`:
87
89
  Always choose the highest allowed version, regardless of prerelease status.
@@ -236,7 +238,7 @@ versions are resolved. One of the following options can be used: `--patch`,
236
238
  Prefer updating only to next minor version.
237
239
 
238
240
  * `--major`:
239
- Prefer updating to next major version (default).
241
+ Prefer updating to latest major version (default).
240
242
 
241
243
  * `--strict`:
242
244
  Do not allow any gem to be updated past latest `--patch` | `--minor` | `--major`.
@@ -295,6 +295,13 @@ gem "rails", git: "https://github\.com/rails/rails\.git", ref: "4aded"
295
295
  .TP
296
296
  \fBsubmodules\fR
297
297
  For reference, a git submodule \fIhttps://git\-scm\.com/book/en/v2/Git\-Tools\-Submodules\fR lets you have another git repository within a subfolder of your repository\. Specify \fBsubmodules: true\fR to cause bundler to expand any submodules included in the git repository
298
+ .TP
299
+ \fBsparse_checkout\fR
300
+ Specify a directory, or an array of directories, to include when checking out a git repository\. Uses git's sparse\-checkout feature (requires git 2\.25+) to only check out the specified directories, reducing disk usage for large repos\. Unless \fBglob\fR is given, the \fB\.gemspec\fR is looked up within those directories\.
301
+ .IP
302
+ gem "foo", git: "https://github\.com/org/monorepo\.git", sparse_checkout: "packages/foo"
303
+ .IP
304
+ Files at the top level of the repository are always checked out\. On git versions below 2\.25, the entire repository will be checked out with a warning\.
298
305
  .P
299
306
  If a git repository contains multiple \fB\.gemspecs\fR, each \fB\.gemspec\fR represents a gem located at the same place in the file system as the \fB\.gemspec\fR\.
300
307
  .IP "" 4
@@ -490,7 +497,7 @@ a version requirement string (e\.g\. \fB">= 8\.0"\fR), which \fBreplaces\fR the
490
497
  .P
491
498
  \fB:all\fR only applies to \fBrequired_ruby_version:\fR and \fBrequired_rubygems_version:\fR\. A per\-gem override on the same field takes precedence over an \fB:all\fR override\. \fB:all + version:\fR is rejected: version requirements only make sense per gem\.
492
499
  .P
493
- Multiple \fBoverride\fR calls for distinct targets are allowed; declaring the same \fBtarget\fR and \fBfield\fR twice is an error\.
500
+ Declaring the same \fBtarget\fR and \fBfield\fR twice is an error\.
494
501
  .IP "" 4
495
502
  .nf
496
503
  source "https://rubygems\.org"
@@ -514,7 +521,41 @@ gem "rails", "~> 7\.0"
514
521
  .fi
515
522
  .IP "" 0
516
523
  .P
517
- The override only affects resolution and the install\-time Ruby/RubyGems compatibility checks; \fBGemfile\.lock\fR continues to reflect the resolved versions, not the rewritten requirements\. When resolution still fails, Bundler appends the active overrides (with their Gemfile location) to the error message so it is clear which override shaped the constraint set\.
524
+ The override only affects resolution and the install\-time Ruby/RubyGems compatibility checks; the gems in \fBGemfile\.lock\fR continue to reflect the resolved versions, not the rewritten requirements\. The overrides themselves are recorded in the lockfile's \fBOVERRIDES\fR section, one line per field, sorted:
525
+ .IP "" 4
526
+ .nf
527
+ OVERRIDES
528
+ "rails", version: ">= 8\.0"
529
+ :all, required_ruby_version: :ignore_upper
530
+ .fi
531
+ .IP "" 0
532
+ .P
533
+ Requirements are recorded in normalized form, so \fB">=8\.0"\fR and \fB">= 8\.0"\fR are the same override\. A frozen install fails when the Gemfile's overrides differ from the recorded ones\. Adding or removing a \fB:all\fR or metadata override rewrites the section and keeps the locked versions\. The exception is a locked gem that is not installed and whose metadata rejects the current Ruby\. Bundler re\-resolves it, as it does without the override\. Run \fBbundle update\fR to re\-resolve under the override\. When resolution still fails, Bundler appends the active overrides (with their Gemfile location) to the error message so it is clear which override shaped the constraint set\.
534
+ .SS "DROPPING OR REPLACING A DEPENDENCY"
535
+ \fBwith:\fR and \fBin:\fR rewrite a single dependency of a single gem:
536
+ .IP "" 4
537
+ .nf
538
+ override <target>, with: nil, in: <gem>
539
+ override <target>, with: <replacement>, in: <gem>, version: <requirement>
540
+ .fi
541
+ .IP "" 0
542
+ .P
543
+ \fBwith: nil\fR removes the dependency of \fB<gem>\fR on \fB<target>\fR, so \fB<target>\fR is not installed unless something else still requires it\. \fBwith: <replacement>\fR makes \fB<gem>\fR depend on \fB<replacement>\fR instead of \fB<target>\fR\. The requirement \fB<gem>\fR put on \fB<target>\fR is discarded, and the optional \fBversion:\fR gives the replacement its own\. Both forms apply whether \fB<gem>\fR is a direct or a transitive dependency\.
544
+ .P
545
+ \fBin:\fR is required, and so is \fBwith:\fR once \fBin:\fR is given\. To rewrite the same dependency of several gems, write one \fBoverride\fR per gem\. It is an error to declare the same \fB<target>\fR and \fBin:\fR twice, to drop a gem that the Gemfile requires directly, or to replace a gem that another gem still requires, since both would then be in the bundle\.
546
+ .IP "" 4
547
+ .nf
548
+ # jekyll only loads em\-websocket for `jekyll serve \-\-livereload`\.
549
+ override "em\-websocket", with: nil, in: "jekyll"
550
+
551
+ # Use an API\-compatible gem that provides the same files\.
552
+ override "foo", with: "foo\-lite", in: "bar"
553
+ .fi
554
+ .IP "" 0
555
+ .P
556
+ Bundler does not check what a gem loads at runtime\. If \fB<gem>\fR requires \fB<target>\fR unconditionally, dropping it makes that require raise \fBLoadError\fR, as with jekyll's dependency on jekyll\-sass\-converter or the adapters that faraday 1\.x requires on load\. A replacement only works when it provides the files \fB<gem>\fR requires, and it does not take over the name of \fB<target>\fR: \fBGem\.loaded_specs\fR has no entry for \fB<target>\fR, and \fBgem "<target>"\fR fails\.
557
+ .P
558
+ \fBGemfile\.lock\fR keeps listing \fB<target>\fR under \fB<gem>\fR as the gem publishes it, while the locked gems leave \fB<target>\fR out or include \fB<replacement>\fR, and the \fBOVERRIDES\fR section records the rewrite so tools that read the lockfile can apply it\. A frozen install accepts that lockfile as long as the Gemfile still has the override\. Removing the override makes Bundler resolve \fB<target>\fR again\.
518
559
  .SH "SOURCE PRIORITY"
519
560
  When attempting to locate a gem to satisfy a gem requirement, bundler uses the following priority order:
520
561
  .IP "1." 4