rubygems-update 3.2.24 → 3.2.28

Sign up to get free protection for your applications and to get access to all the features.
Files changed (276) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +57 -0
  3. data/Manifest.txt +7 -7
  4. data/bundler/CHANGELOG.md +62 -0
  5. data/bundler/lib/bundler/build_metadata.rb +2 -2
  6. data/bundler/lib/bundler/cli/cache.rb +1 -1
  7. data/bundler/lib/bundler/cli/doctor.rb +1 -1
  8. data/bundler/lib/bundler/cli/exec.rb +1 -6
  9. data/bundler/lib/bundler/cli/gem.rb +3 -2
  10. data/bundler/lib/bundler/cli/install.rb +4 -17
  11. data/bundler/lib/bundler/cli/list.rb +7 -1
  12. data/bundler/lib/bundler/cli/open.rb +1 -2
  13. data/bundler/lib/bundler/cli/remove.rb +1 -2
  14. data/bundler/lib/bundler/cli/update.rb +1 -1
  15. data/bundler/lib/bundler/cli.rb +12 -9
  16. data/bundler/lib/bundler/definition.rb +25 -29
  17. data/bundler/lib/bundler/dsl.rb +14 -1
  18. data/bundler/lib/bundler/errors.rb +1 -1
  19. data/bundler/lib/bundler/installer/gem_installer.rb +3 -16
  20. data/bundler/lib/bundler/installer/standalone.rb +13 -8
  21. data/bundler/lib/bundler/installer.rb +0 -1
  22. data/bundler/lib/bundler/lockfile_parser.rb +1 -0
  23. data/bundler/lib/bundler/plugin/installer.rb +2 -0
  24. data/bundler/lib/bundler/plugin.rb +23 -6
  25. data/bundler/lib/bundler/resolver.rb +10 -17
  26. data/bundler/lib/bundler/rubygems_gem_installer.rb +5 -1
  27. data/bundler/lib/bundler/rubygems_integration.rb +2 -0
  28. data/bundler/lib/bundler/runtime.rb +15 -6
  29. data/bundler/lib/bundler/settings.rb +13 -1
  30. data/bundler/lib/bundler/setup.rb +2 -2
  31. data/bundler/lib/bundler/shared_helpers.rb +0 -7
  32. data/bundler/lib/bundler/source/git/git_proxy.rb +1 -2
  33. data/bundler/lib/bundler/source/rubygems.rb +23 -2
  34. data/bundler/lib/bundler/source/rubygems_aggregate.rb +4 -0
  35. data/bundler/lib/bundler/source.rb +4 -0
  36. data/bundler/lib/bundler/source_list.rb +16 -3
  37. data/bundler/lib/bundler/spec_set.rb +13 -35
  38. data/bundler/lib/bundler/templates/Executable.bundler +6 -6
  39. data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +13 -2
  40. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +4 -2
  41. data/bundler/lib/bundler/version.rb +1 -1
  42. data/bundler/lib/bundler/worker.rb +17 -2
  43. data/bundler/lib/bundler.rb +11 -21
  44. data/lib/rubygems/command_manager.rb +3 -3
  45. data/lib/rubygems/commands/build_command.rb +3 -3
  46. data/lib/rubygems/commands/cert_command.rb +2 -2
  47. data/lib/rubygems/commands/check_command.rb +4 -4
  48. data/lib/rubygems/commands/cleanup_command.rb +3 -3
  49. data/lib/rubygems/commands/contents_command.rb +2 -2
  50. data/lib/rubygems/commands/dependency_command.rb +3 -3
  51. data/lib/rubygems/commands/environment_command.rb +1 -1
  52. data/lib/rubygems/commands/fetch_command.rb +3 -3
  53. data/lib/rubygems/commands/generate_index_command.rb +2 -2
  54. data/lib/rubygems/commands/help_command.rb +1 -1
  55. data/lib/rubygems/commands/info_command.rb +2 -2
  56. data/lib/rubygems/commands/install_command.rb +12 -11
  57. data/lib/rubygems/commands/list_command.rb +2 -2
  58. data/lib/rubygems/commands/lock_command.rb +1 -1
  59. data/lib/rubygems/commands/mirror_command.rb +1 -1
  60. data/lib/rubygems/commands/open_command.rb +2 -2
  61. data/lib/rubygems/commands/outdated_command.rb +4 -4
  62. data/lib/rubygems/commands/owner_command.rb +4 -4
  63. data/lib/rubygems/commands/pristine_command.rb +5 -5
  64. data/lib/rubygems/commands/push_command.rb +4 -4
  65. data/lib/rubygems/commands/query_command.rb +3 -3
  66. data/lib/rubygems/commands/rdoc_command.rb +3 -3
  67. data/lib/rubygems/commands/search_command.rb +2 -2
  68. data/lib/rubygems/commands/server_command.rb +3 -3
  69. data/lib/rubygems/commands/setup_command.rb +5 -5
  70. data/lib/rubygems/commands/signin_command.rb +2 -2
  71. data/lib/rubygems/commands/signout_command.rb +1 -1
  72. data/lib/rubygems/commands/sources_command.rb +4 -4
  73. data/lib/rubygems/commands/specification_command.rb +4 -4
  74. data/lib/rubygems/commands/stale_command.rb +1 -1
  75. data/lib/rubygems/commands/uninstall_command.rb +3 -3
  76. data/lib/rubygems/commands/unpack_command.rb +5 -5
  77. data/lib/rubygems/commands/update_command.rb +9 -9
  78. data/lib/rubygems/commands/which_command.rb +1 -1
  79. data/lib/rubygems/commands/yank_command.rb +4 -4
  80. data/lib/rubygems/config_file.rb +5 -5
  81. data/lib/rubygems/dependency_installer.rb +8 -8
  82. data/lib/rubygems/dependency_list.rb +1 -1
  83. data/lib/rubygems/doctor.rb +2 -2
  84. data/lib/rubygems/exceptions.rb +1 -1
  85. data/lib/rubygems/ext/builder.rb +1 -0
  86. data/lib/rubygems/ext/ext_conf_builder.rb +1 -2
  87. data/lib/rubygems/ext/rake_builder.rb +1 -2
  88. data/lib/rubygems/gem_runner.rb +3 -3
  89. data/lib/rubygems/gemcutter_utilities.rb +2 -2
  90. data/lib/rubygems/indexer.rb +2 -2
  91. data/lib/rubygems/install_default_message.rb +2 -2
  92. data/lib/rubygems/install_message.rb +2 -2
  93. data/lib/rubygems/install_update_options.rb +2 -2
  94. data/lib/rubygems/installer.rb +17 -8
  95. data/lib/rubygems/local_remote_options.rb +1 -1
  96. data/lib/rubygems/mock_gem_ui.rb +1 -1
  97. data/lib/rubygems/package/tar_reader.rb +1 -1
  98. data/lib/rubygems/package.rb +12 -12
  99. data/lib/rubygems/package_task.rb +2 -2
  100. data/lib/rubygems/platform.rb +2 -1
  101. data/lib/rubygems/rdoc.rb +1 -1
  102. data/lib/rubygems/remote_fetcher.rb +14 -21
  103. data/lib/rubygems/request.rb +5 -5
  104. data/lib/rubygems/request_set/lockfile/tokenizer.rb +1 -1
  105. data/lib/rubygems/request_set/lockfile.rb +1 -1
  106. data/lib/rubygems/request_set.rb +4 -4
  107. data/lib/rubygems/requirement.rb +3 -22
  108. data/lib/rubygems/resolver/git_specification.rb +1 -1
  109. data/lib/rubygems/resolver/installer_set.rb +3 -3
  110. data/lib/rubygems/resolver/molinillo.rb +1 -1
  111. data/lib/rubygems/resolver/set.rb +0 -1
  112. data/lib/rubygems/resolver/specification.rb +1 -1
  113. data/lib/rubygems/resolver.rb +31 -31
  114. data/lib/rubygems/s3_uri_signer.rb +0 -1
  115. data/lib/rubygems/safe_yaml.rb +0 -2
  116. data/lib/rubygems/security/policy.rb +1 -1
  117. data/lib/rubygems/security/signer.rb +1 -1
  118. data/lib/rubygems/security.rb +5 -5
  119. data/lib/rubygems/security_option.rb +2 -2
  120. data/lib/rubygems/server.rb +2 -2
  121. data/lib/rubygems/source.rb +6 -6
  122. data/lib/rubygems/spec_fetcher.rb +5 -5
  123. data/lib/rubygems/specification.rb +9 -15
  124. data/lib/rubygems/specification_policy.rb +2 -2
  125. data/lib/rubygems/uninstaller.rb +6 -6
  126. data/lib/rubygems/uri.rb +111 -0
  127. data/lib/rubygems/user_interaction.rb +2 -2
  128. data/lib/rubygems/util/licenses.rb +1 -1
  129. data/lib/rubygems/validator.rb +2 -2
  130. data/lib/rubygems/version_option.rb +1 -1
  131. data/lib/rubygems.rb +37 -47
  132. data/rubygems-update.gemspec +1 -1
  133. data/test/rubygems/data/null-type.gemspec.rz +0 -0
  134. data/{lib/rubygems/test_case.rb → test/rubygems/helper.rb} +16 -19
  135. data/{lib → test}/rubygems/installer_test_case.rb +1 -1
  136. data/{lib → test}/rubygems/package/tar_test_case.rb +1 -1
  137. data/test/rubygems/test_bundled_ca.rb +1 -1
  138. data/test/rubygems/test_config.rb +1 -1
  139. data/test/rubygems/test_deprecate.rb +1 -1
  140. data/test/rubygems/test_gem.rb +190 -136
  141. data/test/rubygems/test_gem_available_set.rb +1 -1
  142. data/test/rubygems/test_gem_bundler_version_finder.rb +1 -1
  143. data/test/rubygems/test_gem_command.rb +1 -1
  144. data/test/rubygems/test_gem_command_manager.rb +1 -1
  145. data/test/rubygems/test_gem_commands_build_command.rb +1 -1
  146. data/test/rubygems/test_gem_commands_cert_command.rb +1 -1
  147. data/test/rubygems/test_gem_commands_check_command.rb +1 -1
  148. data/test/rubygems/test_gem_commands_cleanup_command.rb +1 -1
  149. data/test/rubygems/test_gem_commands_contents_command.rb +1 -1
  150. data/test/rubygems/test_gem_commands_dependency_command.rb +1 -1
  151. data/test/rubygems/test_gem_commands_environment_command.rb +1 -1
  152. data/test/rubygems/test_gem_commands_fetch_command.rb +1 -1
  153. data/test/rubygems/test_gem_commands_generate_index_command.rb +1 -1
  154. data/test/rubygems/test_gem_commands_help_command.rb +1 -1
  155. data/test/rubygems/test_gem_commands_info_command.rb +1 -1
  156. data/test/rubygems/test_gem_commands_install_command.rb +26 -1
  157. data/test/rubygems/test_gem_commands_list_command.rb +1 -1
  158. data/test/rubygems/test_gem_commands_lock_command.rb +1 -1
  159. data/test/rubygems/test_gem_commands_mirror.rb +1 -1
  160. data/test/rubygems/test_gem_commands_open_command.rb +1 -1
  161. data/test/rubygems/test_gem_commands_outdated_command.rb +1 -1
  162. data/test/rubygems/test_gem_commands_owner_command.rb +1 -1
  163. data/test/rubygems/test_gem_commands_pristine_command.rb +1 -1
  164. data/test/rubygems/test_gem_commands_push_command.rb +1 -1
  165. data/test/rubygems/test_gem_commands_query_command.rb +1 -1
  166. data/test/rubygems/test_gem_commands_search_command.rb +1 -1
  167. data/test/rubygems/test_gem_commands_server_command.rb +1 -1
  168. data/test/rubygems/test_gem_commands_setup_command.rb +3 -3
  169. data/test/rubygems/test_gem_commands_signin_command.rb +1 -1
  170. data/test/rubygems/test_gem_commands_signout_command.rb +1 -1
  171. data/test/rubygems/test_gem_commands_sources_command.rb +1 -1
  172. data/test/rubygems/test_gem_commands_specification_command.rb +1 -1
  173. data/test/rubygems/test_gem_commands_stale_command.rb +1 -1
  174. data/test/rubygems/test_gem_commands_uninstall_command.rb +1 -1
  175. data/test/rubygems/test_gem_commands_unpack_command.rb +1 -1
  176. data/test/rubygems/test_gem_commands_update_command.rb +1 -1
  177. data/test/rubygems/test_gem_commands_which_command.rb +1 -1
  178. data/test/rubygems/test_gem_commands_yank_command.rb +1 -1
  179. data/test/rubygems/test_gem_config_file.rb +1 -1
  180. data/test/rubygems/test_gem_dependency.rb +1 -1
  181. data/test/rubygems/test_gem_dependency_installer.rb +1 -1
  182. data/test/rubygems/test_gem_dependency_list.rb +1 -1
  183. data/test/rubygems/test_gem_dependency_resolution_error.rb +1 -1
  184. data/test/rubygems/test_gem_doctor.rb +1 -1
  185. data/test/rubygems/test_gem_ext_builder.rb +4 -1
  186. data/test/rubygems/test_gem_ext_cmake_builder.rb +1 -1
  187. data/test/rubygems/test_gem_ext_configure_builder.rb +1 -1
  188. data/test/rubygems/test_gem_ext_ext_conf_builder.rb +1 -1
  189. data/test/rubygems/test_gem_ext_rake_builder.rb +1 -1
  190. data/test/rubygems/test_gem_gem_runner.rb +1 -1
  191. data/test/rubygems/test_gem_gemcutter_utilities.rb +1 -1
  192. data/test/rubygems/test_gem_impossible_dependencies_error.rb +1 -1
  193. data/test/rubygems/test_gem_indexer.rb +1 -1
  194. data/test/rubygems/test_gem_install_update_options.rb +1 -1
  195. data/test/rubygems/test_gem_installer.rb +4 -2
  196. data/test/rubygems/test_gem_local_remote_options.rb +1 -1
  197. data/test/rubygems/test_gem_name_tuple.rb +1 -1
  198. data/test/rubygems/test_gem_package.rb +1 -1
  199. data/test/rubygems/test_gem_package_old.rb +1 -1
  200. data/test/rubygems/test_gem_package_tar_header.rb +1 -1
  201. data/test/rubygems/test_gem_package_tar_reader.rb +1 -1
  202. data/test/rubygems/test_gem_package_tar_reader_entry.rb +1 -1
  203. data/test/rubygems/test_gem_package_tar_writer.rb +1 -1
  204. data/test/rubygems/test_gem_package_task.rb +1 -1
  205. data/test/rubygems/test_gem_path_support.rb +1 -1
  206. data/test/rubygems/test_gem_platform.rb +2 -1
  207. data/test/rubygems/test_gem_rdoc.rb +1 -1
  208. data/test/rubygems/test_gem_remote_fetcher.rb +31 -1
  209. data/test/rubygems/test_gem_request.rb +36 -10
  210. data/test/rubygems/test_gem_request_connection_pools.rb +1 -1
  211. data/test/rubygems/test_gem_request_set.rb +1 -1
  212. data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +1 -1
  213. data/test/rubygems/test_gem_request_set_lockfile.rb +1 -1
  214. data/test/rubygems/test_gem_request_set_lockfile_parser.rb +1 -1
  215. data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +1 -1
  216. data/test/rubygems/test_gem_requirement.rb +35 -1
  217. data/test/rubygems/test_gem_resolver.rb +1 -1
  218. data/test/rubygems/test_gem_resolver_activation_request.rb +1 -1
  219. data/test/rubygems/test_gem_resolver_api_set.rb +1 -1
  220. data/test/rubygems/test_gem_resolver_api_specification.rb +1 -1
  221. data/test/rubygems/test_gem_resolver_best_set.rb +1 -1
  222. data/test/rubygems/test_gem_resolver_composed_set.rb +1 -1
  223. data/test/rubygems/test_gem_resolver_conflict.rb +1 -1
  224. data/test/rubygems/test_gem_resolver_dependency_request.rb +1 -1
  225. data/test/rubygems/test_gem_resolver_git_set.rb +1 -1
  226. data/test/rubygems/test_gem_resolver_git_specification.rb +2 -1
  227. data/test/rubygems/test_gem_resolver_index_set.rb +1 -1
  228. data/test/rubygems/test_gem_resolver_index_specification.rb +1 -1
  229. data/test/rubygems/test_gem_resolver_installed_specification.rb +1 -1
  230. data/test/rubygems/test_gem_resolver_installer_set.rb +19 -1
  231. data/test/rubygems/test_gem_resolver_local_specification.rb +1 -1
  232. data/test/rubygems/test_gem_resolver_lock_set.rb +1 -1
  233. data/test/rubygems/test_gem_resolver_lock_specification.rb +1 -1
  234. data/test/rubygems/test_gem_resolver_requirement_list.rb +1 -1
  235. data/test/rubygems/test_gem_resolver_specification.rb +1 -1
  236. data/test/rubygems/test_gem_resolver_vendor_set.rb +1 -1
  237. data/test/rubygems/test_gem_resolver_vendor_specification.rb +1 -1
  238. data/test/rubygems/test_gem_security.rb +1 -1
  239. data/test/rubygems/test_gem_security_policy.rb +1 -1
  240. data/test/rubygems/test_gem_security_signer.rb +1 -1
  241. data/test/rubygems/test_gem_security_trust_dir.rb +1 -1
  242. data/test/rubygems/test_gem_server.rb +1 -1
  243. data/test/rubygems/test_gem_silent_ui.rb +1 -1
  244. data/test/rubygems/test_gem_source.rb +1 -1
  245. data/test/rubygems/test_gem_source_fetch_problem.rb +1 -1
  246. data/test/rubygems/test_gem_source_git.rb +1 -1
  247. data/test/rubygems/test_gem_source_installed.rb +1 -1
  248. data/test/rubygems/test_gem_source_list.rb +1 -1
  249. data/test/rubygems/test_gem_source_local.rb +1 -1
  250. data/test/rubygems/test_gem_source_lock.rb +1 -1
  251. data/test/rubygems/test_gem_source_specific_file.rb +1 -1
  252. data/test/rubygems/test_gem_source_subpath_problem.rb +1 -1
  253. data/test/rubygems/test_gem_source_vendor.rb +1 -1
  254. data/test/rubygems/test_gem_spec_fetcher.rb +1 -1
  255. data/test/rubygems/test_gem_specification.rb +15 -165
  256. data/test/rubygems/test_gem_stream_ui.rb +1 -1
  257. data/test/rubygems/test_gem_stub_specification.rb +1 -1
  258. data/test/rubygems/test_gem_text.rb +1 -1
  259. data/test/rubygems/test_gem_uninstaller.rb +1 -1
  260. data/test/rubygems/test_gem_unsatisfiable_dependency_error.rb +1 -1
  261. data/test/rubygems/test_gem_uri.rb +39 -0
  262. data/test/rubygems/test_gem_uri_formatter.rb +1 -1
  263. data/test/rubygems/test_gem_util.rb +1 -1
  264. data/test/rubygems/test_gem_validator.rb +1 -1
  265. data/test/rubygems/test_gem_version.rb +1 -1
  266. data/test/rubygems/test_gem_version_option.rb +1 -1
  267. data/test/rubygems/test_kernel.rb +1 -1
  268. data/test/rubygems/test_project_sanity.rb +1 -1
  269. data/test/rubygems/test_remote_fetch_error.rb +1 -1
  270. data/test/rubygems/test_require.rb +1 -1
  271. data/test/rubygems/test_rubygems.rb +44 -0
  272. data/{lib/rubygems/test_utilities.rb → test/rubygems/utilities.rb} +0 -2
  273. metadata +10 -10
  274. data/lib/rubygems/syck_hack.rb +0 -77
  275. data/lib/rubygems/uri_parser.rb +0 -34
  276. data/lib/rubygems/uri_parsing.rb +0 -23
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require 'rubygems/test_case'
2
+ require_relative 'helper'
3
3
  require 'rubygems/deprecate'
