bundler 2.5.5 → 2.5.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aaaf17b908dc3f0037d6da507f2177ef2cc21e023691c98f608d5ab3699431c2
4
- data.tar.gz: 64233d285e149e70f795b71cef8c92cff52360f9e86be7be3318067450c1da53
3
+ metadata.gz: 39c97ec41b023928932bc15dd7a27d7d6c44a1081d8d8a8d929323acc7923516
4
+ data.tar.gz: fcee9b11554764b4b762fbeff5be2afa1747bb00522f76a8f2ed8910af6140ba
5
5
  SHA512:
6
- metadata.gz: 3033d4bad54a516fc1ef08d38f9de79aa79ea0a4f7c944e3c9f770808aa82f571b6caf8af6545281d3eca71022caeab475f478831a37fd78ed93b2627104a09b
7
- data.tar.gz: d0035deab10246f235ec44b910a7a4552b725a5f4372a9eee20119f1e073eac9d355cda044bb56ad50390a3f879ee161b29783847d9dad92d107b75013b7f88d
6
+ metadata.gz: 3f0e03b892ab04ffbbe98dc64a8edf39976e9f06f7e3c3f0d023760de2c10335975dd6658081fe9f6daf259f19e84bb829196f9387c3037ddd3fea9fdb865c80
7
+ data.tar.gz: c483f1305486133a2a0845c4ad13de99baf81b456d88d0e899726db2d1257c445625aeb3f4b32a4b6717f42da23858336284ffecc5fd9ce9a15a6ca797349c75
data/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ # 2.5.6 (February 6, 2024)
2
+
3
+ ## Deprecations:
4
+
5
+ - Refactor lockfile generation and deprecate `Definition#lock` with explicit lockfile [#7047](https://github.com/rubygems/rubygems/pull/7047)
6
+
7
+ ## Enhancements:
8
+
9
+ - Bump `required_ruby_version` to be used in `bundle gem` template [#7430](https://github.com/rubygems/rubygems/pull/7430)
10
+
11
+ ## Bug fixes:
12
+
13
+ - Fix musl platform not being added to the lockfile [#7441](https://github.com/rubygems/rubygems/pull/7441)
14
+ - Let `Bundler.with_original_env` properly restore env variables originally empty [#7383](https://github.com/rubygems/rubygems/pull/7383)
15
+
1
16
  # 2.5.5 (January 18, 2024)
2
17
 
3
18
  ## Bug fixes:
@@ -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 = "2024-01-18".freeze
8
- @git_commit_sha = "2efa8cec93".freeze
7
+ @built_at = "2024-02-06".freeze
8
+ @git_commit_sha = "7ac045dcaa".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -437,7 +437,7 @@ module Bundler
437
437
  end
438
438
 
439
439
  def required_ruby_version
440
- "2.6.0"
440
+ "3.0.0"
441
441
  end
442
442
 
443
443
  def rubocop_version
@@ -33,8 +33,11 @@ module Bundler
33
33
  update = { bundler: bundler }
34
34
  end
35
35
 
36
+ file = options[:lockfile]
37
+ file = file ? Pathname.new(file).expand_path : Bundler.default_lockfile
38
+
36
39
  Bundler.settings.temporary(frozen: false) do
37
- definition = Bundler.definition(update)
40
+ definition = Bundler.definition(update, file)
38
41
 
39
42
  Bundler::CLI::Common.configure_gem_version_promoter(definition, options) if options[:update]
40
43
 
@@ -60,10 +63,8 @@ module Bundler
60
63
  if print
61
64
  puts definition.to_lock
62
65
  else
63
- file = options[:lockfile]
64
- file = file ? File.expand_path(file) : Bundler.default_lockfile
65
66
  puts "Writing lockfile to #{file}"
66
- definition.lock(file)
67
+ definition.lock
67
68
  end
68
69
  end
69
70
 
data/lib/bundler/cli.rb CHANGED
@@ -785,7 +785,7 @@ module Bundler
785
785
  return unless SharedHelpers.md5_available?
786
786
 
787
787
  latest = Fetcher::CompactIndex.
788
- new(nil, Source::Rubygems::Remote.new(Bundler::URI("https://rubygems.org")), nil, nil).
788
+ new(nil, Source::Rubygems::Remote.new(Gem::URI("https://rubygems.org")), nil, nil).
789
789
  send(:compact_index_client).
790
790
  instance_variable_get(:@cache).
791
791
  dependencies("bundler").
@@ -320,38 +320,26 @@ module Bundler
320
320
  dependencies.map(&:groups).flatten.uniq
321
321
  end
322
322
 
323
- def lock(file, preserve_unknown_sections = false)
324
- return if Definition.no_lock
325
-
326
- contents = to_lock
327
-
328
- # Convert to \r\n if the existing lock has them
329
- # i.e., Windows with `git config core.autocrlf=true`
330
- contents.gsub!(/\n/, "\r\n") if @lockfile_contents.match?("\r\n")
331
-
332
- if @locked_bundler_version
333
- locked_major = @locked_bundler_version.segments.first
334
- current_major = bundler_version_to_lock.segments.first
335
-
336
- updating_major = locked_major < current_major
337
- end
323
+ def lock(file_or_preserve_unknown_sections = false, preserve_unknown_sections_or_unused = false)
324
+ if [true, false, nil].include?(file_or_preserve_unknown_sections)
325
+ target_lockfile = lockfile || Bundler.default_lockfile
326
+ preserve_unknown_sections = file_or_preserve_unknown_sections
327
+ else
328
+ target_lockfile = file_or_preserve_unknown_sections
329
+ preserve_unknown_sections = preserve_unknown_sections_or_unused
338
330
 
339
- preserve_unknown_sections ||= !updating_major && (Bundler.frozen_bundle? || !(unlocking? || @unlocking_bundler))
331
+ suggestion = if target_lockfile == lockfile
332
+ "To fix this warning, remove it from the `Definition#lock` call."
333
+ else
334
+ "Instead, instantiate a new definition passing `#{target_lockfile}`, and call `lock` without a file argument on that definition"
335
+ end
340
336
 
341
- if file && File.exist?(file) && lockfiles_equal?(@lockfile_contents, contents, preserve_unknown_sections)
342
- return if Bundler.frozen_bundle?
343
- SharedHelpers.filesystem_access(file) { FileUtils.touch(file) }
344
- return
345
- end
337
+ msg = "`Definition#lock` was passed a target file argument. #{suggestion}"
346
338
 
347
- if Bundler.frozen_bundle?
348
- Bundler.ui.error "Cannot write a changed lockfile while frozen."
349
- return
339
+ Bundler::SharedHelpers.major_deprecation 2, msg
350
340
  end
351
341
 
352
- SharedHelpers.filesystem_access(file) do |p|
353
- File.open(p, "wb") {|f| f.puts(contents) }
354
- end
342
+ write_lock(target_lockfile, preserve_unknown_sections)
355
343
  end
356
344
 
357
345
  def locked_ruby_version
@@ -518,7 +506,45 @@ module Bundler
518
506
  end
519
507
 
520
508
  def lockfile_exists?
521
- lockfile && File.exist?(lockfile)
509
+ file_exists?(lockfile)
510
+ end
511
+
512
+ def file_exists?(file)
513
+ file && File.exist?(file)
514
+ end
515
+
516
+ def write_lock(file, preserve_unknown_sections)
517
+ return if Definition.no_lock
518
+
519
+ contents = to_lock
520
+
521
+ # Convert to \r\n if the existing lock has them
522
+ # i.e., Windows with `git config core.autocrlf=true`
523
+ contents.gsub!(/\n/, "\r\n") if @lockfile_contents.match?("\r\n")
524
+
525
+ if @locked_bundler_version
526
+ locked_major = @locked_bundler_version.segments.first
527
+ current_major = bundler_version_to_lock.segments.first
528
+
529
+ updating_major = locked_major < current_major
530
+ end
531
+
532
+ preserve_unknown_sections ||= !updating_major && (Bundler.frozen_bundle? || !(unlocking? || @unlocking_bundler))
533
+
534
+ if file_exists?(file) && lockfiles_equal?(@lockfile_contents, contents, preserve_unknown_sections)
535
+ return if Bundler.frozen_bundle?
536
+ SharedHelpers.filesystem_access(file) { FileUtils.touch(file) }
537
+ return
538
+ end
539
+
540
+ if Bundler.frozen_bundle?
541
+ Bundler.ui.error "Cannot write a changed lockfile while frozen."
542
+ return
543
+ end
544
+
545
+ SharedHelpers.filesystem_access(file) do |p|
546
+ File.open(p, "wb") {|f| f.puts(contents) }
547
+ end
522
548
  end
523
549
 
524
550
  def resolver
@@ -58,9 +58,9 @@ module Bundler
58
58
  env = @original.clone
59
59
  @keys.each do |key|
60
60
  value = env[key]
61
- if !value.nil? && !value.empty?
61
+ if !value.nil?
62
62
  env[@prefix + key] ||= value
63
- elsif value.nil?
63
+ else
64
64
  env[@prefix + key] ||= INTENTIONALLY_NIL
65
65
  end
66
66
  end
@@ -72,7 +72,7 @@ module Bundler
72
72
  env = @original.clone
73
73
  @keys.each do |key|
74
74
  value_original = env[@prefix + key]
75
- next if value_original.nil? || value_original.empty?
75
+ next if value_original.nil?
76
76
  if value_original == INTENTIONALLY_NIL
77
77
  env.delete(key)
78
78
  else
@@ -23,7 +23,7 @@ module Bundler
23
23
  when Gem::Net::HTTPSuccess, Gem::Net::HTTPNotModified
24
24
  response
25
25
  when Gem::Net::HTTPRedirection
26
- new_uri = Bundler::URI.parse(response["location"])
26
+ new_uri = Gem::URI.parse(response["location"])
27
27
  if new_uri.host == uri.host
28
28
  new_uri.user = uri.user
29
29
  new_uri.password = uri.password
@@ -111,7 +111,7 @@ module Bundler
111
111
  spec -= [nil, "ruby", ""]
112
112
  spec_file_name = "#{spec.join "-"}.gemspec"
113
113
 
114
- uri = Bundler::URI.parse("#{remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}.rz")
114
+ uri = Gem::URI.parse("#{remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}.rz")
115
115
  spec = if uri.scheme == "file"
116
116
  path = Gem::Util.correct_for_windows_path(uri.path)
117
117
  Bundler.safe_load_marshal Bundler.rubygems.inflate(Gem.read_binary(path))
@@ -255,7 +255,7 @@ module Bundler
255
255
 
256
256
  con = Gem::Net::HTTP::Persistent.new name: "bundler", proxy: :ENV
257
257
  if gem_proxy = Gem.configuration[:http_proxy]
258
- con.proxy = Bundler::URI.parse(gem_proxy) if gem_proxy != :no_proxy
258
+ con.proxy = Gem::URI.parse(gem_proxy) if gem_proxy != :no_proxy
259
259
  end
260
260
 
261
261
  if remote_uri.scheme == "https"
@@ -50,7 +50,7 @@ module Bundler
50
50
  append_to(gemfile_path, build_gem_lines(@options[:conservative_versioning])) if @deps.any?
51
51
 
52
52
  # since we resolved successfully, write out the lockfile
53
- @definition.lock(Bundler.default_lockfile)
53
+ @definition.lock
54
54
 
55
55
  # invalidate the cached Bundler.definition
56
56
  Bundler.reset_paths!
@@ -260,8 +260,8 @@ module Bundler
260
260
  true
261
261
  end
262
262
 
263
- def lock(opts = {})
264
- @definition.lock(Bundler.default_lockfile, opts[:preserve_unknown_sections])
263
+ def lock
264
+ @definition.lock
265
265
  end
266
266
  end
267
267
  end
@@ -47,7 +47,7 @@ module Bundler
47
47
 
48
48
  def fetch_valid_mirror_for(uri)
49
49
  downcased = uri.to_s.downcase
50
- mirror = @mirrors[downcased] || @mirrors[Bundler::URI(downcased).host] || Mirror.new(uri)
50
+ mirror = @mirrors[downcased] || @mirrors[Gem::URI(downcased).host] || Mirror.new(uri)
51
51
  mirror.validate!(@prober)
52
52
  mirror = Mirror.new(uri) unless mirror.valid?
53
53
  mirror
@@ -74,7 +74,7 @@ module Bundler
74
74
  @uri = if uri.nil?
75
75
  nil
76
76
  else
77
- Bundler::URI(uri.to_s)
77
+ Gem::URI(uri.to_s)
78
78
  end
79
79
  @valid = nil
80
80
  end
@@ -126,7 +126,7 @@ module Bundler
126
126
  if uri == "all"
127
127
  @all = true
128
128
  else
129
- @uri = Bundler::URI(uri).absolute? ? Settings.normalize_uri(uri) : uri
129
+ @uri = Gem::URI(uri).absolute? ? Settings.normalize_uri(uri) : uri
130
130
  end
131
131
  @value = value
132
132
  end
@@ -107,7 +107,7 @@ module Bundler
107
107
  def install_path
108
108
  @install_path ||=
109
109
  begin
110
- base_name = File.basename(Bundler::URI.parse(uri).normalize.path)
110
+ base_name = File.basename(Gem::URI.parse(uri).normalize.path)
111
111
 
112
112
  gem_install_dir.join("#{base_name}-#{uri_hash[0..11]}")
113
113
  end
@@ -176,7 +176,7 @@ module Bundler
176
176
  #
177
177
  # This is used by `app_cache_path`
178
178
  def app_cache_dirname
179
- base_name = File.basename(Bundler::URI.parse(uri).normalize.path)
179
+ base_name = File.basename(Gem::URI.parse(uri).normalize.path)
180
180
  "#{base_name}-#{uri_hash}"
181
181
  end
182
182
 
@@ -95,7 +95,7 @@ module Bundler
95
95
 
96
96
  def lock(opts = {})
97
97
  return if @definition.no_resolve_needed?
98
- @definition.lock(Bundler.default_lockfile, opts[:preserve_unknown_sections])
98
+ @definition.lock(opts[:preserve_unknown_sections])
99
99
  end
100
100
 
101
101
  alias_method :gems, :specs
@@ -189,7 +189,7 @@ module Bundler
189
189
  def mirror_for(uri)
190
190
  if uri.is_a?(String)
191
191
  require_relative "vendored_uri"
192
- uri = Bundler::URI(uri)
192
+ uri = Gem::URI(uri)
193
193
  end
194
194
 
195
195
  gem_mirrors.for(uri.to_s).uri
@@ -549,7 +549,7 @@ module Bundler
549
549
  end
550
550
  uri = URINormalizer.normalize_suffix(uri)
551
551
  require_relative "vendored_uri"
552
- uri = Bundler::URI(uri)
552
+ uri = Gem::URI(uri)
553
553
  unless uri.absolute?
554
554
  raise ArgumentError, format("Gem sources must be absolute. You provided '%s'.", uri)
555
555
  end
@@ -564,7 +564,7 @@ module Bundler
564
564
  key
565
565
  when Symbol
566
566
  key.name
567
- when Bundler::URI::HTTP
567
+ when Gem::URI::HTTP
568
568
  key.to_s
569
569
  else
570
570
  raise ArgumentError, "Invalid key: #{key.inspect}"
@@ -577,7 +577,7 @@ module Bundler
577
577
  key
578
578
  when Symbol
579
579
  key.to_s
580
- when Bundler::URI::HTTP
580
+ when Gem::URI::HTTP
581
581
  key.to_s
582
582
  else
583
583
  raise ArgumentError, "Invalid key: #{key.inspect}"
@@ -320,7 +320,7 @@ module Bundler
320
320
  # Adds credentials to the URI
321
321
  def configured_uri
322
322
  if /https?:/.match?(uri)
323
- remote = Bundler::URI(uri)
323
+ remote = Gem::URI(uri)
324
324
  config_auth = Bundler.settings[remote.to_s] || Bundler.settings[remote.host]
325
325
  remote.userinfo ||= config_auth
326
326
  remote.to_s
@@ -326,7 +326,7 @@ module Bundler
326
326
  if %r{^\w+://(\w+@)?}.match?(uri)
327
327
  # Downcase the domain component of the URI
328
328
  # and strip off a trailing slash, if one is present
329
- input = Bundler::URI.parse(uri).normalize.to_s.sub(%r{/$}, "")
329
+ input = Gem::URI.parse(uri).normalize.to_s.sub(%r{/$}, "")
330
330
  else
331
331
  # If there is no URI scheme, assume it is an ssh/git URI
332
332
  input = uri
@@ -48,7 +48,7 @@ module Bundler
48
48
  end
49
49
 
50
50
  uri
51
- rescue Bundler::URI::InvalidComponentError
51
+ rescue Gem::URI::InvalidComponentError
52
52
  error_message = "Please CGI escape your usernames and passwords before " \
53
53
  "setting them for authentication."
54
54
  raise HTTPError.new(error_message)
@@ -349,9 +349,9 @@ module Bundler
349
349
  def normalize_uri(uri)
350
350
  uri = URINormalizer.normalize_suffix(uri.to_s)
351
351
  require_relative "../vendored_uri"
352
- uri = Bundler::URI(uri)
352
+ uri = Gem::URI(uri)
353
353
  raise ArgumentError, "The source must be an absolute URI. For example:\n" \
354
- "source 'https://rubygems.org'" if !uri.absolute? || (uri.is_a?(Bundler::URI::HTTP) && uri.host.nil?)
354
+ "source 'https://rubygems.org'" if !uri.absolute? || (uri.is_a?(Gem::URI::HTTP) && uri.host.nil?)
355
355
  uri
356
356
  end
357
357
 
@@ -65,7 +65,7 @@ module Bundler
65
65
 
66
66
  platforms.concat(new_platforms)
67
67
 
68
- less_specific_platform = new_platforms.find {|platform| platform != Gem::Platform::RUBY && platform === Bundler.local_platform }
68
+ less_specific_platform = new_platforms.find {|platform| platform != Gem::Platform::RUBY && Bundler.local_platform === platform }
69
69
  platforms.delete(Bundler.local_platform) if less_specific_platform
70
70
 
71
71
  platforms
@@ -11,7 +11,7 @@ module Bundler
11
11
  return uri if File.exist?(uri)
12
12
 
13
13
  require_relative "vendored_uri"
14
- uri = Bundler::URI(uri)
14
+ uri = Gem::URI(uri)
15
15
  end
16
16
 
17
17
  if uri.userinfo
@@ -25,7 +25,7 @@ module Bundler
25
25
  end
26
26
  return uri.to_s if uri_to_anonymize.is_a?(String)
27
27
  uri
28
- rescue Bundler::URI::InvalidURIError # uri is not canonical uri scheme
28
+ rescue Gem::URI::InvalidURIError # uri is not canonical uri scheme
29
29
  uri
30
30
  end
31
31
 
@@ -1,5 +1,5 @@
1
1
  require_relative '../../../../../vendored_net_http'
2
- require_relative '../../../../uri/lib/uri'
2
+ require_relative '../../../../../vendored_uri'
3
3
  require 'cgi' # for escaping
4
4
  require_relative '../../../../connection_pool/lib/connection_pool'
5
5
 
@@ -22,7 +22,7 @@ autoload :OpenSSL, 'openssl'
22
22
  #
23
23
  # require 'bundler/vendor/net-http-persistent/lib/net/http/persistent'
24
24
  #
25
- # uri = Bundler::URI 'http://example.com/awesome/web/service'
25
+ # uri = Gem::URI 'http://example.com/awesome/web/service'
26
26
  #
27
27
  # http = Gem::Net::HTTP::Persistent.new
28
28
  #
@@ -39,17 +39,17 @@ autoload :OpenSSL, 'openssl'
39
39
  # post = Gem::Net::HTTP::Post.new post_uri.path
40
40
  # post.set_form_data 'some' => 'cool data'
41
41
  #
42
- # # perform the POST, the Bundler::URI is always required
42
+ # # perform the POST, the Gem::URI is always required
43
43
  # response http.request post_uri, post
44
44
  #
45
45
  # Note that for GET, HEAD and other requests that do not have a body you want
46
- # to use Bundler::URI#request_uri not Bundler::URI#path. The request_uri contains the query
46
+ # to use Gem::URI#request_uri not Gem::URI#path. The request_uri contains the query
47
47
  # params which are sent in the body for other requests.
48
48
  #
49
49
  # == TLS/SSL
50
50
  #
51
51
  # TLS connections are automatically created depending upon the scheme of the
52
- # Bundler::URI. TLS connections are automatically verified against the default
52
+ # Gem::URI. TLS connections are automatically verified against the default
53
53
  # certificate store for your computer. You can override this by changing
54
54
  # verify_mode or by specifying an alternate cert_store.
55
55
  #
@@ -72,7 +72,7 @@ autoload :OpenSSL, 'openssl'
72
72
  # == Proxies
73
73
  #
74
74
  # A proxy can be set through #proxy= or at initialization time by providing a
75
- # second argument to ::new. The proxy may be the Bundler::URI of the proxy server or
75
+ # second argument to ::new. The proxy may be the Gem::URI of the proxy server or
76
76
  # <code>:ENV</code> which will consult environment variables.
77
77
  #
78
78
  # See #proxy= and #proxy_from_env for details.
@@ -197,7 +197,7 @@ class Gem::Net::HTTP::Persistent
197
197
  # NOTE: This may not work on ruby > 1.9.
198
198
 
199
199
  def self.detect_idle_timeout uri, max = 10
200
- uri = Bundler::URI uri unless Bundler::URI::Generic === uri
200
+ uri = Gem::URI uri unless Gem::URI::Generic === uri
201
201
  uri += '/'
202
202
 
203
203
  req = Gem::Net::HTTP::Head.new uri.request_uri
@@ -455,13 +455,13 @@ class Gem::Net::HTTP::Persistent
455
455
  # Set a +name+ for fun. Your library name should be good enough, but this
456
456
  # otherwise has no purpose.
457
457
  #
458
- # +proxy+ may be set to a Bundler::URI::HTTP or :ENV to pick up proxy options from
458
+ # +proxy+ may be set to a Gem::URI::HTTP or :ENV to pick up proxy options from
459
459
  # the environment. See proxy_from_env for details.
460
460
  #
461
- # In order to use a Bundler::URI for the proxy you may need to do some extra work
462
- # beyond Bundler::URI parsing if the proxy requires a password:
461
+ # In order to use a Gem::URI for the proxy you may need to do some extra work
462
+ # beyond Gem::URI parsing if the proxy requires a password:
463
463
  #
464
- # proxy = Bundler::URI 'http://proxy.example'
464
+ # proxy = Gem::URI 'http://proxy.example'
465
465
  # proxy.user = 'AzureDiamond'
466
466
  # proxy.password = 'hunter2'
467
467
  #
@@ -510,7 +510,7 @@ class Gem::Net::HTTP::Persistent
510
510
  @verify_mode = nil
511
511
  @cert_store = nil
512
512
 
513
- @generation = 0 # incremented when proxy Bundler::URI changes
513
+ @generation = 0 # incremented when proxy Gem::URI changes
514
514
 
515
515
  if HAVE_OPENSSL then
516
516
  @verify_mode = OpenSSL::SSL::VERIFY_PEER
@@ -720,12 +720,12 @@ class Gem::Net::HTTP::Persistent
720
720
  alias key= private_key=
721
721
 
722
722
  ##
723
- # Sets the proxy server. The +proxy+ may be the Bundler::URI of the proxy server,
723
+ # Sets the proxy server. The +proxy+ may be the Gem::URI of the proxy server,
724
724
  # the symbol +:ENV+ which will read the proxy from the environment or nil to
725
725
  # disable use of a proxy. See #proxy_from_env for details on setting the
726
726
  # proxy from the environment.
727
727
  #
728
- # If the proxy Bundler::URI is set after requests have been made, the next request
728
+ # If the proxy Gem::URI is set after requests have been made, the next request
729
729
  # will shut-down and re-open all connections.
730
730
  #
731
731
  # The +no_proxy+ query parameter can be used to specify hosts which shouldn't
@@ -736,9 +736,9 @@ class Gem::Net::HTTP::Persistent
736
736
  def proxy= proxy
737
737
  @proxy_uri = case proxy
738
738
  when :ENV then proxy_from_env
739
- when Bundler::URI::HTTP then proxy
739
+ when Gem::URI::HTTP then proxy
740
740
  when nil then # ignore
741
- else raise ArgumentError, 'proxy must be :ENV or a Bundler::URI::HTTP'
741
+ else raise ArgumentError, 'proxy must be :ENV or a Gem::URI::HTTP'
742
742
  end
743
743
 
744
744
  @no_proxy.clear
@@ -763,13 +763,13 @@ class Gem::Net::HTTP::Persistent
763
763
  end
764
764
 
765
765
  ##
766
- # Creates a Bundler::URI for an HTTP proxy server from ENV variables.
766
+ # Creates a Gem::URI for an HTTP proxy server from ENV variables.
767
767
  #
768
768
  # If +HTTP_PROXY+ is set a proxy will be returned.
769
769
  #
770
- # If +HTTP_PROXY_USER+ or +HTTP_PROXY_PASS+ are set the Bundler::URI is given the
770
+ # If +HTTP_PROXY_USER+ or +HTTP_PROXY_PASS+ are set the Gem::URI is given the
771
771
  # indicated user and password unless HTTP_PROXY contains either of these in
772
- # the Bundler::URI.
772
+ # the Gem::URI.
773
773
  #
774
774
  # The +NO_PROXY+ ENV variable can be used to specify hosts which shouldn't
775
775
  # be reached via proxy; if set it should be a comma separated list of
@@ -785,7 +785,7 @@ class Gem::Net::HTTP::Persistent
785
785
 
786
786
  return nil if env_proxy.nil? or env_proxy.empty?
787
787
 
788
- uri = Bundler::URI normalize_uri env_proxy
788
+ uri = Gem::URI normalize_uri env_proxy
789
789
 
790
790
  env_no_proxy = ENV['no_proxy'] || ENV['NO_PROXY']
791
791
 
@@ -863,7 +863,7 @@ class Gem::Net::HTTP::Persistent
863
863
  # +req+ must be a Gem::Net::HTTPGenericRequest subclass (see Gem::Net::HTTP for a list).
864
864
 
865
865
  def request uri, req = nil, &block
866
- uri = Bundler::URI uri
866
+ uri = Gem::URI uri
867
867
  req = request_setup req || uri
868
868
  response = nil
869
869
 
@@ -896,7 +896,7 @@ class Gem::Net::HTTP::Persistent
896
896
  end
897
897
 
898
898
  ##
899
- # Creates a GET request if +req_or_uri+ is a Bundler::URI and adds headers to the
899
+ # Creates a GET request if +req_or_uri+ is a Gem::URI and adds headers to the
900
900
  # request.
901
901
  #
902
902
  # Returns the request.
@@ -1,4 +1,21 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bundler; end
4
- require_relative "vendor/uri/lib/uri"
4
+
5
+ # Use RubyGems vendored copy when available. Otherwise fallback to Bundler
6
+ # vendored copy. The vendored copy in Bundler can be removed once support for
7
+ # RubyGems 3.5 is dropped.
8
+
9
+ begin
10
+ require "rubygems/vendor/uri/lib/uri"
11
+ rescue LoadError
12
+ require_relative "vendor/uri/lib/uri"
13
+ Gem::URI = Bundler::URI
14
+
15
+ module Gem
16
+ def URI(uri) # rubocop:disable Naming/MethodName
17
+ Bundler::URI(uri)
18
+ end
19
+ module_function :URI
20
+ end
21
+ end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "2.5.5".freeze
4
+ VERSION = "2.5.6".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= VERSION.split(".").first.to_i
@@ -58,6 +58,8 @@ module Bundler
58
58
  str.split(/\r?\n/) do |line|
59
59
  if match = HASH_REGEX.match(line)
60
60
  indent, key, quote, val = match.captures
61
+ val = strip_comment(val)
62
+
61
63
  convert_to_backward_compatible_key!(key)
62
64
  depth = indent.size / 2
63
65
  if quote.empty? && val.empty?
@@ -72,6 +74,8 @@ module Bundler
72
74
  end
73
75
  elsif match = ARRAY_REGEX.match(line)
74
76
  _, val = match.captures
77
+ val = strip_comment(val)
78
+
75
79
  last_hash[last_empty_key] = [] unless last_hash[last_empty_key].is_a?(Array)
76
80
 
77
81
  last_hash[last_empty_key].push(val)
@@ -80,6 +84,14 @@ module Bundler
80
84
  res
81
85
  end
82
86
 
87
+ def strip_comment(val)
88
+ if val.include?("#") && !val.start_with?("#")
89
+ val.split("#", 2).first.strip
90
+ else
91
+ val
92
+ end
93
+ end
94
+
83
95
  # for settings' keys
84
96
  def convert_to_backward_compatible_key!(key)
85
97
  key << "/" if /https?:/i.match?(key) && !%r{/\Z}.match?(key)
data/lib/bundler.rb CHANGED
@@ -200,12 +200,13 @@ module Bundler
200
200
  #
201
201
  # @param unlock [Hash, Boolean, nil] Gems that have been requested
202
202
  # to be updated or true if all gems should be updated
203
+ # @param lockfile [Pathname] Path to Gemfile.lock
203
204
  # @return [Bundler::Definition]
204
- def definition(unlock = nil)
205
+ def definition(unlock = nil, lockfile = default_lockfile)
205
206
  @definition = nil if unlock
206
207
  @definition ||= begin
207
208
  configure
208
- Definition.build(default_gemfile, default_lockfile, unlock)
209
+ Definition.build(default_gemfile, lockfile, unlock)
209
210
  end
210
211
  end
211
212
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.5
4
+ version: 2.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - André Arko
@@ -22,7 +22,7 @@ authors:
22
22
  autorequire:
23
23
  bindir: exe
24
24
  cert_chain: []
25
- date: 2024-01-18 00:00:00.000000000 Z
25
+ date: 2024-02-06 00:00:00.000000000 Z
26
26
  dependencies: []
27
27
  description: Bundler manages an application's dependencies through its entire life,
28
28
  across many machines, systematically and repeatably
@@ -398,7 +398,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
398
398
  - !ruby/object:Gem::Version
399
399
  version: 3.2.3
400
400
  requirements: []
401
- rubygems_version: 3.5.5
401
+ rubygems_version: 3.5.6
402
402
  signing_key:
403
403
  specification_version: 4
404
404
  summary: The best way to manage your application's dependencies