rubygems-update 3.1.0.pre3 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. checksums.yaml +4 -4
  2. data/.bundle/config +2 -0
  3. data/Gemfile +8 -0
  4. data/Gemfile.lock +43 -0
  5. data/History.txt +32 -0
  6. data/Manifest.txt +20 -3
  7. data/Rakefile +2 -6
  8. data/bundler/CHANGELOG.md +3 -3
  9. data/bundler/lib/bundler.rb +0 -1
  10. data/bundler/lib/bundler/build_metadata.rb +2 -0
  11. data/bundler/lib/bundler/cli.rb +4 -3
  12. data/bundler/lib/bundler/cli/config.rb +1 -1
  13. data/bundler/lib/bundler/cli/exec.rb +12 -3
  14. data/bundler/lib/bundler/cli/gem.rb +10 -1
  15. data/bundler/lib/bundler/cli/info.rb +7 -0
  16. data/bundler/lib/bundler/cli/list.rb +11 -9
  17. data/bundler/lib/bundler/cli/outdated.rb +86 -63
  18. data/bundler/lib/bundler/cli/pristine.rb +5 -0
  19. data/bundler/lib/bundler/cli/update.rb +1 -1
  20. data/bundler/lib/bundler/feature_flag.rb +1 -1
  21. data/bundler/lib/bundler/fetcher.rb +2 -2
  22. data/bundler/lib/bundler/fetcher/downloader.rb +1 -1
  23. data/bundler/lib/bundler/fetcher/index.rb +1 -1
  24. data/bundler/lib/bundler/friendly_errors.rb +1 -1
  25. data/bundler/lib/bundler/gem_helper.rb +12 -10
  26. data/bundler/lib/bundler/inline.rb +36 -31
  27. data/bundler/lib/bundler/lazy_specification.rb +0 -1
  28. data/bundler/lib/bundler/mirror.rb +3 -3
  29. data/bundler/lib/bundler/plugin/api/source.rb +2 -4
  30. data/bundler/lib/bundler/remote_specification.rb +0 -2
  31. data/bundler/lib/bundler/rubygems_integration.rb +5 -42
  32. data/bundler/lib/bundler/settings.rb +7 -4
  33. data/bundler/lib/bundler/source/git.rb +9 -9
  34. data/bundler/lib/bundler/source/git/git_proxy.rb +3 -2
  35. data/bundler/lib/bundler/source/rubygems.rb +3 -3
  36. data/bundler/lib/bundler/source/rubygems/remote.rb +1 -1
  37. data/bundler/lib/bundler/templates/newgem/Gemfile.tt +3 -0
  38. data/bundler/lib/bundler/templates/newgem/Rakefile.tt +10 -3
  39. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +2 -2
  40. data/bundler/lib/bundler/uri_credentials_filter.rb +7 -3
  41. data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +3 -3
  42. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +26 -26
  43. data/bundler/lib/bundler/vendor/thor/lib/thor.rb +7 -0
  44. data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +10 -6
  45. data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +29 -19
  46. data/bundler/lib/bundler/vendor/thor/lib/thor/nested_context.rb +29 -0
  47. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +1 -1
  48. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +13 -2
  49. data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +8 -9
  50. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +10 -1
  51. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +2 -2
  52. data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +17 -1
  53. data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  54. data/bundler/lib/bundler/vendor/uri/lib/uri.rb +104 -0
  55. data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +744 -0
  56. data/bundler/lib/bundler/vendor/uri/lib/uri/file.rb +94 -0
  57. data/bundler/lib/bundler/vendor/uri/lib/uri/ftp.rb +267 -0
  58. data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +1568 -0
  59. data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +88 -0
  60. data/bundler/lib/bundler/vendor/uri/lib/uri/https.rb +23 -0
  61. data/bundler/lib/bundler/vendor/uri/lib/uri/ldap.rb +261 -0
  62. data/bundler/lib/bundler/vendor/uri/lib/uri/ldaps.rb +21 -0
  63. data/bundler/lib/bundler/vendor/uri/lib/uri/mailto.rb +294 -0
  64. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +546 -0
  65. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +125 -0
  66. data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +6 -0
  67. data/bundler/lib/bundler/vendored_uri.rb +4 -0
  68. data/bundler/man/bundle-add.1 +1 -1
  69. data/bundler/man/bundle-add.1.txt +1 -1
  70. data/bundler/man/bundle-binstubs.1 +1 -1
  71. data/bundler/man/bundle-binstubs.1.txt +1 -1
  72. data/bundler/man/bundle-cache.1 +1 -1
  73. data/bundler/man/bundle-cache.1.txt +1 -1
  74. data/bundler/man/bundle-check.1 +1 -1
  75. data/bundler/man/bundle-check.1.txt +1 -1
  76. data/bundler/man/bundle-clean.1 +1 -1
  77. data/bundler/man/bundle-clean.1.txt +1 -1
  78. data/bundler/man/bundle-config.1 +1 -1
  79. data/bundler/man/bundle-config.1.txt +1 -1
  80. data/bundler/man/bundle-doctor.1 +1 -1
  81. data/bundler/man/bundle-doctor.1.txt +1 -1
  82. data/bundler/man/bundle-exec.1 +1 -1
  83. data/bundler/man/bundle-exec.1.txt +1 -1
  84. data/bundler/man/bundle-gem.1 +1 -1
  85. data/bundler/man/bundle-gem.1.txt +1 -1
  86. data/bundler/man/bundle-info.1 +1 -1
  87. data/bundler/man/bundle-info.1.txt +1 -1
  88. data/bundler/man/bundle-init.1 +1 -1
  89. data/bundler/man/bundle-init.1.txt +1 -1
  90. data/bundler/man/bundle-inject.1 +1 -1
  91. data/bundler/man/bundle-inject.1.txt +1 -1
  92. data/bundler/man/bundle-install.1 +1 -1
  93. data/bundler/man/bundle-install.1.txt +1 -1
  94. data/bundler/man/bundle-list.1 +7 -7
  95. data/bundler/man/bundle-list.1.txt +9 -8
  96. data/bundler/man/bundle-list.ronn +6 -6
  97. data/bundler/man/bundle-lock.1 +1 -1
  98. data/bundler/man/bundle-lock.1.txt +1 -1
  99. data/bundler/man/bundle-open.1 +1 -1
  100. data/bundler/man/bundle-open.1.txt +1 -1
  101. data/bundler/man/bundle-outdated.1 +1 -1
  102. data/bundler/man/bundle-outdated.1.txt +1 -1
  103. data/bundler/man/bundle-platform.1 +1 -1
  104. data/bundler/man/bundle-platform.1.txt +1 -1
  105. data/bundler/man/bundle-pristine.1 +1 -1
  106. data/bundler/man/bundle-pristine.1.txt +1 -1
  107. data/bundler/man/bundle-remove.1 +1 -1
  108. data/bundler/man/bundle-remove.1.txt +1 -1
  109. data/bundler/man/bundle-show.1 +1 -1
  110. data/bundler/man/bundle-show.1.txt +1 -1
  111. data/bundler/man/bundle-update.1 +1 -1
  112. data/bundler/man/bundle-update.1.txt +1 -1
  113. data/bundler/man/bundle-viz.1 +1 -1
  114. data/bundler/man/bundle-viz.1.txt +1 -1
  115. data/bundler/man/bundle.1 +1 -1
  116. data/bundler/man/bundle.1.txt +1 -1
  117. data/bundler/man/gemfile.5 +1 -1
  118. data/bundler/man/gemfile.5.txt +1 -1
  119. data/lib/rubygems.rb +5 -15
  120. data/lib/rubygems/command.rb +28 -6
  121. data/lib/rubygems/commands/generate_index_command.rb +3 -0
  122. data/lib/rubygems/commands/setup_command.rb +1 -1
  123. data/lib/rubygems/commands/sources_command.rb +14 -0
  124. data/lib/rubygems/core_ext/kernel_require.rb +1 -1
  125. data/lib/rubygems/core_ext/kernel_warn.rb +8 -4
  126. data/lib/rubygems/ext/builder.rb +1 -1
  127. data/lib/rubygems/remote_fetcher.rb +20 -31
  128. data/lib/rubygems/request.rb +2 -0
  129. data/lib/rubygems/source.rb +7 -1
  130. data/lib/rubygems/specification_policy.rb +44 -29
  131. data/lib/rubygems/uri_formatter.rb +0 -1
  132. data/lib/rubygems/uri_parser.rb +36 -0
  133. data/lib/rubygems/uri_parsing.rb +23 -0
  134. data/rubygems-update.gemspec +1 -8
  135. data/test/rubygems/test_gem.rb +3 -3
  136. data/test/rubygems/test_gem_command.rb +38 -9
  137. data/test/rubygems/test_gem_commands_generate_index_command.rb +37 -1
  138. data/test/rubygems/test_gem_commands_help_command.rb +1 -6
  139. data/test/rubygems/test_gem_commands_server_command.rb +6 -2
  140. data/test/rubygems/test_gem_commands_sources_command.rb +74 -0
  141. data/test/rubygems/test_gem_gem_runner.rb +3 -1
  142. data/test/rubygems/test_gem_indexer.rb +1 -1
  143. data/test/rubygems/test_gem_source.rb +14 -0
  144. data/test/rubygems/test_gem_specification.rb +48 -48
  145. data/test/rubygems/test_project_sanity.rb +0 -43
  146. data/test/rubygems/test_remote_fetch_error.rb +1 -1
  147. data/test/rubygems/test_require.rb +41 -42
  148. data/util/bisect +0 -21
  149. data/util/ci.sh +1 -1
  150. metadata +23 -90
  151. data/bundler/lib/bundler/gem_remote_fetcher.rb +0 -43
  152. data/bundler/lib/bundler/vendor/fileutils/lib/fileutils/version.rb +0 -5
  153. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +0 -12