4
4
 
5
5
  class TestDeprecate < Gem::TestCase
@@ -1,5 +1,5 @@
1
1
  # coding: US-ASCII
2
- require 'rubygems/test_case'
2
+ require_relative 'helper'
3
3
  require 'rubygems'
4
4
  require 'rubygems/command'
5
5
  require 'rubygems/installer'
@@ -19,7 +19,6 @@ class TestGem < Gem::TestCase
19
19
 
20
20
  common_installer_setup
21
21
 
22
- ENV.delete 'RUBYGEMS_GEMDEPS'
23
22
  @additional = %w[a b].map {|d| File.join @tempdir, d }
24
23
 
25
24
  util_remove_interrupt_command
@@ -540,7 +539,6 @@ class TestGem < Gem::TestCase
540
539
  s.executables = []
541
540
  end
542
541
  install_specs spec
543
- # Should not find a-10's non-abin (bug)
544
542
  assert_equal @abin_path, Gem.bin_path('a', 'abin')
545
543
  end
546
544
 
@@ -664,22 +662,22 @@ class TestGem < Gem::TestCase
664
662
  end
665
663
 
666
664
  def test_self_use_gemdeps
667
- rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], '-'
665
+ with_rubygems_gemdeps('-') do
666
+ FileUtils.mkdir_p 'detect/a/b'
667
+ FileUtils.mkdir_p 'detect/a/Isolate'
668
668
 
