rubygems-update 3.6.8 → 3.7.0

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 (151) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +874 -787
  3. data/CONTRIBUTING.md +9 -0
  4. data/Manifest.txt +6 -22
  5. data/README.md +1 -1
  6. data/SECURITY.md +7 -0
  7. data/bundler/CHANGELOG.md +1103 -1030
  8. data/bundler/README.md +7 -7
  9. data/bundler/bundler.gemspec +2 -2
  10. data/bundler/lib/bundler/build_metadata.rb +10 -11
  11. data/bundler/lib/bundler/cli/common.rb +1 -1
  12. data/bundler/lib/bundler/cli/config.rb +2 -2
  13. data/bundler/lib/bundler/cli/doctor/diagnose.rb +167 -0
  14. data/bundler/lib/bundler/cli/doctor/ssl.rb +249 -0
  15. data/bundler/lib/bundler/cli/doctor.rb +27 -155
  16. data/bundler/lib/bundler/cli/gem.rb +62 -30
  17. data/bundler/lib/bundler/cli/install.rb +4 -4
  18. data/bundler/lib/bundler/cli/issue.rb +2 -2
  19. data/bundler/lib/bundler/cli/outdated.rb +1 -1
  20. data/bundler/lib/bundler/cli/update.rb +2 -2
  21. data/bundler/lib/bundler/cli.rb +12 -25
  22. data/bundler/lib/bundler/compact_index_client.rb +1 -5
  23. data/bundler/lib/bundler/current_ruby.rb +27 -3
  24. data/bundler/lib/bundler/definition.rb +55 -58
  25. data/bundler/lib/bundler/dependency.rb +1 -1
  26. data/bundler/lib/bundler/dsl.rb +33 -23
  27. data/bundler/lib/bundler/feature_flag.rb +15 -12
  28. data/bundler/lib/bundler/fetcher/dependency.rb +2 -1
  29. data/bundler/lib/bundler/fetcher/downloader.rb +33 -7
  30. data/bundler/lib/bundler/fetcher.rb +49 -19
  31. data/bundler/lib/bundler/friendly_errors.rb +2 -1
  32. data/bundler/lib/bundler/index.rb +7 -2
  33. data/bundler/lib/bundler/installer.rb +5 -4
  34. data/bundler/lib/bundler/lazy_specification.rb +29 -18
  35. data/bundler/lib/bundler/lockfile_parser.rb +21 -5
  36. data/bundler/lib/bundler/man/bundle-add.1 +1 -1
  37. data/bundler/lib/bundler/man/bundle-binstubs.1 +1 -1
  38. data/bundler/lib/bundler/man/bundle-cache.1 +1 -1
  39. data/bundler/lib/bundler/man/bundle-check.1 +1 -1
  40. data/bundler/lib/bundler/man/bundle-clean.1 +1 -1
  41. data/bundler/lib/bundler/man/bundle-config.1 +172 -126
  42. data/bundler/lib/bundler/man/bundle-config.1.ronn +91 -91
  43. data/bundler/lib/bundler/man/bundle-console.1 +1 -1
  44. data/bundler/lib/bundler/man/bundle-doctor.1 +43 -4
  45. data/bundler/lib/bundler/man/bundle-doctor.1.ronn +48 -4
  46. data/bundler/lib/bundler/man/bundle-env.1 +1 -1
  47. data/bundler/lib/bundler/man/bundle-exec.1 +1 -1
  48. data/bundler/lib/bundler/man/bundle-fund.1 +1 -1
  49. data/bundler/lib/bundler/man/bundle-gem.1 +67 -44
  50. data/bundler/lib/bundler/man/bundle-gem.1.ronn +8 -4
  51. data/bundler/lib/bundler/man/bundle-help.1 +1 -1
  52. data/bundler/lib/bundler/man/bundle-info.1 +1 -1
  53. data/bundler/lib/bundler/man/bundle-init.1 +1 -1
  54. data/bundler/lib/bundler/man/bundle-inject.1 +2 -2
  55. data/bundler/lib/bundler/man/bundle-inject.1.ronn +1 -1
  56. data/bundler/lib/bundler/man/bundle-install.1 +1 -1
  57. data/bundler/lib/bundler/man/bundle-issue.1 +1 -1
  58. data/bundler/lib/bundler/man/bundle-licenses.1 +1 -1
  59. data/bundler/lib/bundler/man/bundle-list.1 +1 -1
  60. data/bundler/lib/bundler/man/bundle-lock.1 +1 -1
  61. data/bundler/lib/bundler/man/bundle-open.1 +1 -1
  62. data/bundler/lib/bundler/man/bundle-outdated.1 +1 -1
  63. data/bundler/lib/bundler/man/bundle-platform.1 +1 -1
  64. data/bundler/lib/bundler/man/bundle-plugin.1 +1 -1
  65. data/bundler/lib/bundler/man/bundle-pristine.1 +1 -1
  66. data/bundler/lib/bundler/man/bundle-remove.1 +1 -1
  67. data/bundler/lib/bundler/man/bundle-show.1 +1 -1
  68. data/bundler/lib/bundler/man/bundle-update.1 +1 -1
  69. data/bundler/lib/bundler/man/bundle-version.1 +1 -1
  70. data/bundler/lib/bundler/man/bundle-viz.1 +1 -1
  71. data/bundler/lib/bundler/man/bundle.1 +1 -1
  72. data/bundler/lib/bundler/man/gemfile.5 +1 -1
  73. data/bundler/lib/bundler/match_platform.rb +31 -12
  74. data/bundler/lib/bundler/materialization.rb +2 -2
  75. data/bundler/lib/bundler/resolver/package.rb +1 -1
  76. data/bundler/lib/bundler/resolver.rb +11 -9
  77. data/bundler/lib/bundler/rubygems_ext.rb +116 -120
  78. data/bundler/lib/bundler/rubygems_integration.rb +11 -6
  79. data/bundler/lib/bundler/runtime.rb +1 -1
  80. data/bundler/lib/bundler/self_manager.rb +32 -42
  81. data/bundler/lib/bundler/settings/validator.rb +0 -23
  82. data/bundler/lib/bundler/settings.rb +4 -6
  83. data/bundler/lib/bundler/shared_helpers.rb +6 -4
  84. data/bundler/lib/bundler/source/git/git_proxy.rb +3 -3
  85. data/bundler/lib/bundler/source/path.rb +7 -0
  86. data/bundler/lib/bundler/source_list.rb +1 -5
  87. data/bundler/lib/bundler/source_map.rb +1 -1
  88. data/bundler/lib/bundler/spec_set.rb +28 -6
  89. data/bundler/lib/bundler/templates/Executable +0 -11
  90. data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +2 -0
  91. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +6 -5
  92. data/bundler/lib/bundler/ui/shell.rb +2 -2
  93. data/bundler/lib/bundler/vendor/net-http-persistent/README.rdoc +1 -1
  94. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +2 -1
  95. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +81 -42
  96. data/bundler/lib/bundler/version.rb +10 -2
  97. data/bundler/lib/bundler/worker.rb +1 -1
  98. data/bundler/lib/bundler.rb +14 -12
  99. data/doc/bundler/UPGRADING.md +137 -127
  100. data/doc/rubygems/CONTRIBUTING.md +1 -1
  101. data/lib/rubygems/basic_specification.rb +7 -0
  102. data/lib/rubygems/commands/pristine_command.rb +9 -12
  103. data/lib/rubygems/commands/push_command.rb +2 -1
  104. data/lib/rubygems/commands/setup_command.rb +2 -2
  105. data/lib/rubygems/core_ext/kernel_require.rb +5 -2
  106. data/lib/rubygems/ext/builder.rb +15 -4
  107. data/lib/rubygems/ext/cargo_builder.rb +7 -5
  108. data/lib/rubygems/ext/rake_builder.rb +1 -3
  109. data/lib/rubygems/gemcutter_utilities/webauthn_listener.rb +10 -3
  110. data/lib/rubygems/gemcutter_utilities.rb +5 -2
  111. data/lib/rubygems/installer.rb +45 -50
  112. data/lib/rubygems/package/tar_writer.rb +5 -4
  113. data/lib/rubygems/platform.rb +142 -39
  114. data/lib/rubygems/remote_fetcher.rb +3 -3
  115. data/lib/rubygems/request_set.rb +3 -6
  116. data/lib/rubygems/resolver/best_set.rb +1 -1
  117. data/lib/rubygems/resolver/source_set.rb +1 -1
  118. data/lib/rubygems/resolver.rb +1 -1
  119. data/lib/rubygems/s3_uri_signer.rb +5 -3
  120. data/lib/rubygems/source.rb +28 -22
  121. data/lib/rubygems/specification.rb +2 -2
  122. data/lib/rubygems/uri_formatter.rb +2 -1
  123. data/lib/rubygems/util/licenses.rb +21 -0
  124. data/lib/rubygems/vendor/net-http/lib/net/http.rb +14 -19
  125. data/lib/rubygems/vendor/resolv/lib/resolv.rb +50 -22
  126. data/lib/rubygems.rb +65 -7
  127. data/rubygems-update.gemspec +2 -2
  128. data/setup.rb +1 -1
  129. metadata +9 -25
  130. data/bundler/lib/bundler/gem_helpers.rb +0 -144
  131. data/bundler/lib/bundler/templates/Executable.bundler +0 -109
  132. data/bundler/lib/bundler/vendor/fileutils/.document +0 -1
  133. data/bundler/lib/bundler/vendor/net-http-persistent/.document +0 -1
  134. data/bundler/lib/bundler/vendor/pub_grub/.document +0 -1
  135. data/bundler/lib/bundler/vendor/securerandom/.document +0 -1
  136. data/bundler/lib/bundler/vendor/thor/.document +0 -1
  137. data/bundler/lib/bundler/vendor/tsort/.document +0 -1
  138. data/bundler/lib/bundler/vendor/uri/.document +0 -1
  139. data/lib/rubygems/shellwords.rb +0 -3
  140. data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA.pem +0 -21
  141. data/lib/rubygems/vendor/molinillo/.document +0 -1
  142. data/lib/rubygems/vendor/net-http/.document +0 -1
  143. data/lib/rubygems/vendor/net-protocol/.document +0 -1
  144. data/lib/rubygems/vendor/optparse/.document +0 -1
  145. data/lib/rubygems/vendor/resolv/.document +0 -1
  146. data/lib/rubygems/vendor/securerandom/.document +0 -1
  147. data/lib/rubygems/vendor/timeout/.document +0 -1
  148. data/lib/rubygems/vendor/tsort/.document +0 -1
  149. data/lib/rubygems/vendor/uri/.document +0 -1
  150. /data/lib/rubygems/ssl_certs/rubygems.org/{GlobalSignRootCA_R3.pem → GlobalSign.pem} +0 -0
  151. /data/{bundler/lib/bundler/vendor/connection_pool → lib/rubygems/vendor}/.document +0 -0