@@ -19,6 +19,7 @@ class Gem::Request
19
19
  end
20
20
 
21
21
  def self.proxy_uri(proxy) # :nodoc:
22
+ require "uri"
22
23
  case proxy
23
24
  when :no_proxy then nil
24
25
  when URI::HTTP then proxy
@@ -173,6 +174,7 @@ class Gem::Request
173
174
  :no_proxy : get_proxy_from_env('http')
174
175
  end
175
176
 
177
+ require "uri"
176
178
  uri = URI(Gem::UriFormatter.new(env_proxy).normalize)
177
179
 
178
180
  if uri and uri.user.nil? and uri.password.nil?
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  autoload :FileUtils, 'fileutils'
3
- autoload :URI, 'uri'
4
3
 
4
+ require "rubygems/text"
5
5
  ##
6
6
  # A Source knows how to list and fetch gems from a RubyGems marshal index.
7
7
  #
@@ -11,6 +11,7 @@ autoload :URI, 'uri'
11
11
  class Gem::Source
12
12
 
13
13
  include Comparable
14
+ include Gem::Text
14
15
 
15
16
  FILES = { # :nodoc:
16
17
  :released => 'specs',
@@ -219,6 +220,11 @@ class Gem::Source
219
220
  end
220
221
  end
221
222
 
223
+ def typo_squatting?(host, distance_threshold=4)
224
+ return if @uri.host.nil?
225
+ levenshtein_distance(@uri.host, host) <= distance_threshold
226
+ end
227
+
222
228
  end
223
229
 
224
230
  require 'rubygems/source/git'
@@ -1,8 +1,6 @@
1
- require 'delegate'
2
- require 'uri'
3
1
  require 'rubygems/user_interaction'
4
2
 
5
- class Gem::SpecificationPolicy < SimpleDelegator
3
+ class Gem::SpecificationPolicy
6
4
 
7
5
  include Gem::UserInteraction
8
6
 
@@ -25,7 +23,7 @@ class Gem::SpecificationPolicy < SimpleDelegator
25
23
  def initialize(specification)
26
24
  @warnings = 0
27
25
 
28
- super(specification)
26
+ @specification = specification
29
27
  end
30
28
 
31
29
  ##
@@ -51,7 +49,7 @@ class Gem::SpecificationPolicy < SimpleDelegator
51
49
 
52
50
  validate_require_paths
53
51
 
54
- keep_only_files_and_directories
52
+ @specification.keep_only_files_and_directories
55
53
 
56
54
  validate_non_files
57
55
 
@@ -92,6 +90,8 @@ class Gem::SpecificationPolicy < SimpleDelegator
92
90
  # Implementation for Specification#validate_metadata
93
91
 
94
92
  def validate_metadata
93
+ metadata = @specification.metadata
94
+
95
95
  unless Hash === metadata
96
96
  error 'metadata must be a hash'
97
97
  end
@@ -130,7 +130,7 @@ class Gem::SpecificationPolicy < SimpleDelegator
130
130
 
131
131
  error_messages = []
132
132
  warning_messages = []
133
- dependencies.each do |dep|
133
+ @specification.dependencies.each do |dep|
134
134
  if prev = seen[dep.type][dep.name]
135
135
  error_messages << <<-MESSAGE
136
136
  duplicate dependency on #{dep}, (#{prev.requirement}) use:
@@ -145,7 +145,7 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
145
145
  end
146
146
 
147
147
  warning_messages << "prerelease dependency on #{dep} is not recommended" if
148
- prerelease_dep && !version.prerelease?
148
+ prerelease_dep && !@specification.version.prerelease?
149
149
 
150
150
  open_ended = dep.requirement.requirements.all? do |op, version|
151
151
  not version.prerelease? and (op == '>' or op == '>=')
@@ -190,14 +190,14 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
190
190
  def validate_permissions
191
191
  return if Gem.win_platform?
192
192
 
193
- files.each do |file|
193
+ @specification.files.each do |file|
194
194
  next unless File.file?(file)
195
195
  next if File.stat(file).mode & 0444 == 0444
196
196
  warning "#{file} is not world-readable"
197
197
  end
198
198
 
199
- executables.each do |name|
200
- exec = File.join bindir, name
199
+ @specification.executables.each do |name|
200
+ exec = File.join @specification.bindir, name
201
201
  next unless File.file?(exec)
202
202
  next if File.stat(exec).executable?
203
203
  warning "#{exec} is not executable"
@@ -208,7 +208,7 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
208
208
 
209
209
  def validate_nil_attributes
210
210
  nil_attributes = Gem::Specification.non_nil_attributes.select do |attrname|
211
- __getobj__.instance_variable_get("@#{attrname}").nil?
211
+ @specification.instance_variable_get("@#{attrname}").nil?
212
212
  end
213
213
  return if nil_attributes.empty?
214
214
  error "#{nil_attributes.join ', '} must not be nil"
@@ -216,6 +216,9 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
216
216
 
217
217
  def validate_rubygems_version
218
218
  return unless packaging
219
+
220
+ rubygems_version = @specification.rubygems_version
221
+
219
222
  return if rubygems_version == Gem::VERSION
220
223
 
221
224
  error "expected RubyGems version #{Gem::VERSION}, was #{rubygems_version}"
@@ -223,13 +226,15 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
223
226
 
224
227
  def validate_required_attributes
225
228
  Gem::Specification.required_attributes.each do |symbol|
226
- unless send symbol
229
+ unless @specification.send symbol
227
230
  error "missing value for attribute #{symbol}"
228
231
  end
229
232
  end
230
233
  end
231
234
 
232
235
  def validate_name
236
+ name = @specification.name
237
+
233
238
  if !name.is_a?(String)
234
239
  error "invalid value for attribute name: \"#{name.inspect}\" must be a string"
235
240
  elsif name !~ /[a-zA-Z]/
@@ -242,14 +247,15 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
242
247
  end
243
248
 
244
249
  def validate_require_paths
245
- return unless raw_require_paths.empty?
250
+ return unless @specification.raw_require_paths.empty?
246
251
 
247
252
  error 'specification must have at least one require_path'
248
253
  end
249
254
 
250
255
  def validate_non_files
251
256
  return unless packaging
252
- non_files = files.reject {|x| File.file?(x) || File.symlink?(x)}
257
+
258
+ non_files = @specification.files.reject {|x| File.file?(x) || File.symlink?(x)}
253
259
 
254
260
  unless non_files.empty?
255
261
  error "[\"#{non_files.join "\", \""}\"] are not files"
