rubygems-update 3.1.0.pre3 → 3.1.4

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 (171) hide show
  1. checksums.yaml +4 -4
  2. data/.bundle/config +2 -0
  3. data/CONTRIBUTING.md +1 -1
  4. data/Gemfile +8 -0
  5. data/Gemfile.lock +43 -0
  6. data/History.txt +97 -2
  7. data/Manifest.txt +21 -3
  8. data/README.md +4 -4
  9. data/Rakefile +11 -10
  10. data/bin/update_rubygems +1 -1
  11. data/bundler/CHANGELOG.md +56 -3
  12. data/bundler/lib/bundler.rb +0 -1
  13. data/bundler/lib/bundler/build_metadata.rb +2 -0
  14. data/bundler/lib/bundler/cli.rb +1 -1
  15. data/bundler/lib/bundler/cli/config.rb +1 -1
  16. data/bundler/lib/bundler/cli/install.rb +3 -2
  17. data/bundler/lib/bundler/cli/update.rb +1 -1
  18. data/bundler/lib/bundler/feature_flag.rb +1 -1
  19. data/bundler/lib/bundler/fetcher.rb +2 -2
  20. data/bundler/lib/bundler/fetcher/downloader.rb +1 -1
  21. data/bundler/lib/bundler/fetcher/index.rb +1 -1
  22. data/bundler/lib/bundler/friendly_errors.rb +1 -1
  23. data/bundler/lib/bundler/gem_helper.rb +13 -12
  24. data/bundler/lib/bundler/inline.rb +36 -31
  25. data/bundler/lib/bundler/lazy_specification.rb +0 -1
  26. data/bundler/lib/bundler/mirror.rb +3 -3
  27. data/bundler/lib/bundler/plugin/api/source.rb +2 -4
  28. data/bundler/lib/bundler/remote_specification.rb +0 -2
  29. data/bundler/lib/bundler/rubygems_integration.rb +15 -13
  30. data/bundler/lib/bundler/settings.rb +7 -4
  31. data/bundler/lib/bundler/setup.rb +5 -0
  32. data/bundler/lib/bundler/source/git.rb +5 -5
  33. data/bundler/lib/bundler/source/git/git_proxy.rb +3 -2
  34. data/bundler/lib/bundler/source/rubygems.rb +3 -3
  35. data/bundler/lib/bundler/source/rubygems/remote.rb +1 -1
  36. data/bundler/lib/bundler/uri_credentials_filter.rb +7 -3
  37. data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +3 -3
  38. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +26 -48
  39. data/bundler/lib/bundler/vendor/thor/lib/thor.rb +7 -0
  40. data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +10 -6
  41. data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +29 -19
  42. data/bundler/lib/bundler/vendor/thor/lib/thor/nested_context.rb +29 -0
  43. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +1 -1
  44. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +13 -2
  45. data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +8 -9
  46. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +10 -1
  47. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +2 -2
  48. data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +17 -1
  49. data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  50. data/bundler/lib/bundler/vendor/uri/lib/uri.rb +104 -0
  51. data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +744 -0
  52. data/bundler/lib/bundler/vendor/uri/lib/uri/file.rb +94 -0
  53. data/bundler/lib/bundler/vendor/uri/lib/uri/ftp.rb +267 -0
  54. data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +1568 -0
  55. data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +88 -0
  56. data/bundler/lib/bundler/vendor/uri/lib/uri/https.rb +23 -0
  57. data/bundler/lib/bundler/vendor/uri/lib/uri/ldap.rb +261 -0
  58. data/bundler/lib/bundler/vendor/uri/lib/uri/ldaps.rb +21 -0
  59. data/bundler/lib/bundler/vendor/uri/lib/uri/mailto.rb +294 -0
  60. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +546 -0
  61. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +125 -0
  62. data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +6 -0
  63. data/bundler/lib/bundler/vendored_uri.rb +4 -0
  64. data/bundler/lib/bundler/version.rb +1 -1
  65. data/bundler/man/bundle-add.1 +1 -1
  66. data/bundler/man/bundle-add.1.txt +1 -1
  67. data/bundler/man/bundle-binstubs.1 +1 -1
  68. data/bundler/man/bundle-binstubs.1.txt +1 -1
  69. data/bundler/man/bundle-cache.1 +1 -1
  70. data/bundler/man/bundle-cache.1.txt +1 -1
  71. data/bundler/man/bundle-check.1 +1 -1
  72. data/bundler/man/bundle-check.1.txt +1 -1
  73. data/bundler/man/bundle-clean.1 +1 -1
  74. data/bundler/man/bundle-clean.1.txt +1 -1
  75. data/bundler/man/bundle-config.1 +1 -1
  76. data/bundler/man/bundle-config.1.txt +1 -1
  77. data/bundler/man/bundle-doctor.1 +1 -1
  78. data/bundler/man/bundle-doctor.1.txt +1 -1
  79. data/bundler/man/bundle-exec.1 +1 -1
  80. data/bundler/man/bundle-exec.1.txt +1 -1
  81. data/bundler/man/bundle-gem.1 +1 -1
  82. data/bundler/man/bundle-gem.1.txt +1 -1
  83. data/bundler/man/bundle-info.1 +1 -1
  84. data/bundler/man/bundle-info.1.txt +1 -1
  85. data/bundler/man/bundle-init.1 +1 -1
  86. data/bundler/man/bundle-init.1.txt +1 -1
  87. data/bundler/man/bundle-inject.1 +1 -1
  88. data/bundler/man/bundle-inject.1.txt +1 -1
  89. data/bundler/man/bundle-install.1 +1 -1
  90. data/bundler/man/bundle-install.1.txt +1 -1
  91. data/bundler/man/bundle-list.1 +1 -1
  92. data/bundler/man/bundle-list.1.txt +1 -1
  93. data/bundler/man/bundle-lock.1 +1 -1
  94. data/bundler/man/bundle-lock.1.txt +1 -1
  95. data/bundler/man/bundle-open.1 +1 -1
  96. data/bundler/man/bundle-open.1.txt +1 -1
  97. data/bundler/man/bundle-outdated.1 +1 -1
  98. data/bundler/man/bundle-outdated.1.txt +1 -1
  99. data/bundler/man/bundle-platform.1 +1 -1
  100. data/bundler/man/bundle-platform.1.txt +1 -1
  101. data/bundler/man/bundle-pristine.1 +1 -1
  102. data/bundler/man/bundle-pristine.1.txt +1 -1
  103. data/bundler/man/bundle-remove.1 +1 -1
  104. data/bundler/man/bundle-remove.1.txt +1 -1
  105. data/bundler/man/bundle-show.1 +1 -1
  106. data/bundler/man/bundle-show.1.txt +1 -1
  107. data/bundler/man/bundle-update.1 +1 -1
  108. data/bundler/man/bundle-update.1.txt +1 -1
  109. data/bundler/man/bundle-viz.1 +1 -1
  110. data/bundler/man/bundle-viz.1.txt +1 -1
  111. data/bundler/man/bundle.1 +1 -1
  112. data/bundler/man/bundle.1.txt +1 -1
  113. data/bundler/man/gemfile.5 +1 -1
  114. data/bundler/man/gemfile.5.txt +1 -1
  115. data/lib/rubygems.rb +64 -47
  116. data/lib/rubygems/basic_specification.rb +1 -1
  117. data/lib/rubygems/command.rb +29 -7
  118. data/lib/rubygems/commands/generate_index_command.rb +3 -0
  119. data/lib/rubygems/commands/help_command.rb +1 -1
  120. data/lib/rubygems/commands/setup_command.rb +30 -15
  121. data/lib/rubygems/commands/sources_command.rb +17 -3
  122. data/lib/rubygems/commands/uninstall_command.rb +1 -1
  123. data/lib/rubygems/core_ext/kernel_require.rb +1 -1
  124. data/lib/rubygems/core_ext/kernel_warn.rb +8 -4
  125. data/lib/rubygems/ext/builder.rb +4 -2
  126. data/lib/rubygems/remote_fetcher.rb +20 -31
  127. data/lib/rubygems/request.rb +2 -0
  128. data/lib/rubygems/request_set/gem_dependency_api.rb +1 -1
  129. data/lib/rubygems/resolver/api_set.rb +1 -1
  130. data/lib/rubygems/resolver/api_specification.rb +1 -1
  131. data/lib/rubygems/server.rb +1 -1
  132. data/lib/rubygems/source.rb +7 -1
  133. data/lib/rubygems/source_list.rb +2 -0
  134. data/lib/rubygems/specification.rb +12 -8
  135. data/lib/rubygems/specification_policy.rb +53 -30
  136. data/lib/rubygems/test_case.rb +60 -0
  137. data/lib/rubygems/uri_formatter.rb +0 -1
  138. data/lib/rubygems/uri_parser.rb +36 -0
  139. data/lib/rubygems/uri_parsing.rb +23 -0
  140. data/lib/rubygems/util.rb +7 -1
  141. data/lib/rubygems/version.rb +1 -1
  142. data/rubygems-update.gemspec +1 -8
  143. data/test/rubygems/specifications/rubyforge-0.0.1.gemspec +14 -0
  144. data/test/rubygems/test_gem.rb +90 -46
  145. data/test/rubygems/test_gem_command.rb +38 -9
  146. data/test/rubygems/test_gem_commands_build_command.rb +18 -1
  147. data/test/rubygems/test_gem_commands_generate_index_command.rb +37 -1
  148. data/test/rubygems/test_gem_commands_help_command.rb +1 -6
  149. data/test/rubygems/test_gem_commands_server_command.rb +6 -2
  150. data/test/rubygems/test_gem_commands_setup_command.rb +56 -10
  151. data/test/rubygems/test_gem_commands_sources_command.rb +113 -1
  152. data/test/rubygems/test_gem_commands_uninstall_command.rb +1 -0
  153. data/test/rubygems/test_gem_gem_runner.rb +3 -1
  154. data/test/rubygems/test_gem_indexer.rb +1 -1
  155. data/test/rubygems/test_gem_installer.rb +10 -23
  156. data/test/rubygems/test_gem_package.rb +3 -8
  157. data/test/rubygems/test_gem_package_tar_writer.rb +5 -0
  158. data/test/rubygems/test_gem_request_set.rb +52 -0
  159. data/test/rubygems/test_gem_source.rb +14 -0
  160. data/test/rubygems/test_gem_specification.rb +74 -54
  161. data/test/rubygems/test_gem_stub_specification.rb +0 -1
  162. data/test/rubygems/test_project_sanity.rb +0 -43
  163. data/test/rubygems/test_remote_fetch_error.rb +1 -1
  164. data/test/rubygems/test_require.rb +41 -42
  165. data/util/bisect +0 -21
  166. data/util/ci.sh +1 -1
  167. data/util/update_changelog.rb +7 -10
  168. metadata +27 -93
  169. data/bundler/lib/bundler/gem_remote_fetcher.rb +0 -43
  170. data/bundler/lib/bundler/vendor/fileutils/lib/fileutils/version.rb +0 -5
  171. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +0 -12