@@ -1,6 +1,7 @@
1
1
  require_relative '../../../../../vendored_net_http'
2
2
  require_relative '../../../../../vendored_uri'
3
- require 'cgi' # for escaping
3
+ require 'cgi/escape'
4
+ require 'cgi/util' unless defined?(CGI::EscapeExt)
4
5
  require_relative '../../../../connection_pool/lib/connection_pool'
5
6
 
6
7
  autoload :OpenSSL, 'openssl'
@@ -42,9 +43,8 @@ autoload :OpenSSL, 'openssl'
42
43
  # # perform the POST, the Gem::URI is always required
43
44
  # response http.request post_uri, post
44
45
  #
45
- # Note that for GET, HEAD and other requests that do not have a body you want
46
- # to use Gem::URI#request_uri not Gem::URI#path. The request_uri contains the query
47
- # params which are sent in the body for other requests.
46
+ # Note that for GET, HEAD and other requests that do not have a body,
47
+ # it uses Gem::URI#request_uri as default to send query params
48
48
  #
49
49
  # == TLS/SSL
50
50
  #
@@ -60,6 +60,7 @@ autoload :OpenSSL, 'openssl'
60
60
  # #ca_path :: Directory with certificate-authorities
61
61
  # #cert_store :: An SSL certificate store
