rubygems-update 2.7.3 → 2.7.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +6 -30
  3. data/History.txt +146 -0
  4. data/Manifest.txt +5 -4
  5. data/Rakefile +19 -2
  6. data/bundler/CHANGELOG.md +143 -0
  7. data/bundler/README.md +5 -1
  8. data/bundler/bundler.gemspec +4 -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 +6 -3
  15. data/bundler/lib/bundler/cli/init.rb +6 -5
  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 +6 -4
  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 +34 -24
  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 +14 -10
  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 +13 -6
  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/.document +1 -0
  55. data/bundler/lib/bundler/templates/Executable +11 -3
  56. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +8 -2
  57. data/bundler/lib/bundler/templates/newgem/{.travis.yml.tt → travis.yml.tt} +2 -0
  58. data/bundler/lib/bundler/ui/shell.rb +3 -1
  59. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +11 -1
  60. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +7 -2
  61. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
  62. data/bundler/lib/bundler/version.rb +1 -1
  63. data/bundler/man/bundle-binstubs.ronn +3 -3
  64. data/bundler/man/bundle-check.ronn +3 -3
  65. data/bundler/man/bundle-config.ronn +13 -9
  66. data/bundler/man/bundle-doctor.ronn +33 -0
  67. data/bundler/man/bundle-exec.ronn +3 -3
  68. data/bundler/man/bundle-gem.ronn +1 -1
  69. data/bundler/man/bundle-init.ronn +15 -4
  70. data/bundler/man/bundle-inject.ronn +3 -3
  71. data/bundler/man/bundle-install.ronn +12 -3
  72. data/bundler/man/bundle-lock.ronn +1 -1
  73. data/bundler/man/bundle-outdated.ronn +1 -1
  74. data/bundler/man/bundle-package.ronn +3 -3
  75. data/bundler/man/bundle-show.ronn +3 -2
  76. data/bundler/man/bundle-update.ronn +18 -14
  77. data/bundler/man/bundle-viz.ronn +1 -1
  78. data/bundler/man/bundle.ronn +27 -27
  79. data/bundler/man/gemfile.5.ronn +24 -9
  80. data/lib/rubygems.rb +30 -17
  81. data/lib/rubygems/bundler_version_finder.rb +9 -22
  82. data/lib/rubygems/command.rb +9 -1
  83. data/lib/rubygems/command_manager.rb +6 -4
  84. data/lib/rubygems/commands/generate_index_command.rb +1 -1
  85. data/lib/rubygems/commands/install_command.rb +7 -0
  86. data/lib/rubygems/commands/owner_command.rb +4 -1
  87. data/lib/rubygems/commands/push_command.rb +37 -4
  88. data/lib/rubygems/commands/setup_command.rb +22 -7
  89. data/lib/rubygems/commands/uninstall_command.rb +1 -1
  90. data/lib/rubygems/commands/unpack_command.rb +3 -3
  91. data/lib/rubygems/config_file.rb +1 -1
  92. data/lib/rubygems/core_ext/kernel_require.rb +2 -7
  93. data/lib/rubygems/dependency.rb +1 -0
  94. data/lib/rubygems/dependency_installer.rb +4 -2
  95. data/lib/rubygems/exceptions.rb +5 -1
  96. data/lib/rubygems/ext/builder.rb +1 -1
  97. data/lib/rubygems/gemcutter_utilities.rb +5 -2
  98. data/lib/rubygems/indexer.rb +6 -5
  99. data/lib/rubygems/install_update_options.rb +1 -1
  100. data/lib/rubygems/installer.rb +38 -10
  101. data/lib/rubygems/package.rb +54 -7
  102. data/lib/rubygems/package/file_source.rb +2 -2
  103. data/lib/rubygems/package/old.rb +1 -1
  104. data/lib/rubygems/package/tar_header.rb +17 -10
  105. data/lib/rubygems/package/tar_writer.rb +4 -3
  106. data/lib/rubygems/remote_fetcher.rb +1 -1
  107. data/lib/rubygems/request_set.rb +28 -17
  108. data/lib/rubygems/request_set/lockfile.rb +1 -1
  109. data/lib/rubygems/requirement.rb +14 -3
  110. data/lib/rubygems/resolver/api_specification.rb +5 -0
  111. data/lib/rubygems/security.rb +7 -2
  112. data/lib/rubygems/security/trust_dir.rb +1 -1
  113. data/lib/rubygems/server.rb +16 -4
  114. data/lib/rubygems/source.rb +2 -2
  115. data/lib/rubygems/specification.rb +22 -14
  116. data/lib/rubygems/ssl_certs/{index.rubygems.org → rubygems.org}/GlobalSignRootCA.pem +0 -0
  117. data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA_R3.pem +21 -0
  118. data/lib/rubygems/stub_specification.rb +2 -0
  119. data/lib/rubygems/test_case.rb +36 -12
  120. data/lib/rubygems/test_utilities.rb +2 -2
  121. data/lib/rubygems/user_interaction.rb +9 -2
  122. data/lib/rubygems/util.rb +2 -1
  123. data/lib/rubygems/util/licenses.rb +35 -4
  124. data/lib/rubygems/validator.rb +3 -3
  125. data/lib/rubygems/version.rb +7 -1
  126. data/lib/ubygems.rb +3 -0
  127. data/test/rubygems/test_bundled_ca.rb +7 -4
  128. data/test/rubygems/test_gem.rb +62 -24
  129. data/test/rubygems/test_gem_bundler_version_finder.rb +8 -7
  130. data/test/rubygems/test_gem_command_manager.rb +2 -2
  131. data/test/rubygems/test_gem_commands_build_command.rb +2 -0
  132. data/test/rubygems/test_gem_commands_cleanup_command.rb +1 -1
  133. data/test/rubygems/test_gem_commands_install_command.rb +38 -0
  134. data/test/rubygems/test_gem_commands_owner_command.rb +25 -0
  135. data/test/rubygems/test_gem_commands_push_command.rb +25 -5
  136. data/test/rubygems/test_gem_commands_setup_command.rb +46 -21
  137. data/test/rubygems/test_gem_commands_signin_command.rb +1 -1
  138. data/test/rubygems/test_gem_commands_uninstall_command.rb +3 -3
  139. data/test/rubygems/test_gem_dependency.rb +1 -1
  140. data/test/rubygems/test_gem_dependency_installer.rb +1 -1
  141. data/test/rubygems/test_gem_doctor.rb +2 -2
  142. data/test/rubygems/test_gem_ext_builder.rb +6 -6
  143. data/test/rubygems/test_gem_ext_rake_builder.rb +0 -4
  144. data/test/rubygems/test_gem_gemcutter_utilities.rb +4 -4
  145. data/test/rubygems/test_gem_indexer.rb +1 -2
  146. data/test/rubygems/test_gem_install_update_options.rb +4 -0
  147. data/test/rubygems/test_gem_installer.rb +114 -4
  148. data/test/rubygems/test_gem_package.rb +178 -21
  149. data/test/rubygems/test_gem_package_old.rb +1 -1
  150. data/test/rubygems/test_gem_package_tar_header.rb +21 -0
  151. data/test/rubygems/test_gem_rdoc.rb +2 -0
  152. data/test/rubygems/test_gem_remote_fetcher.rb +7 -3
  153. data/test/rubygems/test_gem_request.rb +5 -2
  154. data/test/rubygems/test_gem_request_connection_pools.rb +6 -7
  155. data/test/rubygems/test_gem_request_set.rb +7 -7
  156. data/test/rubygems/test_gem_request_set_lockfile.rb +4 -4
  157. data/test/rubygems/test_gem_request_set_lockfile_parser.rb +1 -1
  158. data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +1 -1
  159. data/test/rubygems/test_gem_requirement.rb +6 -0
  160. data/test/rubygems/test_gem_resolver_api_specification.rb +24 -0
  161. data/test/rubygems/test_gem_resolver_git_specification.rb +1 -1
  162. data/test/rubygems/test_gem_resolver_installer_set.rb +1 -1
  163. data/test/rubygems/test_gem_security_policy.rb +3 -3
  164. data/test/rubygems/test_gem_server.rb +177 -12
  165. data/test/rubygems/test_gem_source.rb +3 -3
  166. data/test/rubygems/test_gem_source_git.rb +1 -1
  167. data/test/rubygems/test_gem_specification.rb +64 -31
  168. data/test/rubygems/test_gem_stream_ui.rb +2 -2
  169. data/test/rubygems/test_gem_stub_specification.rb +7 -7
  170. data/test/rubygems/test_gem_text.rb +5 -0
  171. data/test/rubygems/test_gem_util.rb +25 -0
  172. data/test/rubygems/test_gem_version.rb +40 -2
  173. data/test/rubygems/test_require.rb +15 -21
  174. data/util/ci +1 -0
  175. data/util/generate_spdx_license_list.rb +15 -6
  176. data/util/update_bundled_ca_certificates.rb +1 -3
  177. metadata +14 -13
  178. data/lib/rubygems/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
  179. data/lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