669
- FileUtils.mkdir_p 'detect/a/b'
670
- FileUtils.mkdir_p 'detect/a/Isolate'
669
+ FileUtils.touch 'detect/Isolate'
671
670
 
672
- FileUtils.touch 'detect/Isolate'
671
+ begin
672
+ Dir.chdir 'detect/a/b'
673
673
 
674
- begin
675
- Dir.chdir 'detect/a/b'
674
+ Gem.use_gemdeps
676
675
 
677
- assert_equal add_bundler_full_name([]), Gem.use_gemdeps.map(&:full_name)
678
- ensure
679
- Dir.chdir @tempdir
676
+ assert_equal add_bundler_full_name([]), loaded_spec_names
677
+ ensure
678
+ Dir.chdir @tempdir
679
+ end
680
680
  end
681
- ensure
682
- ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
683
681
  end
684
682
 
685
683
  def test_self_dir
@@ -1580,6 +1578,31 @@ class TestGem < Gem::TestCase
1580
1578
  assert_equal %w[plugin], PLUGINS_LOADED
1581
1579
  end
1582
1580
 
1581
+ def test_load_user_installed_plugins
1582
+ plugin_path = File.join "lib", "rubygems_plugin.rb"
1583
+
1584
+ Dir.chdir @tempdir do
1585
+ FileUtils.mkdir_p 'lib'
1586
+ File.open plugin_path, "w" do |fp|
1587
+ fp.puts "class TestGem; PLUGINS_LOADED << 'plugin'; end"
1588
+ end
1589
+
1590
+ foo = util_spec 'foo', '1' do |s|
1591
+ s.files << plugin_path
1592
+ end
1593
+
1594
+ install_gem_user foo
1595
+ end
1596
+
1597
+ Gem.paths = { "GEM_PATH" => [Gem.dir, Gem.user_dir].join(File::PATH_SEPARATOR) }
1598
+
1599
+ gem 'foo'
1600
+
1601
+ Gem.load_plugins
1602
+
1603
+ assert_equal %w[plugin], PLUGINS_LOADED
1604
+ end
1605
+
1583
1606
  def test_load_env_plugins