62
62
  # #ciphers :: List of SSl ciphers allowed
63
+ # #extra_chain_cert :: Extra certificates to be added to the certificate chain
63
64
  # #private_key :: The client's SSL private key
64
65
  # #reuse_ssl_sessions :: Reuse a previously opened SSL session for a new
65
66
  # connection
@@ -176,7 +177,7 @@ class Gem::Net::HTTP::Persistent
176
177
  ##
177
178
  # The version of Gem::Net::HTTP::Persistent you are using
178
179
 
179
- VERSION = '4.0.4'
180
+ VERSION = '4.0.6'
180
181
 
181
182
  ##
182
183
  # Error class for errors raised by Gem::Net::HTTP::Persistent. Various
@@ -267,6 +268,11 @@ class Gem::Net::HTTP::Persistent
267
268
 
268
269
  attr_reader :ciphers
269
270
 
271
+ ##
272
+ # Extra certificates to be added to the certificate chain
273
+
274
+ attr_reader :extra_chain_cert
275
+
270
276
  ##
271
277
  # Sends debug_output to this IO via Gem::Net::HTTP#set_debug_output.
272
278
  #
@@ -587,6 +593,21 @@ class Gem::Net::HTTP::Persistent
587
593
  reconnect_ssl
588
594
  end
589
595
 
596
+ if Gem::Net::HTTP.method_defined?(:extra_chain_cert=)
597
+ ##
598
+ # Extra certificates to be added to the certificate chain.
599
+ # It is only supported starting from Gem::Net::HTTP version 0.1.1
600
+ def extra_chain_cert= extra_chain_cert
601
+ @extra_chain_cert = extra_chain_cert
602
+
603
+ reconnect_ssl
604
+ end
605
+ else
606
+ def extra_chain_cert= _extra_chain_cert
607
+ raise "extra_chain_cert= is not supported by this version of Gem::Net::HTTP"
608
+ end
609
+ end
610
+
590
611
  ##
591
612
  # Creates a new connection for +uri+
592
613
 
@@ -605,47 +626,49 @@ class Gem::Net::HTTP::Persistent
605
626
 
606
627
  connection = @pool.checkout net_http_args
607
628
 
608
- http = connection.http
629
+ begin
630
+ http = connection.http
609
631
 
610
- connection.ressl @ssl_generation if
611
- connection.ssl_generation != @ssl_generation
632
+ connection.ressl @ssl_generation if
633
+ connection.ssl_generation != @ssl_generation
612
634
 
613
- if not http.started? then
614
- ssl http if use_ssl
615
- start http
616
- elsif expired? connection then
617
- reset connection
618
- end
635
+ if not http.started? then
636
+ ssl http if use_ssl
637
+ start http
638
+ elsif expired? connection then
639
+ reset connection
640
+ end
619
641
 