@@ -0,0 +1,21 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4G
3
+ A1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNp
4
+ Z24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4
5
+ MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMzETMBEG
6
+ A1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCASIwDQYJKoZI
7
+ hvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWtiHL8
8
+ RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsT
9
+ gHeMCOFJ0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmm
10
+ KPZpO/bLyCiR5Z2KYVc3rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zd
11
+ QQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjlOCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZ
12
+ XriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2xmmFghcCAwEAAaNCMEAw
13
+ DgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFI/wS3+o
14
+ LkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZU
15
+ RUm7lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMp
16
+ jjM5RcOO5LlXbKr8EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK
17
+ 6fBdRoyV3XpYKBovHd7NADdBj+1EbddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQX
18
+ mcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18YIvDQVETI53O9zJrlAGomecs
19
+ Mx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7rkpeDMdmztcpH
20
+ WD9f
21
+ -----END CERTIFICATE-----
@@ -113,6 +113,8 @@ class Gem::StubSpecification < Gem::BasicSpecification
113
113
  unless @data
114
114
  begin
115
115
  saved_lineno = $.
116
+
117
+ # TODO It should be use `File.open`, but bundler-1.16.1 example expects Kernel#open.
116
118
  open loaded_from, OPEN_MODE do |file|