@@ -96,6 +96,8 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
96
96
 
97
97
  TEST_PATH = ENV.fetch('RUBYGEMS_TEST_PATH', File.expand_path('../../../test/rubygems', __FILE__))
98
98
 
99
+ SPECIFICATIONS = File.expand_path(File.join(TEST_PATH, "specifications"), __FILE__)
100
+
99
101
  def assert_activate(expected, *specs)
100
102
  specs.each do |spec|
101
103
  case spec
@@ -164,6 +166,54 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
164
166
  end
165
167
  end
166
168
 
169
+ ##
170
+ # Sets the bindir entry in RbConfig::CONFIG to +value+ and restores the
171
+ # original value when the block ends
172
+ #
173
+ def bindir(value)
174
+ with_clean_path_to_ruby do
175
+ bindir = RbConfig::CONFIG['bindir']
176
+
177
+ if value
178
+ RbConfig::CONFIG['bindir'] = value
179
+ else
180
+ RbConfig::CONFIG.delete 'bindir'
181
+ end
182
+
183
+ begin
184
+ yield
185
+ ensure
186
+ if bindir
187
+ RbConfig::CONFIG['bindir'] = bindir
188
+ else
189
+ RbConfig::CONFIG.delete 'bindir'
190
+ end
191
+ end
192
+ end
193
+ end
194
+
195
+ ##
196
+ # Sets the EXEEXT entry in RbConfig::CONFIG to +value+ and restores the
197
+ # original value when the block ends
198
+ #
199
+ def exeext(value)
200
+ exeext = RbConfig::CONFIG['EXEEXT']
201
+
202
+ if value
203
+ RbConfig::CONFIG['EXEEXT'] = value
204
+ else
205
+ RbConfig::CONFIG.delete 'EXEEXT'
206
+ end
207
+
208
+ yield
209
+ ensure
210
+ if exeext
211
+ RbConfig::CONFIG['EXEEXT'] = exeext
212
+ else
213
+ RbConfig::CONFIG.delete 'EXEEXT'
214
+ end
215
+ end
216
+
167
217
  # TODO: move to minitest
