rubygems-update 2.7.6 → 2.7.11

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 (148) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -23
  3. data/History.txt +116 -0
  4. data/Manifest.txt +3 -3
  5. data/Rakefile +12 -2
  6. data/bundler/CHANGELOG.md +130 -0
  7. data/bundler/README.md +5 -1
  8. data/bundler/bundler.gemspec +2 -1
  9. data/bundler/lib/bundler.rb +12 -8
  10. data/bundler/lib/bundler/build_metadata.rb +19 -2
  11. data/bundler/lib/bundler/cli.rb +3 -1
  12. data/bundler/lib/bundler/cli/check.rb +1 -1
  13. data/bundler/lib/bundler/cli/exec.rb +4 -4
  14. data/bundler/lib/bundler/cli/gem.rb +5 -2
  15. data/bundler/lib/bundler/cli/init.rb +5 -0
  16. data/bundler/lib/bundler/cli/install.rb +2 -2
  17. data/bundler/lib/bundler/cli/outdated.rb +1 -1
  18. data/bundler/lib/bundler/cli/update.rb +3 -3
  19. data/bundler/lib/bundler/compact_index_client/updater.rb +10 -1
  20. data/bundler/lib/bundler/current_ruby.rb +8 -1
  21. data/bundler/lib/bundler/definition.rb +33 -23
  22. data/bundler/lib/bundler/dep_proxy.rb +2 -2
  23. data/bundler/lib/bundler/dependency.rb +1 -0
  24. data/bundler/lib/bundler/deprecate.rb +2 -1
  25. data/bundler/lib/bundler/endpoint_specification.rb +1 -1
  26. data/bundler/lib/bundler/env.rb +10 -8
  27. data/bundler/lib/bundler/fetcher.rb +3 -3
  28. data/bundler/lib/bundler/fetcher/downloader.rb +10 -5
  29. data/bundler/lib/bundler/fetcher/index.rb +2 -2
  30. data/bundler/lib/bundler/friendly_errors.rb +2 -0
  31. data/bundler/lib/bundler/gem_helper.rb +1 -1
  32. data/bundler/lib/bundler/gem_version_promoter.rb +12 -0
  33. data/bundler/lib/bundler/injector.rb +5 -5
  34. data/bundler/lib/bundler/installer.rb +12 -4
  35. data/bundler/lib/bundler/installer/gem_installer.rb +9 -2
  36. data/bundler/lib/bundler/installer/parallel_installer.rb +1 -1
  37. data/bundler/lib/bundler/lazy_specification.rb +1 -1
  38. data/bundler/lib/bundler/mirror.rb +2 -2
  39. data/bundler/lib/bundler/plugin.rb +2 -2
  40. data/bundler/lib/bundler/plugin/index.rb +7 -2
  41. data/bundler/lib/bundler/process_lock.rb +1 -1
  42. data/bundler/lib/bundler/resolver.rb +10 -9
  43. data/bundler/lib/bundler/resolver/spec_group.rb +0 -5
  44. data/bundler/lib/bundler/ruby_version.rb +1 -1
  45. data/bundler/lib/bundler/rubygems_integration.rb +9 -3
  46. data/bundler/lib/bundler/runtime.rb +2 -2
  47. data/bundler/lib/bundler/shared_helpers.rb +15 -3
  48. data/bundler/lib/bundler/source/git.rb +2 -1
  49. data/bundler/lib/bundler/source/git/git_proxy.rb +6 -1
  50. data/bundler/lib/bundler/source/metadata.rb +1 -1
  51. data/bundler/lib/bundler/source/rubygems.rb +11 -2
  52. data/bundler/lib/bundler/source/rubygems/remote.rb +4 -1
  53. data/bundler/lib/bundler/spec_set.rb +4 -1
  54. data/bundler/lib/bundler/templates/Executable +1 -1
  55. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +8 -2
  56. data/bundler/lib/bundler/templates/newgem/travis.yml.tt +2 -0
  57. data/bundler/lib/bundler/ui/shell.rb +3 -1
  58. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +11 -1
  59. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +7 -2
  60. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
  61. data/bundler/lib/bundler/version.rb +1 -1
  62. data/bundler/man/bundle-binstubs.ronn +3 -3
  63. data/bundler/man/bundle-check.ronn +3 -3
  64. data/bundler/man/bundle-config.ronn +13 -9
  65. data/bundler/man/bundle-doctor.ronn +33 -0
  66. data/bundler/man/bundle-exec.ronn +3 -3
  67. data/bundler/man/bundle-gem.ronn +1 -1
  68. data/bundler/man/bundle-init.ronn +15 -4
  69. data/bundler/man/bundle-inject.ronn +3 -3
  70. data/bundler/man/bundle-install.ronn +12 -3
  71. data/bundler/man/bundle-lock.ronn +1 -1
  72. data/bundler/man/bundle-outdated.ronn +1 -1
  73. data/bundler/man/bundle-package.ronn +3 -3
  74. data/bundler/man/bundle-show.ronn +3 -2
  75. data/bundler/man/bundle-update.ronn +18 -14
  76. data/bundler/man/bundle-viz.ronn +1 -1
  77. data/bundler/man/bundle.ronn +27 -27
  78. data/bundler/man/gemfile.5.ronn +24 -9
  79. data/lib/rubygems.rb +24 -11
  80. data/lib/rubygems/bundler_version_finder.rb +9 -22
  81. data/lib/rubygems/command_manager.rb +6 -4
  82. data/lib/rubygems/commands/install_command.rb +7 -0
  83. data/lib/rubygems/commands/owner_command.rb +4 -1
  84. data/lib/rubygems/commands/push_command.rb +37 -4
  85. data/lib/rubygems/commands/setup_command.rb +3 -3
  86. data/lib/rubygems/commands/uninstall_command.rb +1 -1
  87. data/lib/rubygems/commands/unpack_command.rb +1 -1
  88. data/lib/rubygems/core_ext/kernel_require.rb +2 -7
  89. data/lib/rubygems/dependency.rb +1 -0
  90. data/lib/rubygems/dependency_installer.rb +4 -2
  91. data/lib/rubygems/exceptions.rb +5 -1
  92. data/lib/rubygems/gemcutter_utilities.rb +5 -2
  93. data/lib/rubygems/indexer.rb +1 -1
  94. data/lib/rubygems/install_update_options.rb +1 -1
  95. data/lib/rubygems/installer.rb +29 -6
  96. data/lib/rubygems/package.rb +20 -2
  97. data/lib/rubygems/package/tar_header.rb +3 -1
  98. data/lib/rubygems/package/tar_writer.rb +2 -3
  99. data/lib/rubygems/remote_fetcher.rb +1 -1
  100. data/lib/rubygems/request_set.rb +28 -17
  101. data/lib/rubygems/requirement.rb +14 -3
  102. data/lib/rubygems/resolver/api_specification.rb +5 -0
  103. data/lib/rubygems/security.rb +6 -1
  104. data/lib/rubygems/server.rb +3 -3
  105. data/lib/rubygems/source.rb +1 -1
  106. data/lib/rubygems/specification.rb +7 -10
  107. data/lib/rubygems/ssl_certs/{index.rubygems.org → rubygems.org}/GlobalSignRootCA.pem +0 -0
  108. data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA_R3.pem +21 -0
  109. data/lib/rubygems/test_case.rb +22 -4
  110. data/lib/rubygems/test_utilities.rb +1 -1
  111. data/lib/rubygems/user_interaction.rb +9 -2
  112. data/lib/rubygems/util/licenses.rb +35 -4
  113. data/lib/rubygems/version.rb +7 -1
  114. data/lib/ubygems.rb +3 -0
  115. data/test/rubygems/test_bundled_ca.rb +7 -4
  116. data/test/rubygems/test_gem.rb +45 -10
  117. data/test/rubygems/test_gem_bundler_version_finder.rb +8 -7
  118. data/test/rubygems/test_gem_command_manager.rb +2 -2
  119. data/test/rubygems/test_gem_commands_build_command.rb +2 -0
  120. data/test/rubygems/test_gem_commands_install_command.rb +37 -0
  121. data/test/rubygems/test_gem_commands_push_command.rb +20 -0
  122. data/test/rubygems/test_gem_commands_setup_command.rb +6 -1
  123. data/test/rubygems/test_gem_commands_signin_command.rb +1 -1
  124. data/test/rubygems/test_gem_commands_uninstall_command.rb +1 -1
  125. data/test/rubygems/test_gem_dependency.rb +1 -1
  126. data/test/rubygems/test_gem_ext_rake_builder.rb +0 -4
  127. data/test/rubygems/test_gem_install_update_options.rb +2 -0
  128. data/test/rubygems/test_gem_installer.rb +109 -3
  129. data/test/rubygems/test_gem_package.rb +90 -5
  130. data/test/rubygems/test_gem_package_tar_header.rb +2 -1
  131. data/test/rubygems/test_gem_remote_fetcher.rb +6 -2
  132. data/test/rubygems/test_gem_request.rb +5 -2
  133. data/test/rubygems/test_gem_requirement.rb +6 -0
  134. data/test/rubygems/test_gem_resolver_api_specification.rb +24 -0
  135. data/test/rubygems/test_gem_resolver_installer_set.rb +1 -1
  136. data/test/rubygems/test_gem_security_policy.rb +3 -3
  137. data/test/rubygems/test_gem_server.rb +12 -12
  138. data/test/rubygems/test_gem_specification.rb +27 -13
  139. data/test/rubygems/test_gem_stream_ui.rb +2 -2
  140. data/test/rubygems/test_gem_text.rb +5 -0
  141. data/test/rubygems/test_gem_util.rb +4 -2
  142. data/test/rubygems/test_gem_version.rb +29 -2
  143. data/util/ci +1 -0
  144. data/util/generate_spdx_license_list.rb +15 -6
  145. data/util/update_bundled_ca_certificates.rb +1 -3
  146. metadata +12 -12
  147. data/lib/rubygems/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
  148. data/lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