117
119
  begin
118
120
  file.readline # discard encoding line
@@ -25,7 +25,9 @@ unless Gem::Dependency.new('rdoc', '>= 3.10').matching_specs.empty?
25
25
  gem 'json'
26
26
  end
27
27
 
28
- require 'bundler'
28
+ if Gem::USE_BUNDLER_FOR_GEMDEPS
29
+ require 'bundler'
30
+ end
29
31
  require 'minitest/autorun'
30
32
 
31
33
  require 'rubygems/deprecate'
@@ -84,7 +86,9 @@ end
84
86
  #
85
87
  # Tests are always run at a safe level of 1.
86
88
 
87
- class Gem::TestCase < MiniTest::Unit::TestCase
89
+ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Unit::TestCase)
90
+
91
+ extend Gem::Deprecate
88
92
 
89
93
  attr_accessor :fetcher # :nodoc:
90
94
 
@@ -235,7 +239,9 @@ class Gem::TestCase < MiniTest::Unit::TestCase
235
239
  @current_dir = Dir.pwd
236
240
  @fetcher = nil
237
241
 
238
- Bundler.ui = Bundler::UI::Silent.new
242
+ if Gem::USE_BUNDLER_FOR_GEMDEPS
243
+ Bundler.ui = Bundler::UI::Silent.new
244
+ end
239
245
  @back_ui = Gem::DefaultUserInteraction.ui
240
246
  @ui = Gem::MockGemUi.new
241
247
  # This needs to be a new instance since we call use_ui(@ui) when we want to
@@ -291,7 +297,16 @@ class Gem::TestCase < MiniTest::Unit::TestCase
291
297
 
292
298
  @orig_LOAD_PATH = $LOAD_PATH.dup
293
299
  $LOAD_PATH.map! { |s|
294
- (expand_path = File.expand_path(s)) == s ? s : expand_path.untaint
300
+ expand_path = File.expand_path(s)
301
+ if expand_path != s
302
+ expand_path.untaint
303
+ if s.instance_variable_defined?(:@gem_prelude_index)
304
+ expand_path.instance_variable_set(:@gem_prelude_index, expand_path)
305
+ end
306
+ expand_path.freeze if s.frozen?
307
+ s = expand_path
308
+ end
309
+ s
295
310
  }
296
311
 
297
312
  Dir.chdir @tempdir
@@ -331,7 +346,9 @@ class Gem::TestCase < MiniTest::Unit::TestCase
331
346
  Gem.loaded_specs.clear
332
347
  Gem.clear_default_specs
333
348
  Gem::Specification.unresolved_deps.clear