168
218
  def refute_path_exists(path, msg = nil)
169
219
  msg = message(msg) { "Expected path '#{path}' to not exist" }
@@ -1203,6 +1253,16 @@ Also, a list:
1203
1253
  end
1204
1254
  end
1205
1255
 
1256
+ def with_clean_path_to_ruby
1257
+ orig_ruby = Gem.ruby
1258
+
1259
+ Gem.instance_variable_set :@ruby, nil
1260
+
1261
+ yield
1262
+ ensure
1263
+ Gem.instance_variable_set :@ruby, orig_ruby
1264
+ end
1265
+
1206
1266
  class << self
1207
1267
 
1208
1268
  # :nodoc:
@@ -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
@@ -14,7 +14,13 @@ module Gem::Util
14
14
  require 'stringio'
15
15
  data = StringIO.new(data, 'r')
16
16
 
17
- unzipped = Zlib::GzipReader.new(data).read
17
+ gzip_reader = begin
18
+ Zlib::GzipReader.new(data)
19
+ rescue Zlib::GzipFile::Error => e
20
+ raise e.class, e.inspect, e.backtrace
21
+ end
22
+
23
+ unzipped = gzip_reader.read
18
24
  unzipped.force_encoding Encoding::BINARY
19
25
  unzipped
20
26
  end
