bundler 2.6.5 → 2.7.1

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 (136) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1172 -1024
  3. data/README.md +7 -7
  4. data/bundler.gemspec +2 -2
  5. data/lib/bundler/build_metadata.rb +10 -11
  6. data/lib/bundler/checksum.rb +22 -12
  7. data/lib/bundler/cli/common.rb +1 -1
  8. data/lib/bundler/cli/config.rb +2 -2
  9. data/lib/bundler/cli/doctor/diagnose.rb +167 -0
  10. data/lib/bundler/cli/doctor/ssl.rb +249 -0
  11. data/lib/bundler/cli/doctor.rb +27 -155
  12. data/lib/bundler/cli/gem.rb +62 -30
  13. data/lib/bundler/cli/inject.rb +2 -2
  14. data/lib/bundler/cli/install.rb +5 -5
  15. data/lib/bundler/cli/issue.rb +2 -2
  16. data/lib/bundler/cli/lock.rb +2 -1
  17. data/lib/bundler/cli/outdated.rb +1 -1
  18. data/lib/bundler/cli/update.rb +3 -3
  19. data/lib/bundler/cli.rb +26 -49
  20. data/lib/bundler/compact_index_client/cache.rb +1 -1
  21. data/lib/bundler/compact_index_client/parser.rb +1 -1
  22. data/lib/bundler/compact_index_client/updater.rb +2 -1
  23. data/lib/bundler/compact_index_client.rb +1 -5
  24. data/lib/bundler/current_ruby.rb +27 -3
  25. data/lib/bundler/definition.rb +184 -151
  26. data/lib/bundler/dependency.rb +1 -1
  27. data/lib/bundler/dsl.rb +35 -26
  28. data/lib/bundler/errors.rb +18 -0
  29. data/lib/bundler/feature_flag.rb +15 -12
  30. data/lib/bundler/fetcher/dependency.rb +2 -1
  31. data/lib/bundler/fetcher/downloader.rb +33 -7
  32. data/lib/bundler/fetcher.rb +49 -19
  33. data/lib/bundler/friendly_errors.rb +3 -2
  34. data/lib/bundler/index.rb +7 -2
  35. data/lib/bundler/injector.rb +9 -9
  36. data/lib/bundler/installer.rb +6 -5
  37. data/lib/bundler/lazy_specification.rb +38 -19
  38. data/lib/bundler/lockfile_parser.rb +29 -10
  39. data/lib/bundler/man/bundle-add.1 +1 -1
  40. data/lib/bundler/man/bundle-binstubs.1 +1 -1
  41. data/lib/bundler/man/bundle-cache.1 +1 -1
  42. data/lib/bundler/man/bundle-check.1 +1 -1
  43. data/lib/bundler/man/bundle-clean.1 +1 -1
  44. data/lib/bundler/man/bundle-config.1 +175 -129
  45. data/lib/bundler/man/bundle-config.1.ronn +93 -88
  46. data/lib/bundler/man/bundle-console.1 +1 -1
  47. data/lib/bundler/man/bundle-doctor.1 +43 -4
  48. data/lib/bundler/man/bundle-doctor.1.ronn +48 -4
  49. data/lib/bundler/man/bundle-env.1 +1 -1
  50. data/lib/bundler/man/bundle-exec.1 +3 -3
  51. data/lib/bundler/man/bundle-exec.1.ronn +2 -2
  52. data/lib/bundler/man/bundle-fund.1 +1 -1
  53. data/lib/bundler/man/bundle-gem.1 +67 -44
  54. data/lib/bundler/man/bundle-gem.1.ronn +8 -4
  55. data/lib/bundler/man/bundle-help.1 +1 -1
  56. data/lib/bundler/man/bundle-info.1 +1 -1
  57. data/lib/bundler/man/bundle-init.1 +1 -1
  58. data/lib/bundler/man/bundle-inject.1 +2 -2
  59. data/lib/bundler/man/bundle-inject.1.ronn +1 -1
  60. data/lib/bundler/man/bundle-install.1 +4 -4
  61. data/lib/bundler/man/bundle-install.1.ronn +3 -4
  62. data/lib/bundler/man/bundle-issue.1 +1 -1
  63. data/lib/bundler/man/bundle-licenses.1 +1 -1
  64. data/lib/bundler/man/bundle-list.1 +1 -1
  65. data/lib/bundler/man/bundle-lock.1 +1 -1
  66. data/lib/bundler/man/bundle-open.1 +1 -1
  67. data/lib/bundler/man/bundle-outdated.1 +1 -1
  68. data/lib/bundler/man/bundle-platform.1 +1 -1
  69. data/lib/bundler/man/bundle-plugin.1 +1 -1
  70. data/lib/bundler/man/bundle-pristine.1 +1 -1
  71. data/lib/bundler/man/bundle-remove.1 +1 -1
  72. data/lib/bundler/man/bundle-show.1 +1 -1
  73. data/lib/bundler/man/bundle-update.1 +5 -5
  74. data/lib/bundler/man/bundle-update.1.ronn +4 -4
  75. data/lib/bundler/man/bundle-version.1 +1 -1
  76. data/lib/bundler/man/bundle-viz.1 +1 -1
  77. data/lib/bundler/man/bundle.1 +1 -1
  78. data/lib/bundler/man/gemfile.5 +1 -1
  79. data/lib/bundler/match_platform.rb +31 -12
  80. data/lib/bundler/materialization.rb +2 -2
  81. data/lib/bundler/plugin/api/source.rb +1 -1
  82. data/lib/bundler/plugin/index.rb +1 -1
  83. data/lib/bundler/plugin/installer/path.rb +8 -0
  84. data/lib/bundler/plugin.rb +1 -1
  85. data/lib/bundler/resolver/candidate.rb +12 -9
  86. data/lib/bundler/resolver/package.rb +1 -1
  87. data/lib/bundler/resolver/strategy.rb +40 -0
  88. data/lib/bundler/resolver.rb +18 -27
  89. data/lib/bundler/rubygems_ext.rb +131 -120
  90. data/lib/bundler/rubygems_integration.rb +11 -6
  91. data/lib/bundler/runtime.rb +9 -6
  92. data/lib/bundler/self_manager.rb +32 -42
  93. data/lib/bundler/settings/validator.rb +0 -23
  94. data/lib/bundler/settings.rb +4 -6
  95. data/lib/bundler/shared_helpers.rb +10 -4
  96. data/lib/bundler/source/gemspec.rb +1 -4
  97. data/lib/bundler/source/git/git_proxy.rb +17 -6
  98. data/lib/bundler/source/git.rb +5 -1
  99. data/lib/bundler/source/path.rb +9 -2
  100. data/lib/bundler/source/rubygems/remote.rb +11 -3
  101. data/lib/bundler/source_list.rb +30 -16
  102. data/lib/bundler/source_map.rb +1 -1
  103. data/lib/bundler/spec_set.rb +55 -16
  104. data/lib/bundler/templates/Executable +0 -11
  105. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +2 -0
  106. data/lib/bundler/templates/newgem/newgem.gemspec.tt +6 -5
  107. data/lib/bundler/ui/shell.rb +2 -2
  108. data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +53 -3
  109. data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
  110. data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +11 -0
  111. data/lib/bundler/vendor/net-http-persistent/README.rdoc +1 -1
  112. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +2 -1
  113. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +81 -42
  114. data/lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +4 -24
  115. data/lib/bundler/vendor/pub_grub/lib/pub_grub/strategy.rb +42 -0
  116. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +20 -8
  117. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +17 -29
  118. data/lib/bundler/vendor/uri/lib/uri/common.rb +7 -3
  119. data/lib/bundler/vendor/uri/lib/uri/generic.rb +12 -11
  120. data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +6 -6
  121. data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
  122. data/lib/bundler/version.rb +10 -2
  123. data/lib/bundler/worker.rb +1 -1
  124. data/lib/bundler.rb +14 -12
  125. metadata +9 -16
  126. data/lib/bundler/compact_index_client/gem_parser.rb +0 -32
  127. data/lib/bundler/gem_helpers.rb +0 -144
  128. data/lib/bundler/templates/Executable.bundler +0 -109
  129. data/lib/bundler/vendor/connection_pool/.document +0 -1
  130. data/lib/bundler/vendor/fileutils/.document +0 -1
  131. data/lib/bundler/vendor/net-http-persistent/.document +0 -1
  132. data/lib/bundler/vendor/pub_grub/.document +0 -1
  133. data/lib/bundler/vendor/securerandom/.document +0 -1
  134. data/lib/bundler/vendor/thor/.document +0 -1
  135. data/lib/bundler/vendor/tsort/.document +0 -1
  136. data/lib/bundler/vendor/uri/.document +0 -1
