bundler 2.5.5 → 2.5.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +171 -0
  3. data/lib/bundler/build_metadata.rb +2 -2
  4. data/lib/bundler/cli/binstubs.rb +1 -1
  5. data/lib/bundler/cli/fund.rb +1 -1
  6. data/lib/bundler/cli/gem.rb +8 -15
  7. data/lib/bundler/cli/install.rb +1 -1
  8. data/lib/bundler/cli/lock.rb +5 -4
  9. data/lib/bundler/cli/plugin.rb +3 -2
  10. data/lib/bundler/cli.rb +14 -31
  11. data/lib/bundler/compact_index_client/cache.rb +47 -72
  12. data/lib/bundler/compact_index_client/parser.rb +84 -0
  13. data/lib/bundler/compact_index_client.rb +51 -80
  14. data/lib/bundler/constants.rb +8 -1
  15. data/lib/bundler/definition.rb +168 -99
  16. data/lib/bundler/dependency.rb +2 -1
  17. data/lib/bundler/dsl.rb +16 -1
  18. data/lib/bundler/endpoint_specification.rb +11 -0
  19. data/lib/bundler/env.rb +1 -1
  20. data/lib/bundler/environment_preserver.rb +5 -23
  21. data/lib/bundler/errors.rb +14 -0
  22. data/lib/bundler/fetcher/compact_index.rb +15 -24
  23. data/lib/bundler/fetcher/downloader.rb +1 -1
  24. data/lib/bundler/fetcher.rb +2 -2
  25. data/lib/bundler/gem_helper.rb +1 -1
  26. data/lib/bundler/gem_helpers.rb +14 -7
  27. data/lib/bundler/gem_version_promoter.rb +42 -38
  28. data/lib/bundler/injector.rb +4 -6
  29. data/lib/bundler/installer/gem_installer.rb +0 -1
  30. data/lib/bundler/installer/standalone.rb +0 -3
  31. data/lib/bundler/installer.rb +11 -13
  32. data/lib/bundler/lazy_specification.rb +1 -0
  33. data/lib/bundler/man/bundle-add.1 +1 -1
  34. data/lib/bundler/man/bundle-binstubs.1 +1 -1
  35. data/lib/bundler/man/bundle-cache.1 +1 -1
  36. data/lib/bundler/man/bundle-check.1 +3 -1
  37. data/lib/bundler/man/bundle-check.1.ronn +3 -0
  38. data/lib/bundler/man/bundle-clean.1 +1 -1
  39. data/lib/bundler/man/bundle-config.1 +2 -4
  40. data/lib/bundler/man/bundle-config.1.ronn +1 -4
  41. data/lib/bundler/man/bundle-console.1 +1 -1
  42. data/lib/bundler/man/bundle-doctor.1 +1 -1
  43. data/lib/bundler/man/bundle-exec.1 +1 -1
  44. data/lib/bundler/man/bundle-gem.1 +7 -1
  45. data/lib/bundler/man/bundle-gem.1.ronn +11 -0
  46. data/lib/bundler/man/bundle-help.1 +1 -1
  47. data/lib/bundler/man/bundle-info.1 +1 -1
  48. data/lib/bundler/man/bundle-init.1 +1 -1
  49. data/lib/bundler/man/bundle-inject.1 +1 -1
  50. data/lib/bundler/man/bundle-install.1 +3 -3
  51. data/lib/bundler/man/bundle-install.1.ronn +2 -2
  52. data/lib/bundler/man/bundle-list.1 +1 -1
  53. data/lib/bundler/man/bundle-lock.1 +1 -1
  54. data/lib/bundler/man/bundle-open.1 +1 -1
  55. data/lib/bundler/man/bundle-outdated.1 +1 -1
  56. data/lib/bundler/man/bundle-platform.1 +1 -1
  57. data/lib/bundler/man/bundle-plugin.1 +7 -4
  58. data/lib/bundler/man/bundle-plugin.1.ronn +7 -3
  59. data/lib/bundler/man/bundle-pristine.1 +1 -1
  60. data/lib/bundler/man/bundle-remove.1 +1 -1
  61. data/lib/bundler/man/bundle-show.1 +1 -1
  62. data/lib/bundler/man/bundle-update.1 +1 -1
  63. data/lib/bundler/man/bundle-version.1 +1 -1
  64. data/lib/bundler/man/bundle-viz.1 +1 -1
  65. data/lib/bundler/man/bundle.1 +1 -1
  66. data/lib/bundler/man/gemfile.5 +3 -3
  67. data/lib/bundler/man/gemfile.5.ronn +2 -2
  68. data/lib/bundler/mirror.rb +3 -3
  69. data/lib/bundler/plugin/api/source.rb +2 -2
  70. data/lib/bundler/plugin/installer/path.rb +18 -0
  71. data/lib/bundler/plugin/installer.rb +36 -16
  72. data/lib/bundler/plugin/source_list.rb +4 -4
  73. data/lib/bundler/resolver/base.rb +4 -0
  74. data/lib/bundler/resolver/candidate.rb +5 -17
  75. data/lib/bundler/resolver/package.rb +4 -0
  76. data/lib/bundler/resolver/spec_group.rb +20 -2
  77. data/lib/bundler/resolver.rb +72 -33
  78. data/lib/bundler/rubygems_ext.rb +98 -10
  79. data/lib/bundler/rubygems_gem_installer.rb +35 -2
  80. data/lib/bundler/rubygems_integration.rb +16 -2
  81. data/lib/bundler/runtime.rb +2 -2
  82. data/lib/bundler/self_manager.rb +22 -2
  83. data/lib/bundler/settings.rb +26 -20
  84. data/lib/bundler/setup.rb +6 -0
  85. data/lib/bundler/shared_helpers.rb +6 -4
  86. data/lib/bundler/source/git/git_proxy.rb +9 -1
  87. data/lib/bundler/source/git.rb +15 -1
  88. data/lib/bundler/source/metadata.rb +2 -0
  89. data/lib/bundler/source/path.rb +0 -13
  90. data/lib/bundler/source/rubygems/remote.rb +1 -1
  91. data/lib/bundler/source/rubygems.rb +33 -32
  92. data/lib/bundler/source_list.rb +26 -2
  93. data/lib/bundler/spec_set.rb +15 -13
  94. data/lib/bundler/stub_specification.rb +8 -0
  95. data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +77 -29
  96. data/lib/bundler/templates/newgem/newgem.gemspec.tt +4 -3
  97. data/lib/bundler/templates/newgem/rubocop.yml.tt +0 -5
  98. data/lib/bundler/uri_credentials_filter.rb +2 -2
  99. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +22 -22
  100. data/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +1 -0
  101. data/lib/bundler/vendored_net_http.rb +20 -5
  102. data/lib/bundler/vendored_timeout.rb +7 -3
  103. data/lib/bundler/vendored_uri.rb +18 -1
  104. data/lib/bundler/version.rb +1 -1
  105. data/lib/bundler/yaml_serializer.rb +11 -6
  106. data/lib/bundler.rb +29 -3
  107. metadata +5 -3