@@ -151,7 +151,7 @@
151
151
 
152
152
  class Gem::Version
153
153
 
154
- autoload :Requirement, 'rubygems/requirement'
154
+ autoload :Requirement, File.expand_path('requirement', __dir__)
155
155
 
156
156
  include Comparable
157
157
 
@@ -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.4"
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
@@ -0,0 +1,14 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = "rubyforge"
5
+ s.version = "0.0.1"
6
+ s.platform = "ruby"
7
+ s.require_paths = ["lib"]
8
+ s.summary = "A very bar gem"
9
+ s.authors = ["unknown"]
10
+ s.license = 'MIT'
11
+ s.homepage = 'http://example.com'
12
+ s.files = ['README.md']
13
+ s.rubyforge_project = 'abc'
14
+ end
@@ -161,10 +161,8 @@ class TestGem < Gem::TestCase
161
161
 
162
162
  def test_self_install_permissions_with_format_executable_and_non_standard_ruby_install_name
163
163
  Gem::Installer.exec_format = nil
164
- with_clean_path_to_ruby do
165
- ruby_install_name 'ruby27' do
166
- assert_self_install_permissions(format_executable: true)
167
- end
164
+ ruby_install_name 'ruby27' do
165
+ assert_self_install_permissions(format_executable: true)
168
166
  end