@@ -1,161 +1,33 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "rbconfig"
4
- require "shellwords"
5
-
6
3
  module Bundler
7
- class CLI::Doctor
8
- DARWIN_REGEX = /\s+(.+) \(compatibility /
9
- LDD_REGEX = /\t\S+ => (\S+) \(\S+\)/
10
-
11
- attr_reader :options
12
-
13
- def initialize(options)
14
- @options = options
15
- end
16
-
17
- def otool_available?
18
- Bundler.which("otool")
19
- end
20
-
21
- def ldd_available?
22
- Bundler.which("ldd")
23
- end
24
-
25
- def dylibs_darwin(path)
26
- output = `/usr/bin/otool -L #{path.shellescape}`.chomp
27
- dylibs = output.split("\n")[1..-1].map {|l| l.match(DARWIN_REGEX).captures[0] }.uniq
28
- # ignore @rpath and friends
29
- dylibs.reject {|dylib| dylib.start_with? "@" }
30
- end
31
-
32
- def dylibs_ldd(path)
33
- output = `/usr/bin/ldd #{path.shellescape}`.chomp
34
- output.split("\n").filter_map do |l|
35
- match = l.match(LDD_REGEX)
36
- next if match.nil?
37
- match.captures[0]
38
- end
39
- end
40
-
41
- def dylibs(path)
42
- case RbConfig::CONFIG["host_os"]
43
- when /darwin/
44
- return [] unless otool_available?
45
- dylibs_darwin(path)
46
- when /(linux|solaris|bsd)/
47
- return [] unless ldd_available?
48
- dylibs_ldd(path)
49
- else # Windows, etc.
50
- Bundler.ui.warn("Dynamic library check not supported on this platform.")
51
- []
52
- end
53
- end
54
-
55
- def bundles_for_gem(spec)
56
- Dir.glob("#{spec.full_gem_path}/**/*.bundle")
57
- end
58
-
59
- def lookup_with_fiddle(path)
60
- require "fiddle"
61
- Fiddle.dlopen(path)
62
- false
63
- rescue Fiddle::DLError
64
- true
65
- end
66
-
67
- def check!
68
- require_relative "check"
69
- Bundler::CLI::Check.new({}).run
70
- end
71
-
72
- def run
73
- Bundler.ui.level = "warn" if options[:quiet]
74
- Bundler.settings.validate!
75
- check!
76
-
77
- definition = Bundler.definition
78
- broken_links = {}
79
-
80
- definition.specs.each do |spec|
81
- bundles_for_gem(spec).each do |bundle|
82
- bad_paths = dylibs(bundle).select do |f|
83
- lookup_with_fiddle(f)
84
- end
85
- if bad_paths.any?
86
- broken_links[spec] ||= []
87
- broken_links[spec].concat(bad_paths)
88
- end
89
- end
90
- end
91
-
92
- permissions_valid = check_home_permissions
93
-
94
- if broken_links.any?
95
- message = "The following gems are missing OS dependencies:"
96
- broken_links.flat_map do |spec, paths|
97
- paths.uniq.map do |path|
98
- "\n * #{spec.name}: #{path}"
99
- end
100
- end.sort.each {|m| message += m }
101
- raise ProductionError, message
102
- elsif !permissions_valid
103
- Bundler.ui.info "No issues found with the installed bundle"
104
- end
105
- end
106
-
107
- private
108
-
109
- def check_home_permissions
110
- require "find"
111
- files_not_readable_or_writable = []
112
- files_not_rw_and_owned_by_different_user = []
113
- files_not_owned_by_current_user_but_still_rw = []
114
- broken_symlinks = []
115
- Find.find(Bundler.bundle_path.to_s).each do |f|
116
- if !File.exist?(f)
117
- broken_symlinks << f
118
- elsif !File.writable?(f) || !File.readable?(f)
119
- if File.stat(f).uid != Process.uid
120
- files_not_rw_and_owned_by_different_user << f
121
- else
122
- files_not_readable_or_writable << f
123
- end
124
- elsif File.stat(f).uid != Process.uid
125
- files_not_owned_by_current_user_but_still_rw << f
126
- end
127
- end
128
-
129
- ok = true
130
-
131
- if broken_symlinks.any?
132
- Bundler.ui.warn "Broken links exist in the Bundler home. Please report them to the offending gem's upstream repo. These files are:\n - #{broken_symlinks.join("\n - ")}"
133
-
134
- ok = false
135
- end
136
-
137
- if files_not_owned_by_current_user_but_still_rw.any?
138
- Bundler.ui.warn "Files exist in the Bundler home that are owned by another " \
139
- "user, but are still readable/writable. These files are:\n - #{files_not_owned_by_current_user_but_still_rw.join("\n - ")}"
140
-
141
- ok = false
142
- end
143
-
144
- if files_not_rw_and_owned_by_different_user.any?
145
- Bundler.ui.warn "Files exist in the Bundler home that are owned by another " \
146
- "user, and are not readable/writable. These files are:\n - #{files_not_rw_and_owned_by_different_user.join("\n - ")}"
147
-
148
- ok = false
149
- end
150
-
151
- if files_not_readable_or_writable.any?
152
- Bundler.ui.warn "Files exist in the Bundler home that are not " \
153
- "readable/writable by the current user. These files are:\n - #{files_not_readable_or_writable.join("\n - ")}"
154
-
155
- ok = false
156
- end
157
-
158
- ok
4
+ class CLI::Doctor < Thor
5
+ default_command(:diagnose)
6
+
7
+ desc "diagnose [OPTIONS]", "Checks the bundle for common problems"
8
+ long_desc <<-D
9
+ Doctor scans the OS dependencies of each of the gems requested in the Gemfile. If
10
+ missing dependencies are detected, Bundler prints them and exits status 1.
11
+ Otherwise, Bundler prints a success message and exits with a status of 0.
12
+ D
13
+ method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile"
14
+ method_option "quiet", type: :boolean, banner: "Only output warnings and errors."
15
+ method_option "ssl", type: :boolean, default: false, banner: "Diagnose SSL problems."
16
+ def diagnose
17
+ require_relative "doctor/diagnose"
18
+ Diagnose.new(options).run
19
+ end
20
+
21
+ desc "ssl [OPTIONS]", "Diagnose SSL problems"
22
+ long_desc <<-D
23
+ Diagnose SSL problems, especially related to certificates or TLS version while connecting to https://rubygems.org.
24
+ D
25
+ method_option "host", type: :string, banner: "The host to diagnose."
26
+ method_option "tls-version", type: :string, banner: "Specify the SSL/TLS version when running the diagnostic. Accepts either <1.1> or <1.2>"
27
+ method_option "verify-mode", type: :string, banner: "Specify the mode used for certification verification. Accepts either <peer> or <none>"
28
+ def ssl
29
+ require_relative "doctor/ssl"
30
+ SSL.new(options).run
159
31
  end
160
32
  end
161
33
  end
@@ -31,7 +31,6 @@ module Bundler
31
31
  @extension = options[:ext]
32
32
 
33
33
  validate_ext_name if @extension
34
- validate_rust_builder_rubygems_version if @extension == "rust"
35
34
  end
36
35
 
37
36
  def run
@@ -48,13 +47,16 @@ module Bundler
48
47
  git_author_name = use_git ? `git config user.name`.chomp : ""
49
48
  git_username = use_git ? `git config github.user`.chomp : ""
50
49
  git_user_email = use_git ? `git config user.email`.chomp : ""
50
+ github_username = github_username(git_username)
51
51
 
52
- github_username = if options[:github_username].nil?
53
- git_username
54
- elsif options[:github_username] == false
55
- ""
52
+ if github_username.empty?
53
+ homepage_uri = "TODO: Put your gem's website or public repo URL here."
54
+ source_code_uri = "TODO: Put your gem's public repo URL here."
55
+ changelog_uri = "TODO: Put your gem's CHANGELOG.md URL here."
56
56
  else
57
- options[:github_username]
57
+ homepage_uri = "https://github.com/#{github_username}/#{name}"
58
+ source_code_uri = "https://github.com/#{github_username}/#{name}"
59
+ changelog_uri = "https://github.com/#{github_username}/#{name}/blob/main/CHANGELOG.md"
58
60
  end
59
61
 
60
62
  config = {
@@ -69,12 +71,17 @@ module Bundler
69
71
  test: options[:test],
70
72
  ext: extension,
71
73
  exe: options[:exe],
74
+ bundle: options[:bundle],
72
75
  bundler_version: bundler_dependency_version,
73
76
  git: use_git,
74
77
  github_username: github_username.empty? ? "[USERNAME]" : github_username,
75
78
  required_ruby_version: required_ruby_version,
76
79
  rust_builder_required_rubygems_version: rust_builder_required_rubygems_version,
77
80
  minitest_constant_name: minitest_constant_name,
81
+ ignore_paths: %w[bin/],
82
+ homepage_uri: homepage_uri,
83
+ source_code_uri: source_code_uri,
84
+ changelog_uri: changelog_uri,
78
85
  }
79
86
  ensure_safe_gem_name(name, constant_array)
80
87
 
@@ -95,7 +102,18 @@ module Bundler
95
102
  bin/setup
96
103
  ]