@@ -64,7 +64,7 @@ class Gem::FakeFetcher
64
64
  data.call
65
65
  else
66
66
  if path.to_s =~ /gz$/ and not data.nil? and not data.empty? then
67
- data = Gem.gunzip data
67
+ data = Gem::Util.gunzip data
68
68
  end
69
69
 
70
70
  data
@@ -6,6 +6,8 @@
6
6
  #++
7
7
 
8
8
  require 'rubygems/util'
9
+ require 'rubygems/deprecate'
10
+ require 'rubygems/text'
9
11
 
10
12
  ##
11
13
  # Module that defines the default UserInteraction. Any class including this
@@ -13,6 +15,8 @@ require 'rubygems/util'
13
15
 
14
16
  module Gem::DefaultUserInteraction
15
17
 
18
+ include Gem::Text
19
+
16
20
  ##
17
21
  # The default UI is a class variable of the singleton class for this
18
22
  # module.
@@ -160,8 +164,8 @@ module Gem::UserInteraction
160
164
  # Calls +say+ with +msg+ or the results of the block if really_verbose
161
165
  # is true.
162
166
 
163
- def verbose msg = nil
164
- say(msg || yield) if Gem.configuration.really_verbose
167
+ def verbose(msg = nil)
168
+ say(clean_text(msg || yield)) if Gem.configuration.really_verbose
165
169
  end
