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,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 = []
112
- files_not_readable_and_owned_by_different_user = []
113
- files_not_owned_by_current_user_but_still_readable = []
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.readable?(f)
119
- if File.stat(f).uid != Process.uid
120
- files_not_readable_and_owned_by_different_user << f
121
- else
122
- files_not_readable << f
123
- end
124
- elsif File.stat(f).uid != Process.uid
125
- files_not_owned_by_current_user_but_still_readable << 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_readable.any?
138
- Bundler.ui.warn "Files exist in the Bundler home that are owned by another " \
139
- "user, but are still readable. These files are:\n - #{files_not_owned_by_current_user_but_still_readable.join("\n - ")}"
140
-
141
- ok = false
142
- end
143
-
144
- if files_not_readable_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. These files are:\n - #{files_not_readable_and_owned_by_different_user.join("\n - ")}"
147
-
148
- ok = false
149
- end
150
-
151
- if files_not_readable.any?
152
- Bundler.ui.warn "Files exist in the Bundler home that are not " \
153
- "readable by the current user. These files are:\n - #{files_not_readable.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
@@ -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"]
@@ -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
@@ -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
@@ -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
 
@@ -77,7 +77,7 @@ module Bundler
77
77
  self.options ||= {}
78
78
  unprinted_warnings = Bundler.ui.unprinted_warnings
79
79
  Bundler.ui = UI::Shell.new(options)
80
- Bundler.ui.level = "debug" if options["verbose"]
80
+ Bundler.ui.level = "debug" if options[:verbose] || Bundler.settings[:verbose]
81
81
  unprinted_warnings.each {|w| Bundler.ui.warn(w) }
82
82
  end
83
83
 
@@ -130,7 +130,7 @@ module Bundler
130
130
 
131
131
  if man_pages.include?(command)
132
132
  man_page = man_pages[command]
133
- if Bundler.which("man") && !man_path.match?(%r{^file:/.+!/META-INF/jruby.home/.+})
133
+ if Bundler.which("man") && !man_path.match?(%r{^(?:file:/.+!|uri:classloader:)/META-INF/jruby.home/.+})
134
134
  Kernel.exec("man", man_page)
135
135
  else
136
136
  puts File.read("#{man_path}/#{File.basename(man_page)}.ronn")
@@ -486,13 +486,13 @@ module Bundler
486
486
  def version
487
487
  cli_help = current_command.name == "cli_help"
488
488
  if cli_help || ARGV.include?("version")
489
- build_info = " (#{BuildMetadata.built_at} commit #{BuildMetadata.git_commit_sha})"
489
+ build_info = " (#{BuildMetadata.timestamp} commit #{BuildMetadata.git_commit_sha})"
490
490
  end
491
491
 
492
- if !cli_help && Bundler.feature_flag.print_only_version_number?
493
- Bundler.ui.info "#{Bundler::VERSION}#{build_info}"
492
+ if !cli_help && Bundler.feature_flag.bundler_4_mode?
493
+ Bundler.ui.info "#{Bundler.verbose_version}#{build_info}"
494
494
  else
495
- Bundler.ui.info "Bundler version #{Bundler::VERSION}#{build_info}"
495
+ Bundler.ui.info "Bundler version #{Bundler.verbose_version}#{build_info}"
496
496
  end
497
497
  end
498
498
 
@@ -512,7 +512,7 @@ module Bundler
512
512
  end
513
513
  end
514
514
 
515
- unless Bundler.feature_flag.bundler_3_mode?
515
+ unless Bundler.feature_flag.bundler_4_mode?
516
516
  desc "viz [OPTIONS]", "Generates a visual dependency graph", hide: true
517
517
  long_desc <<-D
518
518
  Viz generates a PNG file of the current Gemfile as a dependency graph.
@@ -544,6 +544,7 @@ module Bundler
544
544
  method_option :ci, type: :string, lazy_default: Bundler.settings["gem.ci"] || "", enum: %w[github gitlab circle], desc: "Generate CI configuration, either GitHub Actions, GitLab CI or CircleCI. Set a default with `bundle config set --global gem.ci (github|gitlab|circle)`"
545
545
  method_option :linter, type: :string, lazy_default: Bundler.settings["gem.linter"] || "", enum: %w[rubocop standard], desc: "Add a linter and code formatter, either RuboCop or Standard. Set a default with `bundle config set --global gem.linter (rubocop|standard)`"
546
546
  method_option :github_username, type: :string, default: Bundler.settings["gem.github_username"], banner: "Set your username on GitHub", desc: "Fill in GitHub username on README so that you don't have to do it manually. Set a default with `bundle config set --global gem.github_username <your_username>`."
547
+ method_option :bundle, type: :boolean, default: Bundler.settings["gem.bundle"], desc: "Automatically run `bundle install` after creation. Set a default with `bundle config set --global gem.bundle true`"
547
548
 
548
549
  def gem(name)
549
550
  require_relative "cli/gem"
@@ -610,17 +611,8 @@ module Bundler
610
611
  end
611
612
 
612
613
  desc "doctor [OPTIONS]", "Checks the bundle for common problems"