97
104
 
98
- templates.merge!("gitignore.tt" => ".gitignore") if use_git
105
+ case Bundler.preferred_gemfile_name
106
+ when "Gemfile"
107
+ config[:ignore_paths] << "Gemfile"
108
+ when "gems.rb"
109
+ config[:ignore_paths] << "gems.rb"
110
+ config[:ignore_paths] << "gems.locked"
111
+ end
112
+
113
+ if use_git
114
+ templates.merge!("gitignore.tt" => ".gitignore")
115
+ config[:ignore_paths] << ".gitignore"
116
+ end
99
117
 
100
118
  if test_framework = ask_and_set_test_framework
101
119
  config[:test] = test_framework
@@ -109,6 +127,8 @@ module Bundler
109
127
  "spec/newgem_spec.rb.tt" => "spec/#{namespaced_path}_spec.rb"
110
128
  )
111
129
  config[:test_task] = :spec
130
+ config[:ignore_paths] << ".rspec"
131
+ config[:ignore_paths] << "spec/"
112
132
  when "minitest"
113
133
  # Generate path for minitest target file (FileList["test/**/test_*.rb"])
114
134
  # foo => test/test_foo.rb
@@ -123,12 +143,14 @@ module Bundler
123
143
  "test/minitest/test_newgem.rb.tt" => "test/#{minitest_namespaced_path}.rb"