334
- Bundler.reset!
349
+ if Gem::USE_BUNDLER_FOR_GEMDEPS
350
+ Bundler.reset!
351
+ end
335
352
 
336
353
  Gem.configuration.verbose = true
337
354
  Gem.configuration.update_sources = true
@@ -482,7 +499,7 @@ class Gem::TestCase < MiniTest::Unit::TestCase
482
499
 
483
500
  gemspec = "#{name}.gemspec"
484
501
 
485
- open File.join(directory, gemspec), 'w' do |io|
502
+ File.open File.join(directory, gemspec), 'w' do |io|
486
503
  io.write git_spec.to_ruby
487
504
  end
488
505
 
@@ -586,7 +603,7 @@ class Gem::TestCase < MiniTest::Unit::TestCase
586
603
  # Reads a Marshal file at +path+
587
604
 
588
605
  def read_cache(path)
589
- open path.dup.untaint, 'rb' do |io|
606
+ File.open path.dup.untaint, 'rb' do |io|
590
607
  Marshal.load io.read
591
608
  end
592
609
  end
@@ -606,7 +623,7 @@ class Gem::TestCase < MiniTest::Unit::TestCase
606
623
  dir = File.dirname path
607
624
  FileUtils.mkdir_p dir unless File.directory? dir
608
625
 
609
- open path, 'wb' do |io|
626
+ File.open path, 'wb' do |io|
610
627
  yield io if block_given?
611
628
  end
612
629
 
@@ -657,11 +674,13 @@ class Gem::TestCase < MiniTest::Unit::TestCase
657
674
  end
658
675
 
659
676
  ##
660
- # TODO: remove in RubyGems 3.0
677
+ # TODO: remove in RubyGems 4.0
661
678
 
662
679
  def quick_spec name, version = '2' # :nodoc:
663
680
  util_spec name, version
664
681
  end
682
+ deprecate :quick_spec, :util_spec, 2018, 12
683
+
665
684
 
666
685
  ##
667
686
  # Builds a gem from +spec+ and places it in <tt>File.join @gemhome,
@@ -721,7 +740,7 @@ class Gem::TestCase < MiniTest::Unit::TestCase
721
740
  install_default_specs(*specs)
722
741
 
723
742
  specs.each do |spec|
724
- open spec.loaded_from, 'w' do |io|
743
+ File.open spec.loaded_from, 'w' do |io|
725
744
  io.write spec.to_ruby_for_cache
726
745
  end
727
746
  end
@@ -750,13 +769,16 @@ class Gem::TestCase < MiniTest::Unit::TestCase
750
769
  old_loaded_features = $LOADED_FEATURES.dup
751
770
  yield
752
771
  ensure
772
+ prefix = File.dirname(__FILE__) + "/"
773
+ new_features = ($LOADED_FEATURES - old_loaded_features)
774
+ old_loaded_features.concat(new_features.select {|f| f.rindex(prefix, 0)})
753
775
  $LOADED_FEATURES.replace old_loaded_features
754
776
  end
755
777
 
756
778
  ##
757
779
  # new_spec is deprecated as it is never used.
758
780
  #
759
- # TODO: remove in RubyGems 3.0
781
+ # TODO: remove in RubyGems 4.0
760
782
 
761
783
  def new_spec name, version, deps = nil, *files # :nodoc:
762
784
  require 'rubygems/specification'
@@ -797,6 +819,8 @@ class Gem::TestCase < MiniTest::Unit::TestCase
797
819
 
798
820
  spec
799
821
  end
822
+ # TODO: mark deprecate after replacing util_spec from new_spec
823
+ # deprecate :new_spec, :none, 2018, 12
800
824
 
801
825
  def new_default_spec(name, version, deps = nil, *files)
802
826
  spec = util_spec name, version, deps
@@ -1357,7 +1381,7 @@ Also, a list:
1357
1381
  yield specification if block_given?
1358
1382
  end
1359
1383
 
1360
- open File.join(directory, "#{name}.gemspec"), 'w' do |io|
1384
+ File.open File.join(directory, "#{name}.gemspec"), 'w' do |io|
1361
1385
  io.write vendor_spec.to_ruby
1362
1386
  end
1363
1387
 
@@ -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
@@ -346,7 +346,7 @@ class Gem::TestCase::SpecFetcherSetup
346
346
  end
347
347
 
348
348
  def write_spec spec # :nodoc:
349
- open spec.spec_file, 'w' do |io|
349
+ File.open spec.spec_file, 'w' do |io|
350
350
  io.write spec.to_ruby_for_cache
351
351
  end
352
352
  end
@@ -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
data/lib/rubygems/util.rb CHANGED
@@ -114,7 +114,8 @@ module Gem::Util
114
114
 
115
115
  here = File.expand_path directory
116
116
  loop do
117
- Dir.chdir here, &block
117
+ Dir.chdir here, &block rescue Errno::EACCES
118
+
118
119
  new_here = File.expand_path('..', here)
119
120
  return if new_here == here # toplevel
120
121
  here = new_here
@@ -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
@@ -34,7 +34,7 @@ class Gem::Validator
34
34
  # gem_path:: [String] Path to gem file
35
35
 
36
36
  def verify_gem_file(gem_path)
37
- open gem_path, Gem.binary_mode do |file|
37
+ File.open gem_path, Gem.binary_mode do |file|
38
38
  gem_data = file.read
39
39
  verify_gem gem_data
40
40
  end
@@ -109,7 +109,7 @@ class Gem::Validator
109
109
 
110
110
  good, gone, unreadable = nil, nil, nil, nil
111
111
 
112
- open gem_path, Gem.binary_mode do |file|
112
+ File.open gem_path, Gem.binary_mode do |file|
113
113
  package = Gem::Package.new gem_path
114
114
 