1584
1607
  with_plugin('load') { Gem.load_env_plugins }
1585
1608
  assert_equal :loaded, TEST_PLUGIN_LOAD rescue nil
@@ -1689,11 +1712,11 @@ class TestGem < Gem::TestCase
1689
1712
  f.puts "gem 'c'"
1690
1713
  end
1691
1714
 
1692
- ENV['RUBYGEMS_GEMDEPS'] = path
1693
-
1694
- Gem.use_gemdeps
1715
+ with_rubygems_gemdeps(path) do
1716
+ Gem.use_gemdeps
1695
1717
 
1696
- assert_equal add_bundler_full_name(%W[a-1 b-1 c-1]), loaded_spec_names
1718
+ assert_equal add_bundler_full_name(%W[a-1 b-1 c-1]), loaded_spec_names
1719
+ end
1697
1720
  end
1698
1721
 
1699
1722
  def test_auto_activation_of_used_gemdeps_file
@@ -1711,10 +1734,13 @@ class TestGem < Gem::TestCase
1711
1734
  f.puts "gem 'c'"
1712
1735
  end
1713
1736
 
1714
- ENV['RUBYGEMS_GEMDEPS'] = "-"
1737
+ with_rubygems_gemdeps("-") do
1738
+ expected_specs = [a, b, util_spec("bundler", Bundler::VERSION), c].compact.map(&:full_name)
1739
+
1740
+ Gem.use_gemdeps
1715
1741
 