124
144
  )
125
145
  config[:test_task] = :test
146
+ config[:ignore_paths] << "test/"
126
147
  when "test-unit"
127
148
  templates.merge!(
128
149
  "test/test-unit/test_helper.rb.tt" => "test/test_helper.rb",
129
150
  "test/test-unit/newgem_test.rb.tt" => "test/#{namespaced_path}_test.rb"
130
151
  )
131
152
  config[:test_task] = :test
153
+ config[:ignore_paths] << "test/"
132
154
  end
133
155
  end
134
156
 
@@ -136,19 +158,19 @@ module Bundler
136
158
  case config[:ci]
137
159
  when "github"
138
160
  templates.merge!("github/workflows/main.yml.tt" => ".github/workflows/main.yml")
139
- config[:ci_config_path] = ".github "
161
+ config[:ignore_paths] << ".github/"
140
162
  when "gitlab"
141
163
  templates.merge!("gitlab-ci.yml.tt" => ".gitlab-ci.yml")
142
- config[:ci_config_path] = ".gitlab-ci.yml "
164
+ config[:ignore_paths] << ".gitlab-ci.yml"
143
165
  when "circle"
144
166
  templates.merge!("circleci/config.yml.tt" => ".circleci/config.yml")
145
- config[:ci_config_path] = ".circleci "
167
+ config[:ignore_paths] << ".circleci/"
146
168
  end