169
167
  ensure
170
168
  Gem::Installer.exec_format = nil
@@ -226,7 +224,7 @@ class TestGem < Gem::TestCase
226
224
  def test_require_missing
227
225
  save_loaded_features do
228
226
  assert_raises ::LoadError do
229
- require "q"
227
+ require "test_require_missing"
230
228
  end
231
229
  end
232
230
  end
@@ -310,6 +308,21 @@ class TestGem < Gem::TestCase
310
308
  assert_equal %w(a-1 b-2 c-1), loaded_spec_names
311
309
  end
312
310
 
311
+ def test_activate_bin_path_in_debug_mode
312
+ a1 = util_spec 'a', '1' do |s|
313
+ s.executables = ['exec']
314
+ end
315
+
316
+ install_specs a1
317
+
318
+ output, status = Open3.capture2e(
319
+ { "GEM_HOME" => Gem.paths.home, "DEBUG_RESOLVER" => "1" },
320
+ Gem.ruby, "-I", File.expand_path("../../lib", __dir__), "-e", "\"Gem.activate_bin_path('a', 'exec', '>= 0')\""
321
+ )
322
+
323
+ assert status.success?, output
324
+ end
325
+
313
326
  def test_activate_bin_path_gives_proper_error_for_bundler
314
327
  bundler = util_spec 'bundler', '2' do |s|
315
328
  s.executables = ['bundle']
@@ -1024,21 +1037,17 @@ class TestGem < Gem::TestCase
1024
1037
  end
1025
1038
 
1026
1039
  def test_self_ruby_escaping_spaces_in_path
1027
- with_clean_path_to_ruby do
1028
- with_bindir_and_exeext("C:/Ruby 1.8/bin", ".exe") do
1029
- ruby_install_name "ruby" do
1030
- assert_equal "\"C:/Ruby 1.8/bin/ruby.exe\"", Gem.ruby
1031
- end
1040
+ with_bindir_and_exeext("C:/Ruby 1.8/bin", ".exe") do
1041
+ ruby_install_name "ruby" do
1042
+ assert_equal "\"C:/Ruby 1.8/bin/ruby.exe\"", Gem.ruby
1032
1043
  end
1033
1044
  end
1034
1045
  end
1035
1046
 
1036
1047
  def test_self_ruby_path_without_spaces
1037
- with_clean_path_to_ruby do
1038
- with_bindir_and_exeext("C:/Ruby18/bin", ".exe") do
1039
- ruby_install_name "ruby" do
1040
- assert_equal "C:/Ruby18/bin/ruby.exe", Gem.ruby
1041
- end
1048
+ with_bindir_and_exeext("C:/Ruby18/bin", ".exe") do
1049
+ ruby_install_name "ruby" do
1050
+ assert_equal "C:/Ruby18/bin/ruby.exe", Gem.ruby
1042
1051
  end
1043
1052
  end
1044
1053
  end
@@ -1090,7 +1099,7 @@ class TestGem < Gem::TestCase
1090
1099
  util_restore_RUBY_VERSION
1091
1100
  end
1092
1101
 
1093
- def test_self_ruby_version_with_prerelease
1102
+ def test_self_ruby_version_with_svn_prerelease
1094
1103
  util_set_RUBY_VERSION '2.6.0', -1, 63539, 'ruby 2.6.0preview2 (2018-05-31 trunk 63539) [x86_64-linux]'
1095
1104
 
1096
1105
  assert_equal Gem::Version.new('2.6.0.preview2'), Gem.ruby_version
@@ -1098,6 +1107,14 @@ class TestGem < Gem::TestCase
1098
1107
  util_restore_RUBY_VERSION
1099
1108
  end
1100
1109
 