1716
- expected_specs = [a, b, util_spec("bundler", Bundler::VERSION), c].compact
1717
- assert_equal expected_specs, Gem.use_gemdeps.sort_by {|s| s.name }
1742
+ assert_equal expected_specs, loaded_spec_names
1743
+ end
1718
1744
  end
1719
1745
 
1720
1746
  BUNDLER_LIB_PATH = File.expand_path $LOAD_PATH.find {|lp| File.file?(File.join(lp, "bundler.rb")) }
@@ -1726,10 +1752,18 @@ class TestGem < Gem::TestCase
1726
1752
  names
1727
1753
  end
1728
1754
 
1729
- def test_looks_for_gemdeps_files_automatically_on_start
1755
+ def test_looks_for_gemdeps_files_automatically_from_binstubs
1730
1756
  pend "Requiring bundler messes things up" if Gem.java_platform?
1731
1757
 
1732
- a = util_spec "a", "1", nil, "lib/a.rb"
1758
+ a = util_spec "a", "1" do |s|
1759
+ s.executables = %w[foo]
1760
+ s.bindir = "exe"
1761
+ end
1762
+
1763
+ write_file File.join(@tempdir, 'exe', 'foo') do |fp|
1764
+ fp.puts "puts Gem.loaded_specs.values.map(&:full_name).sort"
1765
+ end
1766
+
1733
1767
  b = util_spec "b", "1", nil, "lib/b.rb"
1734
1768
  c = util_spec "c", "1", nil, "lib/c.rb"
1735
1769
 
@@ -1741,31 +1775,44 @@ class TestGem < Gem::TestCase
1741
1775
  install_gem c, :install_dir => path
1742
1776
 
1743
1777
  ENV['GEM_PATH'] = path
1744
- ENV['RUBYGEMS_GEMDEPS'] = "-"
1745
1778
 
1746
- path = File.join @tempdir, "gem.deps.rb"
1747
- cmd = [*ruby_with_rubygems_in_load_path,
1748
- "-I#{BUNDLER_LIB_PATH}"]
1749
- cmd << "-eputs Gem.loaded_specs.values.map(&:full_name).sort"
1779
+ with_rubygems_gemdeps("-") do
1780
+ new_PATH = [File.join(path, "bin"), ENV["PATH"]].join(File::PATH_SEPARATOR)
1781
+ new_RUBYOPT = "-I#{rubygems_path} -I#{BUNDLER_LIB_PATH}"
1750
1782
 
1751
- File.open path, "w" do |f|
1752
- f.puts "gem 'a'"
1753
- end
1754
- out0 = IO.popen(cmd, &:read).split(/\n/)
1783
+ path = File.join @tempdir, "gem.deps.rb"
1755
1784
 
1756
- File.open path, "a" do |f|
1757
- f.puts "gem 'b'"
1758
- f.puts "gem 'c'"
1759
- end
1760
- out = IO.popen(cmd, &:read).split(/\n/)
1785
+ File.open path, "w" do |f|
1786
+ f.puts "gem 'a'"
1787
+ end
1788
+ out0 = with_path_and_rubyopt(new_PATH, new_RUBYOPT) do
1789
+ IO.popen("foo", &:read).split(/\n/)
1790
+ end
1791
+
1792
+ File.open path, "a" do |f|
1793
+ f.puts "gem 'b'"
1794
+ f.puts "gem 'c'"
1795
+ end
1796
+ out = with_path_and_rubyopt(new_PATH, new_RUBYOPT) do
1797
+ IO.popen("foo", &:read).split(/\n/)
1798
+ end
1761
1799
 