@@ -257,18 +263,22 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
257
263
  end
258
264
 
259
265
  def validate_self_inclusion_in_files_list
260
- return unless files.include?(file_name)
266
+ file_name = @specification.file_name
261
267
 
262
- error "#{full_name} contains itself (#{file_name}), check your files list"
268
+ return unless @specification.files.include?(file_name)
269
+
270
+ error "#{@specification.full_name} contains itself (#{file_name}), check your files list"
263
271
  end
264
272
 
265
273
  def validate_specification_version
266
- return if specification_version.is_a?(Integer)
274
+ return if @specification.specification_version.is_a?(Integer)
267
275
 
268
276
  error 'specification_version must be an Integer (did you mean version?)'
269
277
  end
270
278
 
271
279
  def validate_platform
280
+ platform = @specification.platform
281
+
272
282
  case platform
273
283
  when Gem::Platform, Gem::Platform::RUBY # ok
274
284
  else
@@ -283,7 +293,7 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
283
293
  end
284
294
 
285
295
  def validate_array_attribute(field)
286
- val = self.send(field)
296
+ val = @specification.send(field)
287
297
  klass = case field
288
298
  when :dependencies then
289
299
  Gem::Dependency
@@ -298,12 +308,14 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
298
308
  end
299
309
 
300
310
  def validate_authors_field