147
169
 
148
170
  if ask_and_set(:mit, "Do you want to license your code permissively under the MIT license?",
149
- "This means that any other developer or company will be legally allowed to use your code " \
150
- "for free as long as they admit you created it. You can read more about the MIT license " \
151
- "at https://choosealicense.com/licenses/mit.")
171
+ "Using a MIT license means that any other developer or company will be legally allowed " \
172
+ "to use your code for free as long as they admit you created it. You can read more about " \
173
+ "the MIT license at https://choosealicense.com/licenses/mit.")
152
174
  config[:mit] = true
153
175
  Bundler.ui.info "MIT License enabled in config"
154
176
  templates.merge!("LICENSE.txt.tt" => "LICENSE.txt")
@@ -185,10 +207,12 @@ module Bundler
185
207
  config[:linter_version] = rubocop_version
186
208
  Bundler.ui.info "RuboCop enabled in config"
187
209
  templates.merge!("rubocop.yml.tt" => ".rubocop.yml")
210
+ config[:ignore_paths] << ".rubocop.yml"
188
211
  when "standard"
189
212
  config[:linter_version] = standard_version
190
213
  Bundler.ui.info "Standard enabled in config"
191
214
  templates.merge!("standard.yml.tt" => ".standard.yml")
215
+ config[:ignore_paths] << ".standard.yml"
192
216
  end