1110
+ def test_self_ruby_version_with_git_prerelease
1111
+ util_set_RUBY_VERSION '2.7.0', -1, 'b563439274a402e33541f5695b1bfd4ac1085638', 'ruby 2.7.0preview3 (2019-11-23 master b563439274) [x86_64-linux]'
1112
+
1113
+ assert_equal Gem::Version.new('2.7.0.preview3'), Gem.ruby_version
1114
+ ensure
1115
+ util_restore_RUBY_VERSION
1116
+ end
1117
+
1101
1118
  def test_self_ruby_version_with_non_mri_implementations_with_mri_prerelase_compatibility
1102
1119
  util_set_RUBY_VERSION '2.6.0', -1, 63539, 'weirdjruby 9.2.0.0 (2.6.0preview2) 2018-05-24 81156a8 OpenJDK 64-Bit Server VM 25.171-b11 on 1.8.0_171-8u171-b11-0ubuntu0.16.04.1-b11 [linux-x86_64]', 'weirdjruby', '9.2.0.0'
1103
1120
 
@@ -1106,7 +1123,7 @@ class TestGem < Gem::TestCase
1106
1123
  util_restore_RUBY_VERSION
1107
1124
  end
1108
1125
 
1109
- def test_self_ruby_version_with_trunk
1126
+ def test_self_ruby_version_with_svn_trunk
1110
1127
  util_set_RUBY_VERSION '1.9.2', -1, 23493, 'ruby 1.9.2dev (2009-05-20 trunk 23493) [x86_64-linux]'
1111
1128
 
1112
1129
  assert_equal Gem::Version.new('1.9.2.dev'), Gem.ruby_version
@@ -1114,6 +1131,14 @@ class TestGem < Gem::TestCase
1114
1131
  util_restore_RUBY_VERSION
1115
1132
  end
1116
1133
 
1134
+ def test_self_ruby_version_with_git_master
1135
+ util_set_RUBY_VERSION '2.7.0', -1, '5de284ec78220e75643f89b454ce999da0c1c195', 'ruby 2.7.0dev (2019-12-23T01:37:30Z master 5de284ec78) [x86_64-linux]'
1136
+
1137
+ assert_equal Gem::Version.new('2.7.0.dev'), Gem.ruby_version
1138
+ ensure
1139
+ util_restore_RUBY_VERSION
1140
+ end
1141
+
1117
1142
  def test_self_rubygems_version
1118
1143
  assert_equal Gem::Version.new(Gem::VERSION), Gem.rubygems_version
1119
1144
  end
@@ -1388,7 +1413,7 @@ class TestGem < Gem::TestCase
1388
1413
  a = util_spec "a", "1"
1389
1414
  b = util_spec "b", "1", "c" => nil
1390
1415
  c = util_spec "c", "2"
1391
- d = util_spec "d", "1", {'e' => '= 1'}, "lib/d.rb"
1416
+ d = util_spec "d", "1", {'e' => '= 1'}, "lib/d#{$$}.rb"
1392
1417
  e = util_spec "e", "1"
1393
1418
 
1394
1419
  install_specs a, c, b, e, d
@@ -1397,7 +1422,7 @@ class TestGem < Gem::TestCase
1397
1422
  r.gem "a"
1398
1423
  r.gem "b", "= 1"
1399
1424
 
1400
- require 'd'
1425
+ require "d#{$$}"
1401
1426
  end
1402
1427
 
1403
1428
  assert_equal %w!a-1 b-1 c-2 d-1 e-1!, loaded_spec_names
@@ -1731,6 +1756,18 @@ class TestGem < Gem::TestCase
1731
1756
  assert_nil Gem.find_unresolved_default_spec("README")
1732
1757
  end
1733
1758
 