166
170
  end
167
171
 
@@ -170,6 +174,8 @@ end
170
174
 
171
175
  class Gem::StreamUI
172
176
 
177
+ extend Gem::Deprecate
178
+
173
179
  ##
174
180
  # The input stream
175
181
 
@@ -384,6 +390,7 @@ class Gem::StreamUI
384
390
  def debug(statement)
385
391
  @errs.puts statement
386
392
  end
393
+ deprecate :debug, :none, 2018, 12
387
394
 
388
395
  ##
389
396
  # Terminate the application with exit code +status+, running any exit
@@ -8,7 +8,7 @@ class Gem::Licenses
8
8
 
9
9
  # Software Package Data Exchange (SPDX) standard open-source software
10
10
  # license identifiers
11
- IDENTIFIERS = %w(
11
+ LICENSE_IDENTIFIERS = %w(
12
12
  0BSD
13
13
  AAL
14
14
  ADSL
@@ -354,12 +354,43 @@ class Gem::Licenses
354
354
  zlib-acknowledgement
355
355
  ).freeze
356
356
 
357
+ # exception identifiers
358
+ EXCEPTION_IDENTIFIERS = %w(
359
+ 389-exception
360
+ Autoconf-exception-2.0
361
+ Autoconf-exception-3.0
362
+ Bison-exception-2.2
363
+ Bootloader-exception
364
+ CLISP-exception-2.0
365
+ Classpath-exception-2.0
366
+ DigiRule-FOSS-exception
367
+ FLTK-exception
368
+ Fawkes-Runtime-exception
369
+ Font-exception-2.0
370
+ GCC-exception-2.0
371
+ GCC-exception-3.1
372
+ LZMA-exception
373
+ Libtool-exception
374
+ Linux-syscall-note
375
+ Nokia-Qt-exception-1.1
376
+ OCCT-exception-1.0
377
+ Qwt-exception-1.0
378
+ WxWindows-exception-3.1
379
+ eCos-exception-2.0
380
+ freertos-exception-2.0
381
+ gnu-javamail-exception
382
+ i2p-gpl-java-exception
383
+ mif-exception
384
+ openvpn-openssl-exception
385
+ u-boot-exception-2.0
386
+ ).freeze
387
+
357
388
  REGEXP = %r{
358
389
  \A
359
390
  (
360
- #{Regexp.union(IDENTIFIERS)}
391
+ #{Regexp.union(LICENSE_IDENTIFIERS)}
361
392
  \+?
362
- (\s WITH \s .+)?
393
+ (\s WITH \s #{Regexp.union(EXCEPTION_IDENTIFIERS)})?
363
394
  | #{NONSTANDARD}
364
395
  )
365
396
  \Z
@@ -370,7 +401,7 @@ class Gem::Licenses
370
401
  end
371
402
 
372
403
  def self.suggestions(license)
373
- by_distance = IDENTIFIERS.group_by do |identifier|
404
+ by_distance = LICENSE_IDENTIFIERS.group_by do |identifier|
374
405
  levenshtein_distance(identifier, license)
375
406
  end
376
407
  lowest = by_distance.keys.min
@@ -170,6 +170,10 @@ class Gem::Version
170
170
  # True if the +version+ string matches RubyGems' requirements.
171
171
 
172
172
  def self.correct? version
173
+ unless Gem::Deprecate.skip
174
+ warn "nil versions are discouraged and will be deprecated in Rubygems 4" if version.nil?
175
+ end
176
+
173
177
  !!(version.to_s =~ ANCHORED_VERSION_PATTERN)
174
178
  end
175
179
 
@@ -324,7 +328,9 @@ class Gem::Version
324
328
  segments.pop while segments.size > 2
325
329
  segments.push 0 while segments.size < 2
326
330
 
327
- "~> #{segments.join(".")}"
331
+ recommendation = "~> #{segments.join(".")}"
332
+ recommendation += ".a" if prerelease?
333
+ recommendation
328
334
  end
329
335
 
330
336
  ##
@@ -7,5 +7,8 @@
7
7
  # See LICENSE.txt for permissions.
8
8
  #++
9
9
 
10
+ # TODO: Remove this file at RubyGems 4.0
11
+ # Based by https://bugs.ruby-lang.org/issues/14322#note-4
12
+ warn "`ubygems.rb' is deprecated, and will be removed on or after 2018-12-01. Remove `-rubygems' from your command-line, or use `-r rubygems' instead"
10
13
 
11
14
  require 'rubygems'
@@ -51,13 +51,16 @@ if ENV["CI"] || ENV["TEST_SSL"]
51
51
  assert_https('rubygems.org')
52
52
  end
53
53
 
54
- def test_accessing_fastly
55
- assert_https('rubygems.global.ssl.fastly.net')
54
+ def test_accessing_www_rubygems
55
+ assert_https('www.rubygems.org')
56
56
  end
57
57
 
58
- def test_accessing_new_index
59
- assert_https('fastly.rubygems.org')
58
+ def test_accessing_staging
59
+ assert_https('staging.rubygems.org')
60
60
  end
61
61
 
62
+ def test_accessing_new_index
63
+ assert_https('index.rubygems.org')
64
+ end
62
65
  end
63
66
  end
@@ -209,6 +209,41 @@ class TestGem < Gem::TestCase
209
209
  assert_equal %w(a-1 b-2 c-1), loaded_spec_names
210
210
  end
211
211
 
212
+ def test_activate_bin_path_gives_proper_error_for_bundler
213
+ bundler = util_spec 'bundler', '2' do |s|
214
+ s.executables = ['bundle']
215
+ end
216
+
217
+ install_specs bundler
218
+
219
+ File.open("Gemfile.lock", "w") do |f|
220
+ f.write <<-L.gsub(/ {8}/, "")
221
+ GEM
222
+ remote: https://rubygems.org/
223
+ specs:
224
+
225
+ PLATFORMS
226
+ ruby
227
+
228
+ DEPENDENCIES
229
+
230
+ BUNDLED WITH
231
+ 9999
232
+ L
233
+ end
234
+
235
+ File.open("Gemfile", "w") { |f| f.puts('source "https://rubygems.org"') }
236
+
237
+ e = assert_raises Gem::GemNotFoundException do
238
+ load Gem.activate_bin_path("bundler", "bundle", ">= 0.a")
239
+ end
240
+
241
+ assert_includes e.message, "Could not find 'bundler' (9999) required by your #{File.expand_path("Gemfile.lock")}."
242
+ assert_includes e.message, "To update to the latest version installed on your system, run `bundle update --bundler`."
243
+ assert_includes e.message, "To install the missing version, run `gem install bundler:9999`"
244
+ refute_includes e.message, "can't find gem bundler (>= 0.a) with executable bundle"
245
+ end
246
+
212
247
  def test_self_bin_path_no_exec_name
213
248
  e = assert_raises ArgumentError do
214
249
  Gem.bin_path 'a'
@@ -387,7 +422,7 @@ class TestGem < Gem::TestCase
387
422
  assert_equal %w[https://rubygems.org/], Gem.default_sources
388
423
  end
389
424
 
390
- def test_self_detect_gemdeps
425
+ def test_self_use_gemdeps
391
426
  skip 'Insecure operation - chdir' if RUBY_VERSION <= "1.8.7"
392
427
  rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], '-'
393
428
 
@@ -399,7 +434,7 @@ class TestGem < Gem::TestCase
399
434
  begin
400
435
  Dir.chdir 'detect/a/b'
401
436
 
402
- assert_equal add_bundler_full_name([]), Gem.detect_gemdeps.map(&:full_name)
437
+ assert_equal add_bundler_full_name([]), Gem.use_gemdeps.map(&:full_name)
403
438
  ensure
404
439
  Dir.chdir @tempdir
405
440
  end
@@ -1214,7 +1249,7 @@ class TestGem < Gem::TestCase
1214
1249
  input = "\x1F\x8B\b\0\xED\xA3\x1AQ\0\x03\xCBH" +
1215
1250
  "\xCD\xC9\xC9\a\0\x86\xA6\x106\x05\0\0\0"
1216
1251
 
1217
- output = Gem.gunzip input
1252
+ output = Gem::Util.gunzip input
1218
1253
 
1219
1254
  assert_equal 'hello', output
1220
1255
 
@@ -1226,7 +1261,7 @@ class TestGem < Gem::TestCase
1226
1261
  def test_self_gzip
1227
1262
  input = 'hello'
1228
1263
 
1229
- output = Gem.gzip input
1264
+ output = Gem::Util.gzip input
1230
1265
 
1231
1266
  zipped = StringIO.new output
1232
1267
 
@@ -1450,12 +1485,12 @@ class TestGem < Gem::TestCase
1450
1485
 
1451
1486
  ENV['RUBYGEMS_GEMDEPS'] = path
1452
1487
 
1453
- Gem.detect_gemdeps
1488
+ Gem.use_gemdeps
1454
1489
 
1455
1490
  assert_equal add_bundler_full_name(%W(a-1 b-1 c-1)), loaded_spec_names
1456
1491
  end
1457
1492
 
1458
- def test_auto_activation_of_detected_gemdeps_file
1493
+ def test_auto_activation_of_used_gemdeps_file
1459
1494
  skip 'Insecure operation - chdir' if RUBY_VERSION <= "1.8.7"
1460
1495
  util_clear_gems
1461
1496
 
@@ -1476,7 +1511,7 @@ class TestGem < Gem::TestCase
1476
1511
  ENV['RUBYGEMS_GEMDEPS'] = "-"
1477
1512
 
1478
1513
  expected_specs = [a, b, (Gem::USE_BUNDLER_FOR_GEMDEPS || nil) && util_spec("bundler", Bundler::VERSION), c].compact
1479
- assert_equal expected_specs, Gem.detect_gemdeps.sort_by { |s| s.name }
1514
+ assert_equal expected_specs, Gem.use_gemdeps.sort_by { |s| s.name }
1480
1515
  end
1481
1516
 
1482
1517
  LIB_PATH = File.expand_path "../../../lib".dup.untaint, __FILE__.dup.untaint
@@ -1590,7 +1625,7 @@ class TestGem < Gem::TestCase
1590
1625
 
1591
1626
  assert_equal old_style, Gem.find_unresolved_default_spec("foo.rb")
1592
1627
  assert_equal old_style, Gem.find_unresolved_default_spec("bar.rb")
1593
- assert_equal nil, Gem.find_unresolved_default_spec("baz.rb")
1628
+ assert_nil Gem.find_unresolved_default_spec("baz.rb")
1594
1629
 
1595
1630
  Gem.clear_default_specs
1596
1631
 
@@ -1603,8 +1638,8 @@ class TestGem < Gem::TestCase
1603
1638
 
1604
1639
  assert_equal new_style, Gem.find_unresolved_default_spec("foo.rb")
1605
1640
  assert_equal new_style, Gem.find_unresolved_default_spec("bar.rb")
1606
- assert_equal nil, Gem.find_unresolved_default_spec("exec")
1607
- assert_equal nil, Gem.find_unresolved_default_spec("README")
1641
+ assert_nil Gem.find_unresolved_default_spec("exec")
1642
+ assert_nil Gem.find_unresolved_default_spec("README")
1608
1643
  end
1609
1644
 
1610
1645
  def test_default_gems_use_full_paths
@@ -88,20 +88,21 @@ class TestGemBundlerVersionFinder < Gem::TestCase
88
88
  bvf.stub(:bundler_version, v("2.1.1.1")) do
89
89
  assert bvf.compatible?(util_spec("foo"))
90
90
  assert bvf.compatible?(util_spec("bundler", "2.1.1.1"))
91
- refute bvf.compatible?(util_spec("bundler", "2.1.1.a"))
91
+ assert bvf.compatible?(util_spec("bundler", "2.1.1.a"))
92
+ assert bvf.compatible?(util_spec("bundler", "2.999"))
92
93
  refute bvf.compatible?(util_spec("bundler", "1.999"))
93
- refute bvf.compatible?(util_spec("bundler", "2.999"))
94
+ refute bvf.compatible?(util_spec("bundler", "3.0.0"))
94
95
  end
95
96
  end
96
97
 
97
98
  def test_filter
98
- versions = %w[1 1.0 1.0.1.1 2.a 3 3.0]
99
+ versions = %w[1 1.0 1.0.1.1 2 2.a 2.0 2.1.1 3 3.a 3.0 3.1.1]
99
100
  specs = versions.map { |v| util_spec("bundler", v) }
100
101
 
101
- assert_equal %w[1 1.0 1.0.1.1 2.a 3 3.0], util_filter_specs(specs).map(&:version).map(&:to_s)
102
+ assert_equal %w[1 1.0 1.0.1.1 2 2.a 2.0 2.1.1 3 3.a 3.0 3.1.1], util_filter_specs(specs).map(&:version).map(&:to_s)
102
103
 
103
104
  bvf.stub(:bundler_version, v("2.1.1.1")) do
104
- assert_empty util_filter_specs(specs).map(&:version).map(&:to_s)
105
+ assert_equal %w[2 2.a 2.0 2.1.1], util_filter_specs(specs).map(&:version).map(&:to_s)
105
106
  end
106
107
  bvf.stub(:bundler_version, v("1.1.1.1")) do
107
108
  assert_equal %w[1 1.0 1.0.1.1], util_filter_specs(specs).map(&:version).map(&:to_s)
@@ -110,10 +111,10 @@ class TestGemBundlerVersionFinder < Gem::TestCase
110
111
  assert_equal %w[1 1.0 1.0.1.1], util_filter_specs(specs).map(&:version).map(&:to_s)
111
112
  end
112
113
  bvf.stub(:bundler_version, v("2.a")) do
113
- assert_equal %w[2.a], util_filter_specs(specs).map(&:version).map(&:to_s)
114
+ assert_equal %w[2 2.a 2.0 2.1.1], util_filter_specs(specs).map(&:version).map(&:to_s)
114
115
  end
115
116
  bvf.stub(:bundler_version, v("3")) do
116
- assert_equal %w[3 3.0], util_filter_specs(specs).map(&:version).map(&:to_s)
117
+ assert_equal %w[3 3.a 3.0 3.1.1], util_filter_specs(specs).map(&:version).map(&:to_s)
117
118
  end
118
119
  end
119
120
 
@@ -114,8 +114,8 @@ class TestGemCommandManager < Gem::TestCase
114
114
  assert_equal :both, check_options[:domain]
115
115
  assert_equal true, check_options[:wrappers]
116
116
  assert_equal Gem::Requirement.default, check_options[:version]
117
- assert_equal nil, check_options[:install_dir]
118
- assert_equal nil, check_options[:bin_dir]
117
+ assert_nil check_options[:install_dir]
118
+ assert_nil check_options[:bin_dir]
119
119
 
120
120
  #check settings
121
121
  check_options = nil
@@ -122,6 +122,8 @@ class TestGemCommandsBuildCommand < Gem::TestCase
122
122
  SIGNING_KEY = key_path 'private3072'
123
123
 
124
124
  def test_build_signed_gem
125
+ skip 'openssl is missing' unless defined?(OpenSSL::SSL)
126
+
125
127
  trust_dir = Gem::Security.trust_dir
126
128
 
127
129
  spec = util_spec 'some_gem' do |s|
@@ -416,6 +416,43 @@ ERROR: Possible alternatives: non_existent_with_hint
416
416
  assert_path_exists File.join(a2.doc_dir, 'rdoc')
417
417
  end
418
418
 
419
+ def test_execute_rdoc_with_path
420
+ skip if RUBY_VERSION <= "1.8.7"
421
+ specs = spec_fetcher do |fetcher|
422
+ fetcher.gem 'a', 2
423
+ end
424
+
425
+ Gem.done_installing(&Gem::RDoc.method(:generation_hook))
426
+
427
+ @cmd.options[:document] = %w[rdoc ri]
428
+ @cmd.options[:domain] = :local
429
+ @cmd.options[:install_dir] = 'whatever'
430
+
431
+ a2 = specs['a-2']
432
+ FileUtils.mv a2.cache_file, @tempdir
433
+
434
+ @cmd.options[:args] = %w[a]
435
+
436
+ use_ui @ui do
437
+ # Don't use Dir.chdir with a block, it warnings a lot because
438
+ # of a downstream Dir.chdir with a block
439
+ old = Dir.getwd
440
+
441
+ begin
442
+ Dir.chdir @tempdir
443
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
444
+ @cmd.execute
445
+ end
446
+ ensure
447
+ Dir.chdir old
448
+ end
449
+ end
450
+
451
+ wait_for_child_process_to_exit
452
+
453
+ assert_path_exists 'whatever/doc/a-2', 'documentation not installed'
454
+ end
455
+
419
456
  def test_execute_saves_build_args
420
457
  specs = spec_fetcher do |fetcher|
421
458
  fetcher.gem 'a', 2
@@ -95,6 +95,26 @@ class TestGemCommandsPushCommand < Gem::TestCase
95
95
  @fetcher.last_request["Content-Type"]
96
96
  end
97
97
 
98
+ def test_execute_allowed_push_host
99
+ @spec, @path = util_gem "freebird", "1.0.1" do |spec|
100
+ spec.metadata['allowed_push_host'] = "https://privategemserver.example"
101
+ end
102
+
103
+ @response = "Successfully registered gem: freewill (1.0.0)"
104
+ @fetcher.data["#{@spec.metadata['allowed_push_host']}/api/v1/gems"] = [@response, 200, 'OK']
105
+ @fetcher.data["#{Gem.host}/api/v1/gems"] =
106
+ ['fail', 500, 'Internal Server Error']
107
+
108
+ @cmd.options[:args] = [@path]
109
+
110
+ @cmd.execute
111
+
112
+ assert_equal Net::HTTP::Post, @fetcher.last_request.class
113
+ assert_equal Gem.read_binary(@path), @fetcher.last_request.body
114
+ assert_equal "application/octet-stream",
115
+ @fetcher.last_request["Content-Type"]
116
+ end
117
+
98
118
  def test_sending_when_default_host_disabled
99
119
  Gem.configuration.disable_default_gem_server = true
100
120
  response = "You must specify a gem server"
@@ -6,7 +6,12 @@ require 'rubygems/commands/setup_command'
6
6
 
7
7
  class TestGemCommandsSetupCommand < Gem::TestCase
8
8
 
9
- BUNDLER_VERS = `gem list -e bundler`[/([^() ]+)\)\Z/, 1] || "1.16.1"
9
+ bundler_gemspec = File.expand_path("../../../bundler/lib/bundler/version.rb", __FILE__)
10
+ if File.exist?(bundler_gemspec)
11
+ BUNDLER_VERS = File.read(bundler_gemspec).match(/VERSION = "(#{Gem::Version::VERSION_PATTERN})"/)[1]
12
+ else
13
+ BUNDLER_VERS = "1.16.2"
14
+ end
10
15
 
11
16
  def setup
12
17
  super
@@ -48,7 +48,7 @@ class TestGemCommandsSigninCommand < Gem::TestCase
48
48
 
49
49
  assert_equal credentials[:rubygems_api_key], api_key
50
50
 
51
- assert_equal credentials[host], nil
51
+ assert_nil credentials[host]
52
52
  end
53
53
 
54
54
  def test_execute_with_host_supplied