620
- http.keep_alive_timeout = @idle_timeout if @idle_timeout
621
- http.max_retries = @max_retries if http.respond_to?(:max_retries=)
622
- http.read_timeout = @read_timeout if @read_timeout
623
- http.write_timeout = @write_timeout if
624
- @write_timeout && http.respond_to?(:write_timeout=)
642
+ http.keep_alive_timeout = @idle_timeout if @idle_timeout
643
+ http.max_retries = @max_retries if http.respond_to?(:max_retries=)
644
+ http.read_timeout = @read_timeout if @read_timeout
645
+ http.write_timeout = @write_timeout if
646
+ @write_timeout && http.respond_to?(:write_timeout=)
647
+
648
+ return yield connection
649
+ rescue Errno::ECONNREFUSED
650
+ if http.proxy?
651
+ address = http.proxy_address
652
+ port = http.proxy_port
653
+ else
654
+ address = http.address
655
+ port = http.port
656
+ end
625
657
 
626
- return yield connection
627
- rescue Errno::ECONNREFUSED
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
658
+ raise Error, "connection refused: #{address}:#{port}"
659
+ rescue Errno::EHOSTDOWN
660
+ if http.proxy?
661
+ address = http.proxy_address
662
+ port = http.proxy_port
663
+ else
664
+ address = http.address
665
+ port = http.port
666
+ end
635
667
 
636
- raise Error, "connection refused: #{address}:#{port}"
637
- rescue Errno::EHOSTDOWN
638
- if http.proxy?
639
- address = http.proxy_address
640
- port = http.proxy_port
641
- else
642
- address = http.address
643
- port = http.port
668
+ raise Error, "host down: #{address}:#{port}"
669
+ ensure
670
+ @pool.checkin net_http_args
644
671
  end
645
-
646
- raise Error, "host down: #{address}:#{port}"
647
- ensure
648
- @pool.checkin net_http_args
649
672
  end
650
673
 
651
674
  ##
@@ -782,7 +805,7 @@ class Gem::Net::HTTP::Persistent
782
805
  @proxy_connection_id = [nil, *@proxy_args].join ':'
783
806
 
784
807
  if @proxy_uri.query then
785
- @no_proxy = CGI.parse(@proxy_uri.query)['no_proxy'].join(',').downcase.split(',').map { |x| x.strip }.reject { |x| x.empty? }
808
+ @no_proxy = Gem::URI.decode_www_form(@proxy_uri.query).filter_map { |k, v| v if k == 'no_proxy' }.join(',').downcase.split(',').map { |x| x.strip }.reject { |x| x.empty? }
786
809
  end
787
810
  end
788
811
 
@@ -953,7 +976,8 @@ class Gem::Net::HTTP::Persistent
953
976
  end
954
977
 
955
978
  ##
956
- # Shuts down all connections
979
+ # Shuts down all connections. Attempting to checkout a connection after
980
+ # shutdown will raise an error.
957
981
  #
958
982
  # *NOTE*: Calling shutdown for can be dangerous!
959
983
  #
@@ -964,6 +988,17 @@ class Gem::Net::HTTP::Persistent
964
988
  @pool.shutdown { |http| http.finish }
965
989
  end
966
990
 
991
+ ##
992
+ # Discard all existing connections. Subsequent checkouts will create
993
+ # new connections as needed.
994
+ #
995
+ # If any thread is still using a connection it may cause an error! Call
996
+ # #reload when you are completely done making requests!
997
+
998
+ def reload
999
+ @pool.reload { |http| http.finish }
1000
+ end
1001
+
967
1002
  ##
968
1003
  # Enables SSL on +connection+
969
1004
 
@@ -1021,6 +1056,10 @@ application:
1021
1056
  connection.key = @private_key
1022
1057
  end
1023
1058
 
1059
+ if defined?(@extra_chain_cert) and @extra_chain_cert
1060
+ connection.extra_chain_cert = @extra_chain_cert
1061
+ end
1062
+
1024
1063
  connection.cert_store = if @cert_store then
1025
1064
  @cert_store
1026
1065
  else
@@ -1,13 +1,21 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "2.6.8".freeze
4
+ VERSION = "2.7.0".freeze
5
5
 
6
6
  def self.bundler_major_version
7
- @bundler_major_version ||= VERSION.split(".").first.to_i
7
+ @bundler_major_version ||= gem_version.segments.first
8
8
  end
9
9
 
10
10
  def self.gem_version
11
11
  @gem_version ||= Gem::Version.create(VERSION)
12
12
  end