@@ -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,5 @@
1
1
  require_relative 'package'
2
+ require_relative 'rubygems'
2
3
  require_relative 'version_constraint'
3
4
  require_relative 'incompatibility'
4
5
  require_relative 'basic_package_source'
@@ -1,8 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- begin
4
- require "rubygems/net/http"
5
- rescue LoadError
6
- require "net/http"
7
- Gem::Net = Net
3
+ # This defined? guard can be removed once RubyGems 3.4 support is dropped.
4
+ #
5
+ # Bundler specs load this code from `spec/support/vendored_net_http.rb` to avoid
6
+ # activating the Bundler gem too early. Without this guard, we get redefinition
7
+ # warnings once Bundler is actually activated and
8
+ # `lib/bundler/vendored_net_http.rb` is required. This is not an issue in
9
+ # RubyGems versions including `rubygems/vendored_net_http` since `require` takes
10
+ # care of avoiding the double load.
11
+ #
12
+ unless defined?(Gem::Net)
13
+ begin
14
+ require "rubygems/vendored_net_http"
15
+ rescue LoadError
16
+ begin
17
+ require "rubygems/net/http"
18
+ rescue LoadError
19
+ require "net/http"
20
+ Gem::Net = Net
21
+ end
22
+ end
8
23
  end
@@ -1,8 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  begin
4
- require "rubygems/timeout"
4
+ require "rubygems/vendored_timeout"
5
5
  rescue LoadError
6
- require "timeout"
7
- Gem::Timeout = Timeout
6
+ begin
7
+ require "rubygems/timeout"
8
+ rescue LoadError
9
+ require "timeout"
10
+ Gem::Timeout = Timeout
11
+ end
8
12
  end
@@ -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.16".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= VERSION.split(".").first.to_i
@@ -58,7 +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
- convert_to_backward_compatible_key!(key)
61
+ val = strip_comment(val)
62
+
62
63
  depth = indent.size / 2
63
64
  if quote.empty? && val.empty?
64
65
  new_hash = {}
@@ -72,6 +73,8 @@ module Bundler
72
73
  end
73
74
  elsif match = ARRAY_REGEX.match(line)
74
75
  _, val = match.captures
76
+ val = strip_comment(val)
77
+
75
78
  last_hash[last_empty_key] = [] unless last_hash[last_empty_key].is_a?(Array)
76
79
 
77
80
  last_hash[last_empty_key].push(val)
@@ -80,14 +83,16 @@ module Bundler
80
83
  res
81
84
  end
82
85
 