115
115
  good, gone = package.contents.partition { |file_name|
@@ -134,7 +134,7 @@ class Gem::Validator
134
134
 
135
135
  source = File.join gem_directory, entry['path']
136
136
 
137
- open source, Gem.binary_mode do |f|
137
+ File.open source, Gem.binary_mode do |f|
138
138
  unless f.read == data then
139
139
  errors[gem_name][entry['path']] = "Modified from original"
140
140
  end
@@ -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
  ##
data/lib/ubygems.rb CHANGED
@@ -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
@@ -7,7 +7,7 @@ require 'pathname'
7
7
  require 'tmpdir'
8
8
 
9
9
  # TODO: push this up to test_case.rb once battle tested
10
- $SAFE=1
10
+
11
11
  $LOAD_PATH.map! do |path|
12
12
  path.dup.untaint
13
13
  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
@@ -463,7 +498,7 @@ class TestGem < Gem::TestCase
463
498
  assert File.directory?(util_cache_dir)
464
499
  end
465
500
 
466
- unless win_platform? then # only for FS that support write protection
501
+ unless win_platform? || Process.uid.zero? then # only for FS that support write protection
467
502
  def test_self_ensure_gem_directories_write_protected
468
503
  gemdir = File.join @tempdir, "egd"
469
504
  FileUtils.rm_r gemdir rescue nil
@@ -775,7 +810,7 @@ class TestGem < Gem::TestCase
775
810
  end
776
811
 
777
812
  def test_self_read_binary
778
- open 'test', 'w' do |io|
813
+ File.open 'test', 'w' do |io|
779
814
  io.write "\xCF\x80"
780
815
  end
781
816
 
@@ -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,12 +1511,15 @@ 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
1483
- BUNDLER_LIB_PATH = File.expand_path $LOAD_PATH.find {|lp| File.file?(File.join(lp, "bundler.rb")) }.dup.untaint
1484
- BUNDLER_FULL_NAME = "bundler-#{Bundler::VERSION}"
1518
+
1519
+ if Gem::USE_BUNDLER_FOR_GEMDEPS
1520
+ BUNDLER_LIB_PATH = File.expand_path $LOAD_PATH.find {|lp| File.file?(File.join(lp, "bundler.rb")) }.dup.untaint
1521
+ BUNDLER_FULL_NAME = "bundler-#{Bundler::VERSION}"
1522
+ end
1485
1523
 
1486
1524
  def add_bundler_full_name(names)
1487
1525
  return names unless Gem::USE_BUNDLER_FOR_GEMDEPS
@@ -1529,7 +1567,7 @@ class TestGem < Gem::TestCase
1529
1567
  out = IO.popen(cmd, &:read).split(/\n/)
1530
1568
 
1531
1569
  assert_equal ["b-1", "c-1"], out - out0
1532
- end
1570
+ end if Gem::USE_BUNDLER_FOR_GEMDEPS
1533
1571
 
1534
1572
  def test_looks_for_gemdeps_files_automatically_on_start_in_parent_dir
1535
1573
  util_clear_gems
@@ -1574,7 +1612,7 @@ class TestGem < Gem::TestCase
1574
1612
  Dir.rmdir "sub1"
1575
1613
 
1576
1614
  assert_equal ["b-1", "c-1"], out - out0
1577
- end
1615
+ end if Gem::USE_BUNDLER_FOR_GEMDEPS
1578
1616
 
1579
1617
  def test_register_default_spec
1580
1618
  Gem.clear_default_specs
@@ -1587,7 +1625,7 @@ class TestGem < Gem::TestCase
1587
1625
 
1588
1626
  assert_equal old_style, Gem.find_unresolved_default_spec("foo.rb")
1589
1627
  assert_equal old_style, Gem.find_unresolved_default_spec("bar.rb")
1590
- assert_equal nil, Gem.find_unresolved_default_spec("baz.rb")
1628
+ assert_nil Gem.find_unresolved_default_spec("baz.rb")
1591
1629
 
1592
1630
  Gem.clear_default_specs
1593
1631
 
@@ -1600,8 +1638,8 @@ class TestGem < Gem::TestCase
1600
1638
 
1601
1639
  assert_equal new_style, Gem.find_unresolved_default_spec("foo.rb")
1602
1640
  assert_equal new_style, Gem.find_unresolved_default_spec("bar.rb")
1603
- assert_equal nil, Gem.find_unresolved_default_spec("exec")
1604
- 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")
1605
1643
  end
1606
1644
 
1607
1645
  def test_default_gems_use_full_paths
@@ -1639,7 +1677,7 @@ class TestGem < Gem::TestCase
1639
1677
  spec = Gem::Specification.find { |s| s == spec }
1640
1678
  refute spec.activated?
1641
1679
 
1642
- open gem_deps_file, 'w' do |io|
1680
+ File.open gem_deps_file, 'w' do |io|
1643
1681
  io.write 'gem "a"'
1644
1682
  end
1645
1683
 
@@ -1658,7 +1696,7 @@ class TestGem < Gem::TestCase
1658
1696
 
1659
1697
  refute spec.activated?
1660
1698
 
1661
- open 'gem.deps.rb', 'w' do |io|
1699
+ File.open 'gem.deps.rb', 'w' do |io|
1662
1700
  io.write 'gem "a"'
1663
1701
  end
1664
1702
 
@@ -1702,7 +1740,7 @@ class TestGem < Gem::TestCase
1702
1740
 
1703
1741
  refute spec.activated?
1704
1742
 
1705
- open 'Gemfile', 'w' do |io|
1743
+ File.open 'Gemfile', 'w' do |io|
1706
1744
  io.write 'gem "a"'
1707
1745
  end
1708
1746
 
@@ -1731,7 +1769,7 @@ class TestGem < Gem::TestCase
1731
1769
 
1732
1770
  refute spec.activated?
1733
1771
 
1734
- open 'gem.deps.rb', 'w' do |io|
1772
+ File.open 'gem.deps.rb', 'w' do |io|
1735
1773
  io.write 'gem "a"'
1736
1774
  end
1737
1775
 
@@ -1746,7 +1784,7 @@ class TestGem < Gem::TestCase
1746
1784
  skip 'Insecure operation - read' if RUBY_VERSION <= "1.8.7"
1747
1785
  rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], 'x'
1748
1786
 
1749
- open 'x', 'w' do |io|
1787
+ File.open 'x', 'w' do |io|
1750
1788
  io.write 'gem "a"'
1751
1789
  end
1752
1790
 
@@ -1775,7 +1813,7 @@ You may need to `gem install -g` to install missing gems
1775
1813
  end
1776
1814
  ensure
1777
1815
  ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
1778
- end
1816
+ end if Gem::USE_BUNDLER_FOR_GEMDEPS
1779
1817
 
1780
1818
  def test_use_gemdeps_specific
1781
1819
  skip 'Insecure operation - read' if RUBY_VERSION <= "1.8.7"
@@ -1787,7 +1825,7 @@ You may need to `gem install -g` to install missing gems
1787
1825
  spec = Gem::Specification.find { |s| s == spec }
1788
1826
  refute spec.activated?
1789
1827
 
1790
- open 'x', 'w' do |io|
1828
+ File.open 'x', 'w' do |io|
1791
1829
  io.write 'gem "a"'
1792
1830
  end
1793
1831