193
217
 
194
218
  if config[:exe]
@@ -219,7 +243,7 @@ module Bundler
219
243
  end
220
244
 
221
245
  if use_git
222
- Bundler.ui.info "Initializing git repo in #{target}"
246
+ Bundler.ui.info "\nInitializing git repo in #{target}"
223
247
  require "shellwords"
224
248
  `git init #{target.to_s.shellescape}`
225
249
 
@@ -241,10 +265,17 @@ module Bundler
241
265
  IO.popen(%w[git add .], { chdir: target }, &:read)
242
266
  end
243
267
 
268
+ if config[:bundle]
269
+ Bundler.ui.info "Running bundle install in the new gem directory."
270
+ Dir.chdir(target) do
271
+ system("bundle install")
272
+ end
273
+ end
274
+
244
275
  # Open gemspec in editor
245
276
  open_editor(options["edit"], target.join("#{name}.gemspec")) if options[:edit]
246
277
 
247
- Bundler.ui.info "Gem '#{name}' was successfully created. " \
278
+ Bundler.ui.info "\nGem '#{name}' was successfully created. " \
248
279
  "For more information on making a RubyGem visit https://bundler.io/guides/creating_gem.html"
249
280
  end
250
281
 
@@ -254,13 +285,13 @@ module Bundler
254
285
  SharedHelpers.pwd.join(name).basename.to_s
255
286
  end
256
287
 
257
- def ask_and_set(key, header, message)
288
+ def ask_and_set(key, prompt, explanation)
258
289
  choice = options[key]
259
290
  choice = Bundler.settings["gem.#{key}"] if choice.nil?
260
291
 
261
292
  if choice.nil?
262
- Bundler.ui.confirm header
263
- choice = Bundler.ui.yes? "#{message} y/(n):"
293
+ Bundler.ui.info "\n#{explanation}"
294
+ choice = Bundler.ui.yes? "#{prompt} y/(n):"
264
295
  Bundler.settings.set_global("gem.#{key}", choice)
265
296
  end
266
297
 