301
- return unless authors.empty?
311
+ return unless @specification.authors.empty?
302
312
 
303
313
  error "authors may not be empty"
304
314
  end
305
315
 
306
316
  def validate_licenses
317
+ licenses = @specification.licenses
318
+
307
319
  licenses.each do |license|
308
320
  if license.length > 64
309
321
  error "each license must be 64 characters or less"
@@ -331,24 +343,27 @@ http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard li
331
343
  HOMEPAGE_URI_PATTERN = /\A[a-z][a-z\d+.-]*:/i.freeze
332
344
 
333
345
  def validate_lazy_metadata
334
- unless authors.grep(LAZY_PATTERN).empty?
346
+ unless @specification.authors.grep(LAZY_PATTERN).empty?
335
347
  error "#{LAZY} is not an author"
336
348
  end
337
349
 
338
- unless Array(email).grep(LAZY_PATTERN).empty?
350
+ unless Array(@specification.email).grep(LAZY_PATTERN).empty?
339
351
  error "#{LAZY} is not an email"
340
352
  end
341
353
 
342
- if description =~ LAZY_PATTERN
354
+ if @specification.description =~ LAZY_PATTERN
343
355
  error "#{LAZY} is not a description"
344
356
  end
345
357
 
346
- if summary =~ LAZY_PATTERN
358
+ if @specification.summary =~ LAZY_PATTERN
347
359
  error "#{LAZY} is not a summary"