13
+
14
+ def self.verbose_version
15
+ @verbose_version ||= "#{VERSION}#{simulated_version ? " (simulating Bundler #{simulated_version})" : ""}"
16
+ end
17
+
18
+ def self.simulated_version
19
+ @simulated_version ||= Bundler.settings[:simulate_version]
20
+ end
13
21
  end
@@ -88,7 +88,7 @@ module Bundler
88
88
 
89
89
  @threads = Array.new(@size) do |i|
90
90
  Thread.start { process_queue(i) }.tap do |thread|
91
- thread.name = "#{name} Worker ##{i}" if thread.respond_to?(:name=)
91
+ thread.name = "#{name} Worker ##{i}"
92
92
  end
93
93
  rescue ThreadError => e
94
94
  creation_errors << e
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "bundler/rubygems_ext"
3
4
  require_relative "bundler/vendored_fileutils"
4
5
  require "pathname"
5
6
  require "rbconfig"
@@ -7,7 +8,6 @@ require "rbconfig"
7
8
  require_relative "bundler/errors"
8
9
  require_relative "bundler/environment_preserver"
9
10
  require_relative "bundler/plugin"
10
- require_relative "bundler/rubygems_ext"
11
11
  require_relative "bundler/rubygems_integration"
12
12
  require_relative "bundler/version"
13
13
  require_relative "bundler/current_ruby"
@@ -53,7 +53,6 @@ module Bundler
53
53
  autoload :FeatureFlag, File.expand_path("bundler/feature_flag", __dir__)
54
54
  autoload :FREEBSD, File.expand_path("bundler/constants", __dir__)
55
55
  autoload :GemHelper, File.expand_path("bundler/gem_helper", __dir__)
56
- autoload :GemHelpers, File.expand_path("bundler/gem_helpers", __dir__)
57
56
  autoload :GemVersionPromoter, File.expand_path("bundler/gem_version_promoter", __dir__)
58
57
  autoload :Graph, File.expand_path("bundler/graph", __dir__)
59
58
  autoload :Index, File.expand_path("bundler/index", __dir__)
@@ -114,13 +113,13 @@ module Bundler
114
113
  end
115
114
 
116
115
  def configured_bundle_path
117
- @configured_bundle_path ||= settings.path.tap(&:validate!)
116
+ @configured_bundle_path ||= Bundler.settings.path.tap(&:validate!)
118
117
  end
119
118
 
120
119
  # Returns absolute location of where binstubs are installed to.
121
120
  def bin_path
122
121
  @bin_path ||= begin
123
- path = settings[:bin] || "bin"
122
+ path = Bundler.settings[:bin] || "bin"
124
123
  path = Pathname.new(path).expand_path(root).expand_path
125
124
  mkdir_p(path)
126
125
  path
@@ -174,14 +173,14 @@ module Bundler
174
173
  self_manager.restart_with_locked_bundler_if_needed
175
174
  end
176
175
 
177
- # Automatically install dependencies if Bundler.settings[:auto_install] exists.
176
+ # Automatically install dependencies if settings[:auto_install] exists.
178
177
  # This is set through config cmd `bundle config set --global auto_install 1`.
179
178
  #
180
179
  # Note that this method `nil`s out the global Definition object, so it
181
180
  # should be called first, before you instantiate anything like an
182
181
  # `Installer` that'll keep a reference to the old one instead.
183
182
  def auto_install
184
- return unless settings[:auto_install]
183
+ return unless Bundler.settings[:auto_install]
185
184
 
186
185
  begin
187
186
  definition.specs
@@ -239,10 +238,10 @@ module Bundler
239
238
  end
240
239
 
241
240
  def frozen_bundle?
242
- frozen = settings[:frozen]
241
+ frozen = Bundler.settings[:frozen]
243
242
  return frozen unless frozen.nil?
244
243
 
245
- settings[:deployment]
244
+ Bundler.settings[:deployment]
246
245
  end
247
246
 
248
247
  def locked_gems
@@ -343,7 +342,7 @@ module Bundler
343
342
 
344
343
  def app_cache(custom_path = nil)
345
344
  path = custom_path || root
346
- Pathname.new(path).join(settings.app_cache_path)
345
+ Pathname.new(path).join(Bundler.settings.app_cache_path)
347
346
  end
348
347
 
349
348
  def tmp(name = Process.pid.to_s)
@@ -455,10 +454,14 @@ module Bundler
455
454
  end
456
455
 
457
456
  def local_platform
458
- return Gem::Platform::RUBY if settings[:force_ruby_platform]
457
+ return Gem::Platform::RUBY if Bundler.settings[:force_ruby_platform]
459
458
  Gem::Platform.local
460
459
  end
461
460
 
461
+ def generic_local_platform
462
+ Gem::Platform.generic(local_platform)
463
+ end
464
+
462
465
  def default_gemfile
463
466
  SharedHelpers.default_gemfile
464
467
  end
@@ -564,7 +567,7 @@ module Bundler
564
567
  end
565
568
 
566
569
  def feature_flag
567
- @feature_flag ||= FeatureFlag.new(VERSION)
570
+ @feature_flag ||= FeatureFlag.new(Bundler.settings[:simulate_version] || VERSION)
568
571
  end
569
572
 
570
573
  def reset!
@@ -580,7 +583,6 @@ module Bundler
580
583
 
581
584
  def reset_paths!
582
585
  @bin_path = nil
583
- @bundler_major_version = nil
584
586
  @bundle_path = nil
585
587
  @configure = nil
586
588
  @configured_bundle_path = nil
@@ -1,150 +1,85 @@
1
1
  # Upgrading
2
2
 
3
- ## Bundler 3
3
+ ## Bundler 4
4
4
 
5
- The following is a summary of the changes that we plan to introduce in Bundler
6
- 3, why we will be making those changes, and what the deprecation process will
7
- look like. All these deprecations are printed by default in the Bundler 2.1 release.
8
-
9
- If you don't want to deal with deprecations right now and want to toggle them
10
- off, you can do it through configuration. Set the `BUNDLE_SILENCE_DEPRECATIONS`
11
- environment variable to "true", or configure it through `bundle config` either
12
- globally through `bundle config set --global silence_deprecations true` command, or
13
- locally through `bundle config set --local silence_deprecations true`. From now
14
- on in this document we will assume that all three of these configuration options
15
- are available, but will only mention `bundle config set <option> <value>`.
16
-
17
- As a general note, these changes are intended to improve the experience using
18
- bundler for _new_ users, who have no existing usage routines nor possibly biased
19
- opinions about how the tool should work based on how it has historically worked.
20
- We do understand that changing behaviour that have been existing for years can
21
- be annoying for old users, that's why we intend to make this process as smooth
22
- as possible for everyone.
23
-
24
- I'll be dividing the deprecations into four groups: CLI deprecations, Helper
25
- deprecations, DSL deprecations, and misc deprecations. Let's dive into each of
26
- them.
27
-
28
- ### CLI deprecations
29
-
30
- The CLI defines a set of commands and options that can be used by our users to
31
- create command lines that bundler can understand. There's a number of changes
32
- in the upcoming 3 version.
33
-
34
- * Flags passed to `bundle install` that relied on being remembered across invocations have been deprecated.
35
-
36
- In particular, the `--clean`, `--deployment`, `--frozen`,
37
- `--no-prune`, `--path`, `--shebang`, `--system`, `--without`, and `--with`
38
- options to `bundle install`.
39
-
40
- Remembering CLI options has been a source of historical confusion and bug
41
- reports, not only for beginners but also for experienced users. A CLI tool
42
- should not behave differently across exactly the same invocations _unless_
43
- explicitly configured to do so. This is what configuration is about after all,
44
- and things should never be silently configured without the user knowing about
45
- it.
46
-
47
- The problem with changing this behavior is that very common workflows are
48
- relying on it. For example, when you run `bundle install --without
49
- development:test` in production, those flags are persisted in the app's
50
- configuration file and further `bundle` invocations will happily ignore
51
- development and test gems. This magic will disappear from bundler 3, and
52
- you will explicitly need to configure it, either through environment
53
- variables, application configuration, or machine configuration. For example,
54
- with `bundle config set --local without development test`.
55
-
56
- The removal of this kind of flag also applies to analogous commands, for
57
- example, to `bundle check --path`.
58
-
59
- * The `--force` flag to `bundle install` and `bundle update` has been renamed to `--redownload`.
60
-
61
- This is just a simple rename of the flag, to make more apparent what it
62
- actually does. This flag forces redownloading every gem, it doesn't "force"
63
- anything else.
64
-
65
- * `bundle viz` will be removed and extracted to a plugin.
66
-
67
- This is the only bundler command requiring external dependencies, both an OS
68
- dependency (the `graphviz` package) and a gem dependency (the `ruby-graphviz`
69
- gem). Removing these dependencies will make development easier and it was also
70
- seen by the bundler team as an opportunity to develop a bundler plugin that
71
- it's officially maintained by the bundler team, and that users can take as a
72
- reference to develop their own plugins. The plugin will contain the same code
73
- as the old core command, the only difference being that the command is now
74
- implemented as `bundle graph` which is much easier to understand. However, the
75
- details of the plugin are under discussion. See [#3333](https://github.com/rubygems/rubygems/issues/3333).
5
+ In order to prepare for Bundler 4, you can easily configure Bundler 2.7 to
6
+ behave exactly like Bundler 4 will behave. To do so, set the environment
7
+ variable `BUNDLE_SIMULATE_VERSION` to `4`. Alternatively, you can use `bundle
8
+ config` and enable "Bundler 4 mode" either globally through `bundle config set
9
+ --global simulate_version 4`, or locally through `bundle config set --local
10
+ simulate_version 4`. From now on in this document we will assume that all three
11
+ of these configuration options are available, but will only mention `bundle
12
+ config set <option> <value>`.
76
13
 
77
- * The `bundle console` will be removed and replaced with `bin/console`.
14
+ The following is a summary of the changes that we plan to introduce in Bundler
15
+ 4, and why we will be making those changes. Some of them should be well known
16
+ already by existing users, because we have been printing deprecation messages
17
+ for years, but some of them are defaults that will be switched in Bundler 4 and
18
+ needs some heads up.
78
19
 
79
- Over time we found `bundle console` hard to maintain because every user would
80
- want to add her own specific tweaks to it. In order to ease maintenance and
81
- reduce bikeshedding discussions, we're removing the `bundle console` command
82
- in favor of a `bin/console` script created by `bundle gem` on gem generation
83
- that users can tweak to their needs.
20
+ ### Running just `bundle` will print help usage
84
21
 
22
+ We're changing this default to make Bundler more friendly for new users. We do
23
+ understand that long time users already know how Bundler works and find useful
24
+ that just `bundle` defaults to `bundle install`. Those users can keep the
25
+ existing default by configuring
85
26
 
86
- * The `bundle install` command will no longer accept a `--binstubs` flag.
27
+ ```
28
+ bundle config default_cli_command install
29
+ ```
87
30
 
88
- The `--binstubs` option has been removed from `bundle install` and replaced
89
- with the `bundle binstubs` command. The `--binstubs` flag would create
90
- binstubs for all executables present inside the gems in the project. This was
91
- hardly useful since most users will only use a subset of all the binstubs
92
- available to them. Also, it would force the introduction of a bunch of most
93
- likely unused files into source control. Because of this, binstubs now must
94
- be created and checked into version control individually.
95
-
96
-
97
- * The `bundle inject` command is deprecated and replaced with `bundle add`.
98
-
99
- We believe the new command fits the user's mental model better and it supports
100
- a wider set of use cases. The interface supported by `bundle inject` works
101
- exactly the same in `bundle add`, so it should be easy to migrate to the new
102
- command.
31
+ ### Bundler will install to a `.bundle` folder relative to repository root by default
103
32
 
104
- #### Cancelled CLI deprecations
33
+ We're making this change to improve isolation.
105
34
 
106
- These deprecations have been initially announced before, but the deprecations
107
- were cancelled before the release of Bundler 2.1.0 in [rubygems/bundler#7475](https://github.com/rubygems/bundler/pull/7475).
35
+ The previous default of installing to system changes can be kept with `bundle
36
+ config path.system true`.
108
37
 
109
- * ~The `bundle update` command will no longer update all gems, you'll need to pass `--all` to it.~ (postponed)
38
+ Related to this change, and to alleviate potential bad consequences from it,
39
+ we're also shipping some related changes:
110
40
 
111
- * ~The `bundle config` command will no longer accept old subcommand-based interface before Bundler 2.1.~ (postponed)
41
+ * To keep disk usage under control, Bundler will cleanup unused gems when
42
+ installing gems per application using the new default. This new behavior can
43
+ be disabled by toggling back installing to system gems as explained before, or
44
+ by configuring `bundle config clean false`.
112
45
 
113
- ### Helper deprecations
46
+ * To avoid duplicate downloads of `.gem` packages and recompilation of
47
+ extensions, Bundler will keep a global cache of gem packages and compiled
48
+ extensions. This new behaviour can be disabled with `bundle config
49
+ global_gem_cache false`, or by toggling back installing to system gems as
50
+ explained before.
114
51
 
115
- * `Bundler.clean_env`, `Bundler.with_clean_env`, `Bundler.clean_system`, and `Bundler.clean_exec` are deprecated.
52
+ ### Flags passed to `bundle install` that relied on being remembered across invocations will be removed
116
53
 
117
- All of these helpers ultimately use `Bundler.clean_env` under the hood, which
118
- makes sure all bundler-related environment are removed inside the block it
119
- yields.
54
+ In particular, the `--clean`, `--deployment`, `--frozen`, `--no-prune`,
55
+ `--path`, `--shebang`, `--system`, `--without`, and `--with` options to `bundle
56
+ install`.
120
57
 
121
- After quite a lot user reports, we noticed that users don't usually want this
122
- but instead want the bundler environment as it was before the current process
123
- was started. Thus, `Bundler.with_original_env`, `Bundler.original_system`, and
124
- `Bundler.original_exec` were born. They all use the new `Bundler.original_env`
125
- under the hood.
58
+ Remembering CLI options has been a source of historical confusion and bug
59
+ reports, not only for beginners but also for experienced users. A CLI tool
60
+ should not behave differently across exactly the same invocations _unless_
61
+ explicitly configured to do so. This is what configuration is about after all,
62
+ and things should never be silently configured without the user knowing about
63
+ it.
126
64
 
127
- There's however some specific cases where the good old `Bundler.clean_env`
128
- behavior can be useful. For example, when testing Rails generators, you really
129
- want an environment where `bundler` is out of the picture. This is why we
130
- decided to keep the old behavior under a new more clear name, because we
131
- figured the word "clean" was too ambiguous. So we have introduced
132
- `Bundler.unbundled_env`, `Bundler.with_unbundled_env`,
133
- `Bundler.unbundled_system`, and `Bundler.unbundled_exec`.
65
+ The problem with changing this behavior is that very common workflows are
66
+ relying on it. For example, when you run `bundle install --without
67
+ development:test` in production, those flags are persisted in the app's
68
+ configuration file and further `bundle` invocations will happily ignore
69
+ development and test gems. This magic will disappear from bundler 4, and you
70
+ will explicitly need to configure it, either through environment variables,
71
+ application configuration, or machine configuration. For example, with `bundle
72
+ config set --local without development test`.
134
73
 
135
- * `Bundler.environment` is deprecated in favor of `Bundler.load`.
74
+ ### Bundler will include checksums in the lockfile by default
136
75
 
137
- We're not sure how people might be using this directly but we have removed the
138
- `Bundler::Environment` class which was instantiated by `Bundler.environment`
139
- since we realized the `Bundler::Runtime` class was the same thing. During the
140
- transition `Bundler.environment` will delegate to `Bundler.load`, which holds
141
- the reference to the `Bundler::Environment`.
76
+ We shipped this security feature recently and we believe it's time to turn it on
77
+ by default, so that everyone benefits from the extra security assurances by default.
142
78
 
143
- #### DSL deprecations
79
+ ### Strict source pinning in Gemfile is enforced by default
144
80
 
145
- The following deprecations in bundler's DSL are meant to prepare for the strict
146
- source pinning in bundler 3, where the source for every dependency will be
147
- unambiguously defined.
81
+ In bundler 4, the source for every dependency will be unambiguously defined, and
82
+ Bundler will refuse to run otherwise.
148
83
 
149
84
  * Multiple global Gemfile sources will no longer be supported.
150
85
 
@@ -207,7 +142,82 @@ unambiguously defined.
207
142
  end
208
143
  ```
209
144
 
210
- #### Misc deprecations
145
+ #### Notable CLI changes
146
+
147
+ * The `--force` flag to `bundle install` and `bundle update` will be renamed to `--redownload`.
148
+
149
+ This is just a simple rename of the flag, to make more apparent what it
150
+ actually does. This flag forces redownloading every gem, it doesn't "force"
151
+ anything else.
152
+
153
+ * `bundle viz` will be removed and extracted to a plugin.
154
+
155
+ This is the only bundler command requiring external dependencies, both an OS
156
+ dependency (the `graphviz` package) and a gem dependency (the `ruby-graphviz`
157
+ gem). Removing these dependencies will make development easier and it was also
158
+ seen by the bundler team as an opportunity to develop a bundler plugin that
159
+ it's officially maintained by the bundler team, and that users can take as a
160
+ reference to develop their own plugins. The plugin will contain the same code
161
+ as the old core command, the only difference being that the command is now
162
+ implemented as `bundle graph` which is much easier to understand. However, the
163
+ details of the plugin are under discussion. See [#3333](https://github.com/rubygems/rubygems/issues/3333).
164
+
165
+ * The `bundle install` command will no longer accept a `--binstubs` flag.
166
+
167
+ The `--binstubs` option has been removed from `bundle install` and replaced
168
+ with the `bundle binstubs` command. The `--binstubs` flag would create
169
+ binstubs for all executables present inside the gems in the project. This was
170
+ hardly useful since most users will only use a subset of all the binstubs
171
+ available to them. Also, it would force the introduction of a bunch of most
172
+ likely unused files into source control. Because of this, binstubs now must
173
+ be created and checked into version control individually.
174
+
175
+ * The `bundle inject` command will be replaced with `bundle add`
176
+
177
+ We believe the new command fits the user's mental model better and it supports
178
+ a wider set of use cases. The interface supported by `bundle inject` works
179
+ exactly the same in `bundle add`, so it should be easy to migrate to the new
180
+ command.
181
+
182
+ ### Other notable changes
183
+
184
+ * Git and Path gems will be included in `vendor/cache` by default
185
+
186
+ We're unsure why these gems were treated specially so we'll start caching them
187
+ normally.
188
+
189
+ * Bundler will use cached local data if available when network issues are found
190
+ during resolution.
191
+
192
+ Just trying to provide a more resilient behavior here.
193
+
194
+ * `Bundler.clean_env`, `Bundler.with_clean_env`, `Bundler.clean_system`, and `Bundler.clean_exec` will be removed
195
+
196
+ All of these helpers ultimately use `Bundler.clean_env` under the hood, which
197
+ makes sure all bundler-related environment are removed inside the block it
198
+ yields.
199
+
200
+ After quite a lot user reports, we noticed that users don't usually want this
201
+ but instead want the bundler environment as it was before the current process
202
+ was started. Thus, `Bundler.with_original_env`, `Bundler.original_system`, and
203
+ `Bundler.original_exec` were born. They all use the new `Bundler.original_env`
204
+ under the hood.
205
+
206
+ There's however some specific cases where the good old `Bundler.clean_env`
207
+ behavior can be useful. For example, when testing Rails generators, you really
208
+ want an environment where `bundler` is out of the picture. This is why we
209
+ decided to keep the old behavior under a new more clear name, because we
210
+ figured the word "clean" was too ambiguous. So we have introduced
211
+ `Bundler.unbundled_env`, `Bundler.with_unbundled_env`,
212
+ `Bundler.unbundled_system`, and `Bundler.unbundled_exec`.
213
+
214
+ * `Bundler.environment` is deprecated in favor of `Bundler.load`.
215
+
216
+ We're not sure how people might be using this directly but we have removed the
217
+ `Bundler::Environment` class which was instantiated by `Bundler.environment`
218
+ since we realized the `Bundler::Runtime` class was the same thing. During the
219
+ transition `Bundler.environment` will delegate to `Bundler.load`, which holds
220
+ the reference to the `Bundler::Environment`.
211
221
 
212
222
  * Deployment helpers for `vlad` and `capistrano` are being removed.
213
223
 
@@ -52,7 +52,7 @@ To run commands like `gem install` from the repo:
52
52
 
53
53
  To run commands like `bundle install` from the repo:
54
54
 
55
- ruby bundler/spec/support/bundle.rb install
55
+ bundler/bin/bundle install
56
56
 
57
57
  ### Running Tests
58
58