1762
- assert_equal ["b-1", "c-1"], out - out0
1800
+ assert_equal ["b-1", "c-1"], out - out0
1801
+ end
1763
1802
  end
1764
1803
 
1765
- def test_looks_for_gemdeps_files_automatically_on_start_in_parent_dir
1804
+ def test_looks_for_gemdeps_files_automatically_from_binstubs_in_parent_dir
1766
1805
  pend "Requiring bundler messes things up" if Gem.java_platform?
1767
1806
 
1768
- a = util_spec "a", "1", nil, "lib/a.rb"
1807
+ a = util_spec "a", "1" do |s|
1808
+ s.executables = %w[foo]
1809
+ s.bindir = "exe"
1810
+ end
1811
+
1812
+ write_file File.join(@tempdir, 'exe', 'foo') do |fp|
1813
+ fp.puts "puts Gem.loaded_specs.values.map(&:full_name).sort"
1814
+ end
1815
+
1769
1816
  b = util_spec "b", "1", nil, "lib/b.rb"
1770
1817
  c = util_spec "c", "1", nil, "lib/c.rb"
1771
1818
 
@@ -1777,29 +1824,34 @@ class TestGem < Gem::TestCase
1777
1824
  install_gem c, :install_dir => path
1778
1825
 
1779
1826
  ENV['GEM_PATH'] = path
1780
- ENV['RUBYGEMS_GEMDEPS'] = "-"
1781
1827
 
1782
- Dir.mkdir "sub1"
1828
+ with_rubygems_gemdeps("-") do
1829
+ Dir.mkdir "sub1"
1783
1830
 
1784
- path = File.join @tempdir, "gem.deps.rb"
1785
- cmd = [*ruby_with_rubygems_in_load_path, "-Csub1",
1786
- "-I#{BUNDLER_LIB_PATH}"]
1787
- cmd << "-eputs Gem.loaded_specs.values.map(&:full_name).sort"
1831
+ new_PATH = [File.join(path, "bin"), ENV["PATH"]].join(File::PATH_SEPARATOR)
1832
+ new_RUBYOPT = "-I#{rubygems_path} -I#{BUNDLER_LIB_PATH}"
1788
1833
 
1789
- File.open path, "w" do |f|
1790
- f.puts "gem 'a'"
1791
- end
1792
- out0 = IO.popen(cmd, &:read).split(/\n/)
1834
+ path = File.join @tempdir, "gem.deps.rb"
1793
1835
 
1794
- File.open path, "a" do |f|
1795
- f.puts "gem 'b'"
1796
- f.puts "gem 'c'"
1797
- end
1798
- out = IO.popen(cmd, &:read).split(/\n/)
1836
+ File.open path, "w" do |f|
1837
+ f.puts "gem 'a'"
1838
+ end
1839
+ out0 = with_path_and_rubyopt(new_PATH, new_RUBYOPT) do
1840
+ IO.popen("foo", :chdir => "sub1", &:read).split(/\n/)
1841
+ end
1842
+
1843
+ File.open path, "a" do |f|
1844
+ f.puts "gem 'b'"
1845
+ f.puts "gem 'c'"
1846
+ end
1847
+ out = with_path_and_rubyopt(new_PATH, new_RUBYOPT) do
1848
+ IO.popen("foo", :chdir => "sub1", &:read).split(/\n/)
1849
+ end
1799
1850
 
1800
- Dir.rmdir "sub1"
1851
+ Dir.rmdir "sub1"
1801
1852
 
1802
- assert_equal ["b-1", "c-1"], out - out0
1853
+ assert_equal ["b-1", "c-1"], out - out0
1854
+ end
1803
1855
  end
1804
1856
 
1805
1857
  def test_register_default_spec
@@ -1863,21 +1915,19 @@ class TestGem < Gem::TestCase
1863
1915
  end
1864
1916
 
1865
1917
  def test_use_gemdeps_ENV
1866
- rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], nil
1867
-
1868
- spec = util_spec 'a', 1
1918
+ with_rubygems_gemdeps(nil) do
1919
+ spec = util_spec 'a', 1
1869
1920
 
1870
- refute spec.activated?
1921
+ refute spec.activated?
1871
1922
 
1872
- File.open 'gem.deps.rb', 'w' do |io|
1873
- io.write 'gem "a"'
1874
- end
1923
+ File.open 'gem.deps.rb', 'w' do |io|
1924
+ io.write 'gem "a"'
1925
+ end
1875
1926
 
1876
- Gem.use_gemdeps
1927
+ Gem.use_gemdeps
1877
1928
 
1878
- refute spec.activated?
1879
- ensure
1880
- ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
1929
+ refute spec.activated?
1930
+ end
1881
1931
  end
1882
1932
 
1883
1933
  def test_use_gemdeps_argument_missing
@@ -1890,110 +1940,96 @@ class TestGem < Gem::TestCase
1890
1940
  end
1891
1941
 
1892
1942
  def test_use_gemdeps_argument_missing_match_ENV
1893
- rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] =
1894
- ENV['RUBYGEMS_GEMDEPS'], 'gem.deps.rb'
1943
+ with_rubygems_gemdeps('gem.deps.rb') do
1944
+ e = assert_raise ArgumentError do
1945
+ Gem.use_gemdeps 'gem.deps.rb'
1946
+ end
1895
1947
 
1896
- e = assert_raise ArgumentError do
1897
- Gem.use_gemdeps 'gem.deps.rb'
1948
+ assert_equal 'Unable to find gem dependencies file at gem.deps.rb',
1949
+ e.message
1898
1950
  end