348
360
  end
349
361
 
362
+ homepage = @specification.homepage
363
+
350
364
  # Make sure a homepage is valid HTTP/HTTPS URI
351
365
  if homepage and not homepage.empty?
366
+ require 'uri'
352
367
  begin
353
368
  homepage_uri = URI.parse(homepage)
354
369
  unless [URI::HTTP, URI::HTTPS].member? homepage_uri.class
@@ -365,29 +380,29 @@ http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard li
365
380
  validate_attribute_present(attribute)
366
381
  end
367
382
 
368
- if description == summary
383
+ if @specification.description == @specification.summary
369
384
  warning "description and summary are identical"
370
385
  end
371
386
 
372
387
  # TODO: raise at some given date
373
- warning "deprecated autorequire specified" if autorequire
388
+ warning "deprecated autorequire specified" if @specification.autorequire
374
389
 
375
- executables.each do |executable|
390
+ @specification.executables.each do |executable|
376
391
  validate_shebang_line_in(executable)
377
392
  end
378
393
 
379
- files.select { |f| File.symlink?(f) }.each do |file|
394
+ @specification.files.select { |f| File.symlink?(f) }.each do |file|
380
395
  warning "#{file} is a symlink, which is not supported on all platforms"
381
396
  end
382
397
  end
383
398
 
384
399
  def validate_attribute_present(attribute)
385
- value = self.send attribute
400
+ value = @specification.send attribute
386
401
  warning("no #{attribute} specified") if value.nil? || value.empty?
387
402
  end
388
403
 
389
404
  def validate_shebang_line_in(executable)
390
- executable_path = File.join(bindir, executable)
405
+ executable_path = File.join(@specification.bindir, executable)
391
406
  return if File.read(executable_path, 2) == '#!'
392
407
 
393
408
  warning "#{executable_path} is missing #! line"
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  require 'cgi'
3
- require 'uri'
4
3
 
5
4
  ##
