bundler 2.5.20 → 2.5.22

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: e59558368e46949dd7c5ffba129268c0d67bd7b1ac7b129935d93cc98f1a3faf
4
- data.tar.gz: 8414936d741a6f7b43fbe862206da38e065d08c1b02ab8d97752df89cc1bfed9
3
+ metadata.gz: bc7261a0b8dc5361d73ec05037b3ceb245a228a8e5e068928fd8db3fc68e6fb3
4
+ data.tar.gz: '049390d33cb5586ed405378073f30bb45e0f0e3127ee6b857cf79574dfe2d415'
5
5
  SHA512:
6
- metadata.gz: 51a505a69ddf7c9f72858168d0ce466ca819ffcc593dba0ee6edf43e971598311e5e4fc04e3199e773c4c0ee6d6fba09d993b9e0d8830c3a1a35b7c1cb670e0d
7
- data.tar.gz: c31c639837772f1ed9597e323b7f4b37b913455d5139770a1f4c4b16ebe05aa4941c58f2f4425c609d7bafb5591650bdfa2b88a9ca0ff2f568f79db08f971585
6
+ metadata.gz: 977e79ef6df50d6fa48909d74b9867621ba7f7883d4e438e9f4f658ec49030dd4752c3926dfea84be23da1e7964599d93adafbc3458df90f34380208cb810d84
7
+ data.tar.gz: ebd1d89e12a3d56c653cf90ef0bcb90d4cbc3b739f7ebbd5033505b367ee17c4320defc8c5810d4bb762ff482425c9326385bb6044bf012e397dc3f7d12eaa65
data/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ # 2.5.22 (October 16, 2024)
2
+
3
+ ## Enhancements:
4
+
5
+ - Update vendored `uri` and `net-http` [#8112](https://github.com/rubygems/rubygems/pull/8112)
6
+
7
+ ## Bug fixes:
8
+
9
+ - Fix bundler sometimes crashing because of trying to use a version of psych compiled for a different Ruby [#8104](https://github.com/rubygems/rubygems/pull/8104)
10
+
11
+ # 2.5.21 (October 3, 2024)
12
+
13
+ ## Bug fixes:
14
+
15
+ - Fix bug report template printed when changing a path source to a git source in frozen mode [#8079](https://github.com/rubygems/rubygems/pull/8079)
16
+ - Fix `stub.activated?` sometimes returning false after activation under bundler [#8073](https://github.com/rubygems/rubygems/pull/8073)
17
+ - Fix old cache format detection when application is not source controlled [#8076](https://github.com/rubygems/rubygems/pull/8076)
18
+ - Fix `bundler/inline` resetting ENV changes [#8059](https://github.com/rubygems/rubygems/pull/8059)
19
+
1
20
  # 2.5.20 (September 24, 2024)
2
21
 
3
22
  ## Enhancements:
@@ -4,8 +4,8 @@ module Bundler
4
4
  # Represents metadata from when the Bundler gem was built.
5
5
  module BuildMetadata
6
6
  # begin ivars
7
- @built_at = "2024-09-24".freeze
8
- @git_commit_sha = "a0fc99594a".freeze
7
+ @built_at = "2024-10-16".freeze
8
+ @git_commit_sha = "342d4542fda".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
data/lib/bundler/dsl.rb CHANGED
@@ -589,21 +589,21 @@ module Bundler
589
589
 
590
590
  trace_line = backtrace.find {|l| l.include?(dsl_path) } || trace_line
591
591
  return m unless trace_line
592
- line_numer = trace_line.split(":")[1].to_i - 1
593
- return m unless line_numer
592
+ line_number = trace_line.split(":")[1].to_i - 1
593
+ return m unless line_number
594
594
 
595
595
  lines = contents.lines.to_a
596
596
  indent = " # "
597
597
  indicator = indent.tr("#", ">")
598
- first_line = line_numer.zero?
599
- last_line = (line_numer == (lines.count - 1))
598
+ first_line = line_number.zero?
599
+ last_line = (line_number == (lines.count - 1))
600
600
 
601
601
  m << "\n"
602
602
  m << "#{indent}from #{trace_line.gsub(/:in.*$/, "")}\n"
603
603
  m << "#{indent}-------------------------------------------\n"
604
- m << "#{indent}#{lines[line_numer - 1]}" unless first_line
605
- m << "#{indicator}#{lines[line_numer]}"
606
- m << "#{indent}#{lines[line_numer + 1]}" unless last_line
604
+ m << "#{indent}#{lines[line_number - 1]}" unless first_line
605
+ m << "#{indicator}#{lines[line_number]}"
606
+ m << "#{indent}#{lines[line_number + 1]}" unless last_line
607
607
  m << "\n" unless m.end_with?("\n")
608
608
  m << "#{indent}-------------------------------------------\n"
609
609
  end
@@ -39,7 +39,11 @@ def gemfile(install = false, options = {}, &gemfile)
39
39
  Bundler.ui = ui
40
40
  raise ArgumentError, "Unknown options: #{opts.keys.join(", ")}" unless opts.empty?
41
41
 
42
- Bundler.with_unbundled_env do
42
+ old_gemfile = ENV["BUNDLE_GEMFILE"]
43
+
44
+ Bundler.unbundle_env!
45
+
46
+ begin
43
47
  Bundler.instance_variable_set(:@bundle_path, Pathname.new(Gem.dir))
44
48
  Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", "Gemfile"
45
49
 
@@ -80,9 +84,11 @@ def gemfile(install = false, options = {}, &gemfile)
80
84
 
81
85
  runtime.require
82
86
  end
83
- end
84
-
85
- if ENV["BUNDLE_GEMFILE"].nil?
86
- ENV["BUNDLE_GEMFILE"] = ""
87
+ ensure
88
+ if old_gemfile
89
+ ENV["BUNDLE_GEMFILE"] = old_gemfile
90
+ else
91
+ ENV["BUNDLE_GEMFILE"] = ""
92
+ end
87
93
  end
88
94
  end
@@ -221,7 +221,7 @@ module Bundler
221
221
 
222
222
  requested_path_gems = @definition.requested_specs.select {|s| s.source.is_a?(Source::Path) }
223
223
  path_plugin_files = requested_path_gems.map do |spec|
224
- Bundler.rubygems.spec_matches_for_glob(spec, "rubygems_plugin#{Bundler.rubygems.suffix_pattern}")
224
+ spec.matches_for_glob("rubygems_plugin#{Bundler.rubygems.suffix_pattern}")
225
225
  rescue TypeError
226
226
  error_message = "#{spec.name} #{spec.version} has an invalid gemspec"
227
227
  raise Gem::InvalidSpecificationException, error_message
@@ -131,7 +131,7 @@ module Bundler
131
131
  Bundler::Index.build do |index|
132
132
  files.each do |file|
133
133
  next unless spec = Bundler.load_gemspec(file)
134
- Bundler.rubygems.set_installed_by_version(spec)
134
+ spec.installed_by_version = Gem::VERSION
135
135
 
136
136
  spec.source = self
137
137
  Bundler.rubygems.validate(spec)
@@ -36,15 +36,14 @@ module Gem
36
36
  remove_method :open_file_with_flock if Gem.respond_to?(:open_file_with_flock)
37
37
 
38
38
  def open_file_with_flock(path, &block)
39
- mode = IO::RDONLY | IO::APPEND | IO::CREAT | IO::BINARY
39
+ # read-write mode is used rather than read-only in order to support NFS
40
+ mode = IO::RDWR | IO::APPEND | IO::CREAT | IO::BINARY
40
41
  mode |= IO::SHARE_DELETE if IO.const_defined?(:SHARE_DELETE)
41
42
 
42
43
  File.open(path, mode) do |io|
43
44
  begin
44
45
  io.flock(File::LOCK_EX)
45
46
  rescue Errno::ENOSYS, Errno::ENOTSUP
46
- rescue Errno::ENOLCK # NFS
47
- raise unless Thread.main == Thread.current
48
47
  end
49
48
  yield io
50
49
  end
@@ -267,6 +266,16 @@ module Gem
267
266
  end
268
267
  out
269
268
  end
269
+
270
+ if Gem.rubygems_version < Gem::Version.new("3.5.22")
271
+ module FilterIgnoredSpecs
272
+ def matching_specs(platform_only = false)
273
+ super.reject(&:ignored?)
274
+ end
275
+ end
276
+
277
+ prepend FilterIgnoredSpecs
278
+ end
270
279
  end
271
280
 
272
281
  # Requirements using lambda operator differentiate trailing zeros since rubygems 3.2.6
@@ -389,6 +398,15 @@ module Gem
389
398
  end
390
399
  end
391
400
  end
401
+
402
+ # Can be removed once RubyGems 3.5.22 support is dropped
403
+ unless new.respond_to?(:ignored?)
404
+ def ignored?
405
+ return @ignored unless @ignored.nil?
406
+
407
+ @ignored = missing_extensions?
408
+ end
409
+ end
392
410
  end
393
411
 
394
412
  require "rubygems/name_tuple"
@@ -57,28 +57,6 @@ module Bundler
57
57
  nil
58
58
  end
59
59
 
60
- def set_installed_by_version(spec, installed_by_version = Gem::VERSION)
61
- return unless spec.respond_to?(:installed_by_version=)
62
- spec.installed_by_version = Gem::Version.create(installed_by_version)
63
- end
64
-
65
- def spec_missing_extensions?(spec, default = true)
66
- return spec.missing_extensions? if spec.respond_to?(:missing_extensions?)
67
-
68
- return false if spec.default_gem?
69
- return false if spec.extensions.empty?
70
-
71
- default
72
- end
73
-
74
- def spec_matches_for_glob(spec, glob)
75
- return spec.matches_for_glob(glob) if spec.respond_to?(:matches_for_glob)
76
-
77
- spec.load_paths.flat_map do |lp|
78
- Dir["#{lp}/#{glob}#{suffix_pattern}"]
79
- end
80
- end
81
-
82
60
  def stub_set_spec(stub, spec)
83
61
  stub.instance_variable_set(:@spec, spec)
84
62
  end
@@ -84,8 +84,10 @@ module Bundler
84
84
  end
85
85
  end
86
86
 
87
- def not_a_bare_repository?
88
- git_local("rev-parse", "--is-bare-repository", dir: path).strip == "false"
87
+ def not_a_repository?
88
+ _, status = git_null("rev-parse", "--resolve-git-dir", path.to_s, dir: path)
89
+
90
+ !status.success?
89
91
  end
90
92
 
91
93
  def contains?(commit)
@@ -191,7 +191,7 @@ module Bundler
191
191
  set_up_app_cache!(app_cache_path) if use_app_cache?
192
192
 
193
193
  if requires_checkout? && !@copied
194
- FileUtils.rm_rf(app_cache_path) if use_app_cache? && git_proxy.not_a_bare_repository?
194
+ FileUtils.rm_rf(app_cache_path) if use_app_cache? && git_proxy.not_a_repository?
195
195
 
196
196
  fetch
197
197
  checkout
@@ -210,7 +210,7 @@ module Bundler
210
210
  checkout
211
211
  end
212
212
 
213
- generate_bin_options = { disable_extensions: !Bundler.rubygems.spec_missing_extensions?(spec), build_args: options[:build_args] }
213
+ generate_bin_options = { disable_extensions: !spec.missing_extensions?, build_args: options[:build_args] }
214
214
  generate_bin(spec, generate_bin_options)
215
215
 
216
216
  requires_checkout? ? spec.post_install_message : nil
@@ -299,7 +299,7 @@ module Bundler
299
299
  # The gemspecs we cache should already be evaluated.
300
300
  spec = Bundler.load_gemspec(spec_path)
301
301
  next unless spec
302
- Bundler.rubygems.set_installed_by_version(spec)
302
+ spec.installed_by_version = Gem::VERSION
303
303
  Bundler.rubygems.validate(spec)
304
304
  File.open(spec_path, "wb") {|file| file.write(spec.to_ruby) }
305
305
  end
@@ -53,6 +53,8 @@ module Bundler
53
53
  "source at `#{@path}`"
54
54
  end
55
55
 
56
+ alias_method :to_gemfile, :path
57
+
56
58
  def hash
57
59
  [self.class, expanded_path, version].hash
58
60
  end
@@ -148,7 +150,7 @@ module Bundler
148
150
 
149
151
  def load_gemspec(file)
150
152
  return unless spec = Bundler.load_gemspec(file)
151
- Bundler.rubygems.set_installed_by_version(spec)
153
+ spec.installed_by_version = Gem::VERSION
152
154
  spec
153
155
  end
154
156
 
@@ -357,10 +357,7 @@ module Bundler
357
357
  @installed_specs ||= Index.build do |idx|
358
358
  Bundler.rubygems.installed_specs.reverse_each do |spec|
359
359
  spec.source = self
360
- if Bundler.rubygems.spec_missing_extensions?(spec, false)
361
- Bundler.ui.debug "Source #{self} is ignoring #{spec} because it is missing extensions"
362
- next
363
- end
360
+ next if spec.ignored?
364
361
  idx << spec
365
362
  end
366
363
  end
@@ -28,6 +28,17 @@ module Bundler
28
28
 
29
29
  # @!group Stub Delegates
30
30
 
31
+ def ignored?
32
+ return @ignored unless @ignored.nil?
33
+
34
+ @ignored = missing_extensions?
35
+ return false unless @ignored
36
+
37
+ warn "Source #{source} is ignoring #{self} because it is missing extensions"
38
+
39
+ true
40
+ end
41
+
31
42
  def manually_installed?
32
43
  # This is for manually installed gems which are gems that were fixed in place after a
33
44
  # failed installation. Once the issue was resolved, the user then manually created
@@ -45,8 +56,8 @@ module Bundler
45
56
  true
46
57
  end
47
58
 
48
- def activated
49
- stub.activated
59
+ def activated?
60
+ stub.activated?
50
61
  end
51
62
 
52
63
  def activated=(activated)
@@ -68,6 +68,8 @@ autoload :OpenSSL, 'openssl'
68
68
  # #verify_callback :: For server certificate verification
69
69
  # #verify_depth :: Depth of certificate verification
70
70
  # #verify_mode :: How connections should be verified
71
+ # #verify_hostname :: Use hostname verification for server certificate
72
+ # during the handshake
71
73
  #
72
74
  # == Proxies
73
75
  #
@@ -174,7 +176,7 @@ class Gem::Net::HTTP::Persistent
174
176
  ##
175
177
  # The version of Gem::Net::HTTP::Persistent you are using
176
178
 
177
- VERSION = '4.0.2'
179
+ VERSION = '4.0.4'
178
180
 
179
181
  ##
180
182
  # Error class for errors raised by Gem::Net::HTTP::Persistent. Various
@@ -449,6 +451,21 @@ class Gem::Net::HTTP::Persistent
449
451
 
450
452
  attr_reader :verify_mode
451
453
 
454
+ ##
455
+ # HTTPS verify_hostname.
456
+ #
457
+ # If a client sets this to true and enables SNI with SSLSocket#hostname=,
458
+ # the hostname verification on the server certificate is performed
459
+ # automatically during the handshake using
460
+ # OpenSSL::SSL.verify_certificate_identity().
461
+ #
462
+ # You can set +verify_hostname+ as true to use hostname verification
463
+ # during the handshake.
464
+ #
465
+ # NOTE: This works with Ruby > 3.0.
466
+
467
+ attr_reader :verify_hostname
468
+
452
469
  ##
453
470
  # Creates a new Gem::Net::HTTP::Persistent.
454
471
  #
@@ -508,6 +525,7 @@ class Gem::Net::HTTP::Persistent
508
525
  @verify_callback = nil
509
526
  @verify_depth = nil
510
527
  @verify_mode = nil
528
+ @verify_hostname = nil
511
529
  @cert_store = nil
512
530
 
513
531
  @generation = 0 # incremented when proxy Gem::URI changes
@@ -607,13 +625,23 @@ class Gem::Net::HTTP::Persistent
607
625
 
608
626
  return yield connection
609
627
  rescue Errno::ECONNREFUSED
610
- address = http.proxy_address || http.address
611
- port = http.proxy_port || http.port
628
+ if http.proxy?
629
+ address = http.proxy_address
630
+ port = http.proxy_port
631
+ else
632
+ address = http.address
633
+ port = http.port
634
+ end
612
635
 
613
636
  raise Error, "connection refused: #{address}:#{port}"
614
637
  rescue Errno::EHOSTDOWN
615
- address = http.proxy_address || http.address
616
- port = http.proxy_port || http.port
638
+ if http.proxy?
639
+ address = http.proxy_address
640
+ port = http.proxy_port
641
+ else
642
+ address = http.address
643
+ port = http.port
644
+ end
617
645
 
618
646
  raise Error, "host down: #{address}:#{port}"
619
647
  ensure
@@ -948,8 +976,10 @@ class Gem::Net::HTTP::Persistent
948
976
  connection.min_version = @min_version if @min_version
949
977
  connection.max_version = @max_version if @max_version
950
978
 
951
- connection.verify_depth = @verify_depth
952
- connection.verify_mode = @verify_mode
979
+ connection.verify_depth = @verify_depth
980
+ connection.verify_mode = @verify_mode
981
+ connection.verify_hostname = @verify_hostname if
982
+ @verify_hostname != nil && connection.respond_to?(:verify_hostname=)
953
983
 
954
984
  if OpenSSL::SSL::VERIFY_PEER == OpenSSL::SSL::VERIFY_NONE and
955
985
  not Object.const_defined?(:I_KNOW_THAT_OPENSSL_VERIFY_PEER_EQUALS_VERIFY_NONE_IS_WRONG) then
@@ -1058,6 +1088,15 @@ application:
1058
1088
  reconnect_ssl
1059
1089
  end
1060
1090
 
1091
+ ##
1092
+ # Sets the HTTPS verify_hostname.
1093
+
1094
+ def verify_hostname= verify_hostname
1095
+ @verify_hostname = verify_hostname
1096
+
1097
+ reconnect_ssl
1098
+ end
1099
+
1061
1100
  ##
1062
1101
  # SSL verification callback.
1063
1102
 
@@ -1070,4 +1109,3 @@ end
1070
1109
 
1071
1110
  require_relative 'persistent/connection'
1072
1111
  require_relative 'persistent/pool'
1073
-
@@ -19,6 +19,8 @@ module Bundler::URI
19
19
  Parser = RFC2396_Parser
20
20
  RFC3986_PARSER = RFC3986_Parser.new
21
21
  Ractor.make_shareable(RFC3986_PARSER) if defined?(Ractor)
22
+ RFC2396_PARSER = RFC2396_Parser.new
23
+ Ractor.make_shareable(RFC2396_PARSER) if defined?(Ractor)
22
24
 
23
25
  # Bundler::URI::Parser.new
24
26
  DEFAULT_PARSER = Parser.new
@@ -1,6 +1,6 @@
1
1
  module Bundler::URI
2
2
  # :stopdoc:
3
- VERSION_CODE = '001300'.freeze
3
+ VERSION_CODE = '001301'.freeze
4
4
  VERSION = VERSION_CODE.scan(/../).collect{|n| n.to_i}.join('.').freeze
5
5
  # :startdoc:
6
6
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "2.5.20".freeze
4
+ VERSION = "2.5.22".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= VERSION.split(".").first.to_i
data/lib/bundler.rb CHANGED
@@ -383,28 +383,12 @@ module Bundler
383
383
 
384
384
  # @return [Hash] Environment with all bundler-related variables removed
385
385
  def unbundled_env
386
- env = original_env
387
-
388
- if env.key?("BUNDLER_ORIG_MANPATH")
389
- env["MANPATH"] = env["BUNDLER_ORIG_MANPATH"]
390
- end
391
-
392
- env.delete_if {|k, _| k[0, 7] == "BUNDLE_" }
393
-
394
- if env.key?("RUBYOPT")
395
- rubyopt = env["RUBYOPT"].split(" ")
396
- rubyopt.delete("-r#{File.expand_path("bundler/setup", __dir__)}")
397
- rubyopt.delete("-rbundler/setup")
398
- env["RUBYOPT"] = rubyopt.join(" ")
399
- end
400
-
401
- if env.key?("RUBYLIB")
402
- rubylib = env["RUBYLIB"].split(File::PATH_SEPARATOR)
403
- rubylib.delete(__dir__)
404
- env["RUBYLIB"] = rubylib.join(File::PATH_SEPARATOR)
405
- end
386
+ unbundle_env(original_env)
387
+ end
406
388
 
407
- env
389
+ # Remove all bundler-related variables from ENV
390
+ def unbundle_env!
391
+ ENV.replace(unbundle_env(ENV))
408
392
  end
409
393
 
410
394
  # Run block with environment present before Bundler was activated
@@ -633,6 +617,30 @@ module Bundler
633
617
 
634
618
  private
635
619
 
620
+ def unbundle_env(env)
621
+ if env.key?("BUNDLER_ORIG_MANPATH")
622
+ env["MANPATH"] = env["BUNDLER_ORIG_MANPATH"]
623
+ end
624
+
625
+ env.delete_if {|k, _| k[0, 7] == "BUNDLE_" }
626
+ env.delete("BUNDLER_SETUP")
627
+
628
+ if env.key?("RUBYOPT")
629
+ rubyopt = env["RUBYOPT"].split(" ")
630
+ rubyopt.delete("-r#{File.expand_path("bundler/setup", __dir__)}")
631
+ rubyopt.delete("-rbundler/setup")
632
+ env["RUBYOPT"] = rubyopt.join(" ")
633
+ end
634
+
635
+ if env.key?("RUBYLIB")
636
+ rubylib = env["RUBYLIB"].split(File::PATH_SEPARATOR)
637
+ rubylib.delete(__dir__)
638
+ env["RUBYLIB"] = rubylib.join(File::PATH_SEPARATOR)
639
+ end
640
+
641
+ env
642
+ end
643
+
636
644
  def load_marshal(data, marshal_proc: nil)
637
645
  Marshal.load(data, marshal_proc)
638
646
  rescue TypeError => e
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.20
4
+ version: 2.5.22
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-09-24 00:00:00.000000000 Z
25
+ date: 2024-10-16 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
@@ -405,7 +405,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
405
405
  - !ruby/object:Gem::Version
406
406
  version: 3.2.3
407
407
  requirements: []
408
- rubygems_version: 3.5.20
408
+ rubygems_version: 3.5.22
409
409
  signing_key:
410
410
  specification_version: 4
411
411
  summary: The best way to manage your application's dependencies