1759
+ def test_register_default_spec_old_style_with_folder_starting_with_lib
1760
+ Gem.clear_default_specs
1761
+
1762
+ old_style = Gem::Specification.new do |spec|
1763
+ spec.files = ["libexec/bundle", "foo.rb", "bar.rb"]
1764
+ end
1765
+
1766
+ Gem.register_default_spec old_style
1767
+
1768
+ assert_equal old_style, Gem.find_unresolved_default_spec("foo.rb")
1769
+ end
1770
+
1734
1771
  def test_use_gemdeps
1735
1772
  gem_deps_file = 'gem.deps.rb'.tap(&Gem::UNTAINT)
1736
1773
  spec = util_spec 'a', 1
@@ -1903,40 +1940,47 @@ You may need to `gem install -g` to install missing gems
1903
1940
  assert platform_defaults.is_a? Hash
1904
1941
  end
1905
1942
 
1906
- def ruby_install_name(name)
1907
- orig_RUBY_INSTALL_NAME = RbConfig::CONFIG['ruby_install_name']
1908
- RbConfig::CONFIG['ruby_install_name'] = name
1943
+ # Ensure that `Gem.source_date_epoch` is consistent even if
1944
+ # $SOURCE_DATE_EPOCH has not been set.
1945
+ def test_default_source_date_epoch_doesnt_change
1946
+ old_epoch = ENV['SOURCE_DATE_EPOCH']
1947
+ ENV['SOURCE_DATE_EPOCH'] = nil
1909
1948
 
1910
- yield
1949
+ # Unfortunately, there is no real way to test this aside from waiting
1950
+ # enough for `Time.now.to_i` to change -- which is a whole second.
1951
+ #
1952
+ # Fortunately, we only need to do this once.
1953
+ a = Gem.source_date_epoch
1954
+ sleep 1
1955
+ b = Gem.source_date_epoch
1956
+ assert_equal a, b
1911
1957
  ensure
1912
- if orig_RUBY_INSTALL_NAME
1913
- RbConfig::CONFIG['ruby_install_name'] = orig_RUBY_INSTALL_NAME
1914
- else
1915
- RbConfig::CONFIG.delete 'ruby_install_name'
1916
- end
1958
+ ENV['SOURCE_DATE_EPOCH'] = old_epoch
1917
1959
  end
1918
1960
 
1919
- def with_bindir_and_exeext(bindir, exeext)
1920
- orig_bindir = RbConfig::CONFIG['bindir']
1921
- orig_exe_ext = RbConfig::CONFIG['EXEEXT']
1922
-
1923
- RbConfig::CONFIG['bindir'] = bindir
1924
- RbConfig::CONFIG['EXEEXT'] = exeext
1961
+ def ruby_install_name(name)
1962
+ with_clean_path_to_ruby do
1963
+ orig_RUBY_INSTALL_NAME = RbConfig::CONFIG['ruby_install_name']
1964
+ RbConfig::CONFIG['ruby_install_name'] = name
1925
1965
 
1926
- yield
1927
- ensure
1928
- RbConfig::CONFIG['bindir'] = orig_bindir
1929
- RbConfig::CONFIG['EXEEXT'] = orig_exe_ext
1966
+ begin
1967
+ yield
1968
+ ensure
1969
+ if orig_RUBY_INSTALL_NAME
1970
+ RbConfig::CONFIG['ruby_install_name'] = orig_RUBY_INSTALL_NAME
1971
+ else
1972
+ RbConfig::CONFIG.delete 'ruby_install_name'
1973
+ end
1974
+ end
1975
+ end
1930
1976
  end
1931
1977
 
1932
- def with_clean_path_to_ruby
1933
- orig_ruby = Gem.ruby
1934
-
1935
- Gem.instance_variable_set :@ruby, nil
1936
-
1937
- yield
1938
- ensure
1939
- Gem.instance_variable_set :@ruby, orig_ruby
1978
+ def with_bindir_and_exeext(bindir, exeext)
1979
+ bindir(bindir) do
1980
+ exeext(exeext) do
1981
+ yield
1982
+ end
1983
+ end
1940
1984
  end
1941
1985
 
1942
1986
  def with_plugin(path)
@@ -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