6
5
  # The UriFormatter handles URIs from user-input and escaping.
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ ##
4
+ # The UriParser handles parsing URIs.
5
+ #
6
+
7
+ class Gem::UriParser
8
+
9
+ ##
10
+ # Parses the #uri, raising if it's invalid
11
+
12
+ def parse!(uri)
13
+ raise URI::InvalidURIError unless uri
14
+
15
+ # Always escape URI's to deal with potential spaces and such
16
+ # It should also be considered that source_uri may already be
17
+ # a valid URI with escaped characters. e.g. "{DESede}" is encoded
18
+ # as "%7BDESede%7D". If this is escaped again the percentage
19
+ # symbols will be escaped.
20
+ begin
21
+ URI.parse(uri)
22
+ rescue URI::InvalidURIError
23
+ URI.parse(URI::DEFAULT_PARSER.escape(uri))
24
+ end
25
+ end
26
+
27
+ ##
28
+ # Parses the #uri, returning the original uri if it's invalid
29
+
30
+ def parse(uri)
31
+ parse!(uri)
32
+ rescue URI::InvalidURIError
33
+ uri
34
+ end
35
+
36
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rubygems/uri_parser"
4
+
5
+ module Gem::UriParsing
6
+
7
+ def parse_uri(source_uri)
8
+ return source_uri unless source_uri.is_a?(String)
9
+
10
+ uri_parser.parse(source_uri)
11
+ end
12
+
13
+ private :parse_uri
14
+
15
+ def uri_parser
16
+ require "uri"
17
+
18
+ Gem::UriParser.new
19
+ end
20
+
21
+ private :uri_parser
22
+
23
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "rubygems-update"
5
- s.version = "3.1.0.pre3"
5
+ s.version = "3.1.0"
6
6
  s.authors = ["Jim Weirich", "Chad Fowler", "Eric Hodel", "Luis Lavena", "Aaron Patterson", "Samuel Giddins", "André Arko", "Evan Phoenix", "Hiroshi SHIBATA"]
7
7
  s.email = ["", "", "drbrain@segment7.net", "luislavena@gmail.com", "aaron@tenderlovemaking.com", "segiddins@segiddins.me", "andre@arko.net", "evan@phx.io", "hsbt@ruby-lang.org"]
8
8
 
@@ -33,11 +33,4 @@ Gem::Specification.new do |s|
33
33
  s.required_rubygems_version = Gem::Requirement.new(">= 0")
34
34
 
35
35
  s.specification_version = 4
36
-
37
- s.add_development_dependency(%q<builder>, ["~> 3.0"])
38
- s.add_development_dependency(%q<rdoc>, ["~> 6.0"])
39
- s.add_development_dependency(%q<rake>, ["~> 12.0"])
40
- s.add_development_dependency(%q<minitest>, ["~> 5.0"])
41
- s.add_development_dependency(%q<simplecov>, ["~> 0"])
42
- s.add_development_dependency(%q<rubocop>, ["~> 0.74.0"])
43
36
  end
@@ -226,7 +226,7 @@ class TestGem < Gem::TestCase
226
226
  def test_require_missing
227
227
  save_loaded_features do
228
228
  assert_raises ::LoadError do
229
- require "q"
229
+ require "test_require_missing"
230
230
  end
231
231
  end
232
232
  end
@@ -1388,7 +1388,7 @@ class TestGem < Gem::TestCase
1388
1388
  a = util_spec "a", "1"
1389
1389
  b = util_spec "b", "1", "c" => nil
1390
1390
  c = util_spec "c", "2"
1391
- d = util_spec "d", "1", {'e' => '= 1'}, "lib/d.rb"
1391
+ d = util_spec "d", "1", {'e' => '= 1'}, "lib/d#{$$}.rb"
1392
1392
  e = util_spec "e", "1"
1393
1393
 
1394
1394
  install_specs a, c, b, e, d
@@ -1397,7 +1397,7 @@ class TestGem < Gem::TestCase
1397
1397
  r.gem "a"
1398
1398
  r.gem "b", "= 1"
1399
1399
 
1400
- require 'd'
1400
+ require "d#{$$}"
1401
1401
  end
1402
1402
 
1403
1403
  assert_equal %w!a-1 b-1 c-2 d-1 e-1!, loaded_spec_names
@@ -197,9 +197,9 @@ class TestGemCommand < Gem::TestCase
197
197
  assert_equal ['-h', 'command'], args
198
198
  end
199
199
 