@@ -282,7 +313,7 @@ module Bundler
282
313
  test_framework = options[:test] || Bundler.settings["gem.test"]
283
314
 
284
315
  if test_framework.to_s.empty?
285
- Bundler.ui.confirm "Do you want to generate tests with your gem?"
316
+ Bundler.ui.info "\nDo you want to generate tests with your gem?"
286
317
  Bundler.ui.info hint_text("test")
287
318
 
288
319
  result = Bundler.ui.ask "Enter a test framework. rspec/minitest/test-unit/(none):"
@@ -322,12 +353,11 @@ module Bundler
322
353
  ci_template = options[:ci] || Bundler.settings["gem.ci"]
323
354
 
324
355
  if ci_template.to_s.empty?
325
- Bundler.ui.confirm "Do you want to set up continuous integration for your gem? " \
356
+ Bundler.ui.info "\nDo you want to set up continuous integration for your gem? " \
326
357
  "Supported services:\n" \
327
358
  "* CircleCI: https://circleci.com/\n" \
328
359
  "* GitHub Actions: https://github.com/features/actions\n" \
329
- "* GitLab CI: https://docs.gitlab.com/ee/ci/\n" \
330
- "\n"
360
+ "* GitLab CI: https://docs.gitlab.com/ee/ci/\n"
331
361
  Bundler.ui.info hint_text("ci")
332
362
 
333
363
  result = Bundler.ui.ask "Enter a CI service. github/gitlab/circle/(none):"
@@ -355,11 +385,10 @@ module Bundler
355
385
  linter_template = deprecated_rubocop_option if linter_template.nil?
356
386
 
357
387
  if linter_template.to_s.empty?
358
- Bundler.ui.confirm "Do you want to add a code linter and formatter to your gem? " \
388
+ Bundler.ui.info "\nDo you want to add a code linter and formatter to your gem? " \
359
389
  "Supported Linters:\n" \
360
390
  "* RuboCop: https://rubocop.org\n" \
361
- "* Standard: https://github.com/standardrb/standard\n" \
362
- "\n"
391
+ "* Standard: https://github.com/standardrb/standard\n"
363
392
  Bundler.ui.info hint_text("linter")
364
393
 
365
394
  result = Bundler.ui.ask "Enter a linter. rubocop/standard/(none):"
@@ -446,7 +475,7 @@ module Bundler
446
475
  end
447
476
 
448
477
  def required_ruby_version
449
- "3.1.0"
478
+ "3.2.0"
450
479
  end
451
480
 
452
481
  def rubocop_version
@@ -457,10 +486,13 @@ module Bundler
457
486
  "1.3"
458
487
  end
459
488
 
460
- def validate_rust_builder_rubygems_version
461
- if Gem::Version.new(rust_builder_required_rubygems_version) > Gem.rubygems_version
462
- Bundler.ui.error "Your RubyGems version (#{Gem.rubygems_version}) is too old to build Rust extension. Please update your RubyGems using `gem update --system` or any other way and try again."
463
- exit 1
489
+ def github_username(git_username)
490
+ if options[:github_username].nil?
491
+ git_username
492
+ elsif options[:github_username] == false
493
+ ""
494
+ else
495
+ options[:github_username]
464
496
  end
465
497
  end
466
498
  end