83
- # for settings' keys
84
- def convert_to_backward_compatible_key!(key)
85
- key << "/" if /https?:/i.match?(key) && !%r{/\Z}.match?(key)
86
- key.gsub!(".", "__")
86
+ def strip_comment(val)
87
+ if val.include?("#") && !val.start_with?("#")
88
+ val.split("#", 2).first.strip
89
+ else
90
+ val
91
+ end
87
92
  end
88
93
 
89
94
  class << self
90
- private :dump_hash, :convert_to_backward_compatible_key!
95
+ private :dump_hash
91
96
  end
92
97
  end
93
98
  end
data/lib/bundler.rb CHANGED
@@ -40,7 +40,9 @@ module Bundler
40
40
  SUDO_MUTEX = Thread::Mutex.new
41
41
 
42
42
  autoload :Checksum, File.expand_path("bundler/checksum", __dir__)
43
+ autoload :CLI, File.expand_path("bundler/cli", __dir__)
43
44
  autoload :CIDetector, File.expand_path("bundler/ci_detector", __dir__)
45
+ autoload :CompactIndexClient, File.expand_path("bundler/compact_index_client", __dir__)
44
46
  autoload :Definition, File.expand_path("bundler/definition", __dir__)
45
47
  autoload :Dependency, File.expand_path("bundler/dependency", __dir__)
46
48
  autoload :Deprecate, File.expand_path("bundler/deprecate", __dir__)
@@ -165,6 +167,29 @@ module Bundler
165
167
  end
166
168
  end
167
169
 
170
+ def auto_switch
171
+ self_manager.restart_with_locked_bundler_if_needed
172
+ end
173
+
174
+ # Automatically install dependencies if Bundler.settings[:auto_install] exists.
175
+ # This is set through config cmd `bundle config set --global auto_install 1`.
176
+ #
177
+ # Note that this method `nil`s out the global Definition object, so it
178
+ # should be called first, before you instantiate anything like an
179
+ # `Installer` that'll keep a reference to the old one instead.
180
+ def auto_install
181
+ return unless settings[:auto_install]
182
+
183
+ begin
184
+ definition.specs
185
+ rescue GemNotFound, GitError
186
+ ui.info "Automatically installing missing gems."
187
+ reset!
188
+ CLI::Install.new({}).run
189
+ reset!
190
+ end
191
+ end
192
+
168
193
  # Setups Bundler environment (see Bundler.setup) if it is not already set,
169
194
  # and loads all gems from groups specified. Unlike ::setup, can be called
170
195
  # multiple times with different groups (if they were allowed by setup).
@@ -200,12 +225,13 @@ module Bundler
200
225
  #
201
226
  # @param unlock [Hash, Boolean, nil] Gems that have been requested
202
227
  # to be updated or true if all gems should be updated
228
+ # @param lockfile [Pathname] Path to Gemfile.lock
203
229
  # @return [Bundler::Definition]
204
- def definition(unlock = nil)
230
+ def definition(unlock = nil, lockfile = default_lockfile)
205
231
  @definition = nil if unlock
206
232
  @definition ||= begin
207
233
  configure
208
- Definition.build(default_gemfile, default_lockfile, unlock)
234
+ Definition.build(default_gemfile, lockfile, unlock)
209
235
  end
210
236
  end
211
237
 
@@ -335,7 +361,7 @@ module Bundler
335
361
  def settings
336
362
  @settings ||= Settings.new(app_config_path)
337
363
  rescue GemfileNotFound
338
- @settings = Settings.new(Pathname.new(".bundle").expand_path)
364
+ @settings = Settings.new
339
365
  end
340
366
 
341
367
  # @return [Hash] Environment present before Bundler was activated
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.16
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-07-18 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
@@ -79,6 +79,7 @@ files:
79
79
  - lib/bundler/compact_index_client/cache.rb
80
80
  - lib/bundler/compact_index_client/cache_file.rb
81
81
  - lib/bundler/compact_index_client/gem_parser.rb
82
+ - lib/bundler/compact_index_client/parser.rb
82
83
  - lib/bundler/compact_index_client/updater.rb
83
84
  - lib/bundler/constants.rb
84
85
  - lib/bundler/current_ruby.rb
@@ -189,6 +190,7 @@ files:
189
190
  - lib/bundler/plugin/index.rb
190
191
  - lib/bundler/plugin/installer.rb
191
192
  - lib/bundler/plugin/installer/git.rb
193
+ - lib/bundler/plugin/installer/path.rb
192
194
  - lib/bundler/plugin/installer/rubygems.rb
193
195
  - lib/bundler/plugin/source_list.rb
194
196
  - lib/bundler/process_lock.rb
@@ -398,7 +400,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
398
400
  - !ruby/object:Gem::Version
399
401
  version: 3.2.3
400
402
  requirements: []
401
- rubygems_version: 3.5.5
403
+ rubygems_version: 3.5.16
402
404
  signing_key:
403
405
  specification_version: 4
404
406
  summary: The best way to manage your application's dependencies