200
- def test_deprecate_option_long_name
200
+ def test_deprecate_option
201
201
  deprecate_msg = <<-EXPECTED
202
- WARNING: The \"--test\" option has been deprecated and will be removed in Rubygems 3.1, its use is discouraged.
202
+ WARNING: The \"--test\" option has been deprecated and will be removed in Rubygems 3.1.
203
203
  EXPECTED
204
204
 
205
205
  testCommand = Class.new(Gem::Command) do
@@ -210,7 +210,7 @@ WARNING: The \"--test\" option has been deprecated and will be removed in Rubyg
210
210
  options[:test] = true
211
211
  end
212
212
 
213
- deprecate_option(long_name: '--test', version: '3.1')
213
+ deprecate_option('--test', version: '3.1')
214
214
  end
215
215
 
216
216
  def execute
@@ -228,7 +228,7 @@ WARNING: The \"--test\" option has been deprecated and will be removed in Rubyg
228
228
 
229
229
  def test_deprecate_option_no_version
230
230
  deprecate_msg = <<-EXPECTED
231
- WARNING: The \"--test\" option has been deprecated and will be removed in future versions of Rubygems, its use is discouraged.
231
+ WARNING: The \"--test\" option has been deprecated and will be removed in future versions of Rubygems.
232
232
  EXPECTED
233
233
 
234
234
  testCommand = Class.new(Gem::Command) do
@@ -239,7 +239,7 @@ WARNING: The \"--test\" option has been deprecated and will be removed in futur
239
239
  options[:test] = true
240
240
  end
241
241
 
242
- deprecate_option(long_name: '--test')
242
+ deprecate_option('--test')
243
243
  end
244
244
 
245
245
  def execute
@@ -255,9 +255,9 @@ WARNING: The \"--test\" option has been deprecated and will be removed in futur
255
255
  end
256
256
  end
257
257
 
258
- def test_deprecate_option_short_name
258
+ def test_deprecate_option_extra_message
259
259
  deprecate_msg = <<-EXPECTED
260
- WARNING: The \"-t\" option has been deprecated and will be removed in Rubygems 3.5, its use is discouraged.
260
+ WARNING: The \"--test\" option has been deprecated and will be removed in Rubygems 3.1. Whether you set `--test` mode or not, this dummy app always runs in test mode.
261
261
  EXPECTED
262
262
 
263
263
  testCommand = Class.new(Gem::Command) do
@@ -268,7 +268,7 @@ WARNING: The \"-t\" option has been deprecated and will be removed in Rubygems
268
268
  options[:test] = true
269
269
  end
270
270
 
271
- deprecate_option(short_name: '-t', version: '3.5')
271
+ deprecate_option('--test', version: '3.1', extra_msg: 'Whether you set `--test` mode or not, this dummy app always runs in test mode.')
272
272
  end
273
273
 
274
274
  def execute
@@ -279,7 +279,36 @@ WARNING: The \"-t\" option has been deprecated and will be removed in Rubygems
279
279
  cmd = testCommand.new
280
280
 
281
281
  use_ui @ui do
282
- cmd.invoke("-t")
282
+ cmd.invoke("--test")
283
+ assert_equal deprecate_msg, @ui.error
284
+ end
285
+ end
286
+
287
+ def test_deprecate_option_extra_message_and_no_version
288
+ deprecate_msg = <<-EXPECTED
289
+ WARNING: The \"--test\" option has been deprecated and will be removed in future versions of Rubygems. Whether you set `--test` mode or not, this dummy app always runs in test mode.
290
+ EXPECTED
291
+
292
+ testCommand = Class.new(Gem::Command) do
293
+ def initialize
294
+ super('test', 'Gem::Command instance for testing')
295
+
296
+ add_option('-t', '--test', 'Test command') do |value, options|
297
+ options[:test] = true
298
+ end
299
+
300
+ deprecate_option('--test', extra_msg: 'Whether you set `--test` mode or not, this dummy app always runs in test mode.')
301
+ end
302
+
303
+ def execute
304
+ true
305
+ end
306
+ end
307
+
308
+ cmd = testCommand.new
309
+
310
+ use_ui @ui do
311
+ cmd.invoke("--test")
283
312
  assert_equal deprecate_msg, @ui.error
284
313
  end
285
314
  end