1899
-
1900
- assert_equal 'Unable to find gem dependencies file at gem.deps.rb',
1901
- e.message
1902
- ensure
1903
- ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
1904
1951
  end
1905
1952
 
1906
1953
  def test_use_gemdeps_automatic
1907
- rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], '-'
1908
-
1909
- spec = util_spec 'a', 1
1910
- install_specs spec
1911
- spec = Gem::Specification.find {|s| s == spec }
1954
+ with_rubygems_gemdeps('-') do
1955
+ spec = util_spec 'a', 1
1956
+ install_specs spec
1957
+ spec = Gem::Specification.find {|s| s == spec }
1912
1958
 
1913
- refute spec.activated?
1959
+ refute spec.activated?
1914
1960
 
1915
- File.open 'Gemfile', 'w' do |io|
1916
- io.write 'gem "a"'
1917
- end
1961
+ File.open 'Gemfile', 'w' do |io|
1962
+ io.write 'gem "a"'
1963
+ end
1918
1964
 
1919
- Gem.use_gemdeps
1965
+ Gem.use_gemdeps
1920
1966
 
1921
- assert_equal add_bundler_full_name(%W[a-1]), loaded_spec_names
1922
- ensure
1923
- ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
1967
+ assert_equal add_bundler_full_name(%W[a-1]), loaded_spec_names
1968
+ end
1924
1969
  end
1925
1970
 
1926
1971
  def test_use_gemdeps_automatic_missing
1927
- rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], '-'
1972
+ with_rubygems_gemdeps('-') do
1973
+ Gem.use_gemdeps
1928
1974
 
1929
- Gem.use_gemdeps
1930
-
1931
- assert true # count
1932
- ensure
1933
- ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
1975
+ assert true # count
1976
+ end
1934
1977
  end
1935
1978
 
1936
1979
  def test_use_gemdeps_disabled
1937
- rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], ''
1980
+ with_rubygems_gemdeps('') do
1981
+ spec = util_spec 'a', 1
1938
1982
 
1939
- spec = util_spec 'a', 1
1983
+ refute spec.activated?
1940
1984
 
1941
- refute spec.activated?
1942
-
1943
- File.open 'gem.deps.rb', 'w' do |io|
1944
- io.write 'gem "a"'
1945
- end
1985
+ File.open 'gem.deps.rb', 'w' do |io|
1986
+ io.write 'gem "a"'
1987
+ end
1946
1988
 
1947
- Gem.use_gemdeps
1989
+ Gem.use_gemdeps
1948
1990
 
1949
- refute spec.activated?
1950
- ensure
1951
- ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
1991
+ refute spec.activated?
1992
+ end
1952
1993
  end
1953
1994
 
1954
1995
  def test_use_gemdeps_missing_gem
1955
- rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], 'x'
1956
-
1957
- File.open 'x', 'w' do |io|
1958
- io.write 'gem "a"'
1959
- end
1996
+ with_rubygems_gemdeps('x') do
1997
+ File.open 'x', 'w' do |io|
1998
+ io.write 'gem "a"'
1999
+ end
1960
2000
 
1961
- expected = <<-EXPECTED
2001
+ expected = <<-EXPECTED
1962
2002
  Could not find gem 'a' in locally installed gems.
1963
- The source does not contain any versions of 'a'
1964
- You may need to `gem install -g` to install missing gems
2003
+ You may need to `bundle install` to install missing gems
1965
2004
 
1966
- EXPECTED
2005
+ EXPECTED
1967
2006
 
1968
- Gem::Deprecate.skip_during do
1969
- actual_stdout, actual_stderr = capture_output do
1970
- Gem.use_gemdeps
2007
+ Gem::Deprecate.skip_during do
2008
+ actual_stdout, actual_stderr = capture_output do
2009
+ Gem.use_gemdeps
2010
+ end
2011
+ assert_empty actual_stdout
2012
+ assert_equal(expected, actual_stderr)
1971
2013
  end
1972
- assert_empty actual_stdout
1973
- assert_equal(expected, actual_stderr)
1974
2014
  end
1975
- ensure
1976
- ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
1977
2015
  end
1978
2016
 
1979
2017
  def test_use_gemdeps_specific
1980
- rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], 'x'
2018
+ with_rubygems_gemdeps('x') do
2019
+ spec = util_spec 'a', 1
2020
+ install_specs spec
1981
2021
 
1982
- spec = util_spec 'a', 1
1983
- install_specs spec
1984
-
1985
- spec = Gem::Specification.find {|s| s == spec }
1986
- refute spec.activated?
2022
+ spec = Gem::Specification.find {|s| s == spec }
2023
+ refute spec.activated?
1987
2024
 
1988
- File.open 'x', 'w' do |io|
1989
- io.write 'gem "a"'
1990
- end
2025
+ File.open 'x', 'w' do |io|
2026
+ io.write 'gem "a"'
2027
+ end
1991
2028
 
1992
- Gem.use_gemdeps
2029
+ Gem.use_gemdeps
1993
2030
 
1994
- assert_equal add_bundler_full_name(%W[a-1]), loaded_spec_names
1995
- ensure
1996
- ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
2031
+ assert_equal add_bundler_full_name(%W[a-1]), loaded_spec_names
2032
+ end
1997
2033
  end
1998
2034
 
1999
2035
  def test_operating_system_defaults
@@ -2111,4 +2147,22 @@ You may need to `gem install -g` to install missing gems
2111
2147
  def util_cache_dir
2112
2148
  File.join Gem.dir, "cache"
2113
2149
  end