613
- long_desc <<-D
614
- Doctor scans the OS dependencies of each of the gems requested in the Gemfile. If
615
- missing dependencies are detected, Bundler prints them and exits status 1.
616
- Otherwise, Bundler prints a success message and exits with a status of 0.
617
- D
618
- method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile"
619
- method_option "quiet", type: :boolean, banner: "Only output warnings and errors."
620
- def doctor
621
- require_relative "cli/doctor"
622
- Doctor.new(options).run
623
- end
614
+ require_relative "cli/doctor"
615
+ subcommand("doctor", Doctor)
624
616
 
625
617
  desc "issue", "Learn how to report an issue in Bundler"
626
618
  def issue
@@ -722,14 +714,9 @@ module Bundler
722
714
  command_name = cmd.name
723
715
  return if PARSEABLE_COMMANDS.include?(command_name)
724
716
  command = ["bundle", command_name] + args
725
- options_to_print = options.dup
726
- options_to_print.delete_if do |k, v|
727
- next unless o = cmd.options[k]
728
- o.default == v
729
- end
730
- command << Thor::Options.to_switches(options_to_print.sort_by(&:first)).strip
717
+ command << Thor::Options.to_switches(options.sort_by(&:first)).strip
731
718
  command.reject!(&:empty?)
732
- Bundler.ui.info "Running `#{command * " "}` with bundler #{Bundler::VERSION}"
719
+ Bundler.ui.info "Running `#{command * " "}` with bundler #{Bundler.verbose_version}"
733
720
  end
734
721
 
735
722
  def warn_on_outdated_bundler
@@ -28,11 +28,7 @@ module Bundler
28
28
  # It may be called concurrently without global interpreter lock in some Rubies.
29
29
  # As a result, some methods may look more complex than necessary to save memory or time.
30
30
  class CompactIndexClient
31
- # NOTE: MD5 is here not because we expect a server to respond with it, but
32
- # because we use it to generate the etag on first request during the upgrade
33
- # to the compact index client that uses opaque etags saved to files.
34
- # Remove once 2.5.0 has been out for a while.
35
- SUPPORTED_DIGESTS = { "sha-256" => :SHA256, "md5" => :MD5 }.freeze
31
+ SUPPORTED_DIGESTS = { "sha-256" => :SHA256 }.freeze
36
32
  DEBUG_MUTEX = Thread::Mutex.new
37
33
 
38
34
  # info returns an Array of INFO Arrays. Each INFO Array has the following indices:
@@ -32,7 +32,7 @@ module Bundler
32
32
  end.freeze
33
33
 
34
34
  def ruby?
35
- return true if Bundler::GemHelpers.generic_local_platform_is_ruby?
35
+ return true if Bundler::MatchPlatform.generic_local_platform_is_ruby?
36
36
 
37
37
  !windows? && (RUBY_ENGINE == "ruby" || RUBY_ENGINE == "rbx" || RUBY_ENGINE == "maglev" || RUBY_ENGINE == "truffleruby")
38
38
  end
@@ -50,6 +50,18 @@ module Bundler
50
50
  end
51
51
 
52
52
  def maglev?
53
+ message =
54
+ "`CurrentRuby#maglev?` is deprecated with no replacement. Please use the " \
55
+ "built-in Ruby `RUBY_ENGINE` constant to check the Ruby implementation you are running on."
56
+ removed_message =
57
+ "`CurrentRuby#maglev?` was removed with no replacement. Please use the " \
58
+ "built-in Ruby `RUBY_ENGINE` constant to check the Ruby implementation you are running on."
59
+ internally_exempted = caller_locations(1, 1).first.path == __FILE__
60
+
61
+ unless internally_exempted
62
+ SharedHelpers.major_deprecation(2, message, removed_message: removed_message, print_caller_location: true)
63
+ end
64
+
53
65
  RUBY_ENGINE == "maglev"
54
66
  end
55
67
 
@@ -71,12 +83,24 @@ module Bundler
71
83
  RUBY_VERSION.start_with?("#{version}.")
72
84
  end
73
85
 
74
- all_platforms = PLATFORM_MAP.keys << "maglev"
75
- all_platforms.each do |platform|
86
+ PLATFORM_MAP.keys.each do |platform|
76
87
  define_method(:"#{platform}_#{trimmed_version}?") do
77
88
  send(:"#{platform}?") && send(:"on_#{trimmed_version}?")
78
89
  end
79
90
  end
91
+
92
+ define_method(:"maglev_#{trimmed_version}?") do
93
+ message =
94
+ "`CurrentRuby##{__method__}` is deprecated with no replacement. Please use the " \
95
+ "built-in Ruby `RUBY_ENGINE` and `RUBY_VERSION` constants to perform a similar check."
96
+ removed_message =
97
+ "`CurrentRuby##{__method__}` was removed with no replacement. Please use the " \
98
+ "built-in Ruby `RUBY_ENGINE` and `RUBY_VERSION` constants to perform a similar check."
99
+
100
+ SharedHelpers.major_deprecation(2, message, removed_message: removed_message, print_caller_location: true)
101
+
102
+ send(:"maglev?") && send(:"on_#{trimmed_version}?")
103
+ end
80
104
  end
81
105
  end
82
106
  end