@@ -35,8 +35,8 @@ module Bundler
35
35
  Bundler.ui.confirm(added.map do |d|
36
36
  name = "'#{d.name}'"
37
37
  requirement = ", '#{d.requirement}'"
38
- group = ", :group => #{d.groups.inspect}" if d.groups != Array(:default)
39
- source = ", :source => '#{d.source}'" unless d.source.nil?
38
+ group = ", group: #{d.groups.inspect}" if d.groups != Array(:default)
39
+ source = ", source: '#{d.source}'" unless d.source.nil?
40
40
  %(gem #{name}#{requirement}#{group}#{source})
41
41
  end.join("\n"))
42
42
  else
@@ -66,7 +66,9 @@ module Bundler
66
66
 
67
67
  Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.feature_flag.plugins?
68
68
 
69
- definition = Bundler.definition
69
+ # For install we want to enable strict validation
70
+ # (rather than some optimizations we perform at app runtime).
71
+ definition = Bundler.definition(strict: true)
70
72
  definition.validate_runtime!
71
73
 
72
74
  installer = Installer.install(Bundler.root, definition, options)
@@ -158,9 +160,7 @@ module Bundler
158
160
  Bundler.settings.set_command_option_if_given :path, options[:path]
159
161
 
160
162
  if options["standalone"] && Bundler.settings[:path].nil? && !options["local"]
161
- Bundler.settings.temporary(path_relative_to_cwd: false) do
162
- Bundler.settings.set_command_option :path, "bundle"
163
- end
163
+ Bundler.settings.set_command_option :path, "bundle"
164
164
  end
165
165
 
166
166
  bin_option = options["binstubs"]
@@ -179,7 +179,7 @@ module Bundler
179
179
 
180
180
  normalize_groups if options[:without] || options[:with]
181
181
 
182
- options[:force] = options[:redownload]
182
+ options[:force] = options[:redownload] if options[:redownload]
183
183
  end
184
184
 
185
185
  def warn_ambiguous_gems
@@ -34,8 +34,8 @@ module Bundler
34
34
  end
35
35
 
36
36
  def doctor
37
- require_relative "doctor"
38
- Bundler::CLI::Doctor.new({}).run
37
+ require_relative "doctor/diagnose"
38
+ Bundler::CLI::Doctor::Diagnose.new({}).run
39
39
  end
40
40
  end
41
41
  end
@@ -44,7 +44,8 @@ module Bundler
44
44
 
45
45
  Bundler::CLI::Common.configure_gem_version_promoter(definition, options) if options[:update]
46
46
 
47
- options["remove-platform"].each do |platform|
47
+ options["remove-platform"].each do |platform_string|
48
+ platform = Gem::Platform.new(platform_string)
48
49
  definition.remove_platform(platform)
49
50
  end
50
51
 
@@ -155,7 +155,7 @@ module Bundler
155
155
 
156
156
  return active_spec if strict
157
157
 
158
- active_specs = active_spec.source.specs.search(current_spec.name).select {|spec| spec.match_platform(current_spec.platform) }.sort_by(&:version)
158
+ active_specs = active_spec.source.specs.search(current_spec.name).select {|spec| spec.installable_on_platform?(current_spec.platform) }.sort_by(&:version)
159
159
  if !current_spec.version.prerelease? && !options[:pre] && active_specs.size > 1
160
160
  active_specs.delete_if {|b| b.respond_to?(:version) && b.version.prerelease? }
161
161
  end
@@ -26,7 +26,7 @@ module Bundler
26
26
  if Bundler.feature_flag.update_requires_all_flag?
27
27
  raise InvalidOption, "To update everything, pass the `--all` flag."
28
28
  end
29
- SharedHelpers.major_deprecation 3, "Pass --all to `bundle update` to update everything"
29
+ SharedHelpers.major_deprecation 4, "Pass --all to `bundle update` to update everything"
30
30
  elsif !full_update && options[:all]
31
31
  raise InvalidOption, "Cannot specify --all along with specific options."
32
32
  end
@@ -63,7 +63,7 @@ module Bundler
63
63
  opts = options.dup
64
64
  opts["update"] = true
65
65
  opts["local"] = options[:local]
66
- opts["force"] = options[:redownload]
66
+ opts["force"] = options[:redownload] if options[:redownload]
67
67
 
68
68
  Bundler.settings.set_command_option_if_given :jobs, opts["jobs"]
69
69
 
@@ -92,7 +92,7 @@ module Bundler
92
92
  locked_spec = locked_info[:spec]
93
93
  new_spec = Bundler.definition.specs[name].first
94
94
  unless new_spec
95
- unless locked_spec.match_platform(Bundler.local_platform)
95
+ unless locked_spec.installable_on_platform?(Bundler.local_platform)
96
96
  Bundler.ui.warn "Bundler attempted to update #{name} but it was not considered because it is for a different platform from the current one"
97
97
  end
98
98