2150
+
2151
+ def with_path_and_rubyopt(path_value, rubyopt_value)
2152
+ path, ENV['PATH'] = ENV['PATH'], path_value
2153
+ rubyopt, ENV['RUBYOPT'] = ENV['RUBYOPT'], rubyopt_value
2154
+
2155
+ yield
2156
+ ensure
2157
+ ENV['PATH'] = path
2158
+ ENV['RUBYOPT'] = rubyopt
2159
+ end
2160
+
2161
+ def with_rubygems_gemdeps(value)
2162
+ rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], value
2163
+
2164
+ yield
2165
+ ensure
2166
+ ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
2167
+ end
2114
2168
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require 'rubygems/test_case'
2
+ require_relative 'helper'
3
3
  require 'rubygems/available_set'
4
4
  require 'rubygems/security'
5
5
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require 'rubygems/test_case'
2
+ require_relative 'helper'
3
3
 
4
4
  class TestGemBundlerVersionFinder < Gem::TestCase
5
5
  def setup
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require 'rubygems/test_case'
2
+ require_relative 'helper'
3
3
  require 'rubygems/command'
4
4
 
5
5
  class Gem::Command
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require 'rubygems/test_case'
2
+ require_relative 'helper'
3
3
  require 'rubygems/command_manager'
4
4
 
5
5
  class TestGemCommandManager < Gem::TestCase
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require 'rubygems/test_case'
2
+ require_relative 'helper'
3
3
  require 'rubygems/commands/build_command'
4
4
  require 'rubygems/package'
5
5
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require 'rubygems/test_case'
2
+ require_relative 'helper'
3
3
  require 'rubygems/commands/cert_command'
4
4
 
5
5
  unless Gem::HAVE_OPENSSL
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require 'rubygems/test_case'
2
+ require_relative 'helper'
3
3
  require 'rubygems/commands/check_command'
4
4
 
5
5
  class TestGemCommandsCheckCommand < Gem::TestCase
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require 'rubygems/test_case'
2
+ require_relative 'helper'
3
3
  require 'rubygems/commands/cleanup_command'
4
4
  require 'rubygems/installer'
5
5
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require 'rubygems/test_case'
2
+ require_relative 'helper'
3
3
  require 'rubygems/commands/contents_command'
4
4
 
5
5
  class TestGemCommandsContentsCommand < Gem::TestCase
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require 'rubygems/test_case'
2
+ require_relative 'helper'
3
3
  require 'rubygems/commands/dependency_command'
4
4
 
5
5
  class TestGemCommandsDependencyCommand < Gem::TestCase
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require 'rubygems/test_case'
2
+ require_relative 'helper'
3
3
  require 'rubygems/commands/environment_command'
4
4
 
5
5
  class TestGemCommandsEnvironmentCommand < Gem::TestCase
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require 'rubygems/test_case'
2
+ require_relative 'helper'
3
3
  require 'rubygems/package'
4
4
  require 'rubygems/security'
5
5
  require 'rubygems/commands/fetch_command'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require 'rubygems/test_case'
2
+ require_relative 'helper'
3
3
  require 'rubygems/indexer'
4
4
  require 'rubygems/commands/generate_index_command'
5
5
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  require "rubygems"
3
- require "rubygems/test_case"
3
+ require_relative "helper"
4
4
  require "rubygems/commands/help_command"
5
5
  require "rubygems/package"
6
6
  require "rubygems/command_manager"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require 'rubygems/test_case'
2
+ require_relative 'helper'
3
3
  require 'rubygems/commands/info_command'
4
4
 
5
5
  class TestGemCommandsInfoCommand < Gem::TestCase
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require 'rubygems/test_case'
2
+ require_relative 'helper'
3
3
  require 'rubygems/commands/install_command'
4
4
  require 'rubygems/request_set'
5
5
  require 'rubygems/rdoc'
@@ -1067,6 +1067,31 @@ ERROR: Possible alternatives: non_existent_with_hint
1067
1067
  assert_equal x, e
1068
1068
  end
1069
1069
 
1070
+ def test_redact_credentials_from_uri_on_warning
1071
+ spec_fetcher do |fetcher|
1072
+ fetcher.download 'a', 2
1073
+ end
1074
+
1075
+ Gem.sources << "http://username:SECURE_TOKEN@nonexistent.example"
1076
+
1077
+ @cmd.options[:args] = %w[a]
1078
+
1079
+ use_ui @ui do
1080
+ assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
1081
+ @cmd.execute
1082
+ end
1083
+ end
1084
+
1085
+ assert_equal %w[a-2], @cmd.installed_specs.map {|spec| spec.full_name }
1086
+
1087
+ assert_match "1 gem installed", @ui.output
1088
+
1089
+ e = @ui.error
1090
+
1091
+ x = "WARNING: Unable to pull data from 'http://username:REDACTED@nonexistent.example': no data for http://username:REDACTED@nonexistent.example/specs.4.8.gz (http://username:REDACTED@nonexistent.example/specs.4.8.gz)\n"
1092
+ assert_equal x, e
1093
+ end
1094
+
1070
1095
  def test_execute_uses_from_a_gemdeps
1071
1096
  spec_fetcher do |fetcher|
1072
1097
  fetcher.gem 'a', 2
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require 'rubygems/test_case'
2
+ require_relative 'helper'
3
3
  require 'rubygems/commands/list_command'
4
4
 
5
5
  class TestGemCommandsListCommand < Gem::TestCase
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require 'rubygems/test_case'
2
+ require_relative 'helper'
3
3
  require 'rubygems/commands/lock_command'
4
4
 
5
5
  class TestGemCommandsLockCommand < Gem::TestCase
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require 'rubygems/test_case'
2
+ require_relative 'helper'
3
3
  require 'rubygems/commands/mirror_command'
4
4
 
5
5
  class TestGemCommandsMirrorCommand < Gem::TestCase