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
@@ -12,12 +12,13 @@ module Bundler
12
12
  end
13
13
  File.open File.join(bundler_path, "setup.rb"), "w" do |file|
14
14
  file.puts "require 'rbconfig'"
15
- file.puts "ruby_engine = RUBY_ENGINE"
16
- file.puts "ruby_version = RbConfig::CONFIG[\"ruby_version\"]"
17
- file.puts "path = File.expand_path('..', __FILE__)"
18
15
  file.puts reverse_rubygems_kernel_mixin
19
16
  paths.each do |path|
20
- file.puts %($:.unshift File.expand_path("\#{path}/#{path}"))
17
+ if Pathname.new(path).absolute?
18
+ file.puts %($:.unshift "#{path}")
19
+ else
20
+ file.puts %($:.unshift File.expand_path("\#{__dir__}/#{path}"))
21
+ end
21
22
  end
22
23
  end
23
24
  end
@@ -28,14 +29,14 @@ module Bundler
28
29
  @specs.map do |spec|
29
30
  next if spec.name == "bundler"
30
31
  Array(spec.require_paths).map do |path|
31
- gem_path(path, spec).sub(version_dir, '#{ruby_engine}/#{ruby_version}')
32
+ gem_path(path, spec).sub(version_dir, '#{RUBY_ENGINE}/#{RbConfig::CONFIG["ruby_version"]}')
32
33
  # This is a static string intentionally. It's interpolated at a later time.
33
34
  end
34
- end.flatten
35
+ end.flatten.compact
35
36
  end
36
37
 
37
38
  def version_dir
38
- "#{Bundler::RubyVersion.system.engine}/#{RbConfig::CONFIG["ruby_version"]}"
39
+ "#{RUBY_ENGINE}/#{RbConfig::CONFIG["ruby_version"]}"
39
40
  end
40
41
 
41
42
  def bundler_path
@@ -44,7 +45,11 @@ module Bundler
44
45
 
45
46
  def gem_path(path, spec)
46
47
  full_path = Pathname.new(path).absolute? ? path : File.join(spec.full_gem_path, path)
47
- Pathname.new(full_path).relative_path_from(Bundler.root.join(bundler_path)).to_s
48
+ if spec.source.instance_of?(Source::Path)
49
+ full_path
50
+ else
51
+ Pathname.new(full_path).relative_path_from(Bundler.root.join(bundler_path)).to_s
52
+ end
48
53
  rescue TypeError
49
54
  error_message = "#{spec.name} #{spec.version} has an invalid gemspec"
50
55
  raise Gem::InvalidSpecificationException.new(error_message)
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "rubygems/dependency_installer"
4
3
  require_relative "worker"
5
4
  require_relative "installer/parallel_installer"
6
5
  require_relative "installer/standalone"
@@ -195,6 +195,7 @@ module Bundler
195
195
  platform = platform ? Gem::Platform.new(platform) : Gem::Platform::RUBY
196
196
  @current_spec = LazySpecification.new(name, version, platform)
197
197
  @current_spec.source = @current_source
198
+ @current_source.add_dependency_names(name)
198
199
 
199
200
  @specs[@current_spec.identifier] = @current_spec
200
201
  elsif spaces.size == 6
@@ -81,6 +81,8 @@ module Bundler
81
81
 
82
82
  deps = names.map {|name| Dependency.new name, version }
83
83
 
84
+ Bundler.configure_gem_home_and_path(Plugin.root)
85
+
84
86
  definition = Definition.new(nil, deps, source_list, true)
85
87
  install_definition(definition)
86
88
  end
@@ -13,6 +13,7 @@ module Bundler
13
13
  class MalformattedPlugin < PluginError; end
14
14
  class UndefinedCommandError < PluginError; end
15
15
  class UnknownSourceError < PluginError; end
16
+ class PluginInstallError < PluginError; end
16
17
 
17
18
  PLUGIN_FILE_NAME = "plugins.rb".freeze
18
19
 
@@ -38,12 +39,11 @@ module Bundler
38
39
  specs = Installer.new.install(names, options)
39
40
 
40
41
  save_plugins names, specs
41
- rescue PluginError => e
42
+ rescue PluginError
42
43
  specs_to_delete = specs.select {|k, _v| names.include?(k) && !index.commands.values.include?(k) }
43
44
  specs_to_delete.each_value {|spec| Bundler.rm_rf(spec.full_gem_path) }
44
45
 
45
- names_list = names.map {|name| "`#{name}`" }.join(", ")
46
- Bundler.ui.error "Failed to install the following plugins: #{names_list}. The underlying error was: #{e.message}.\n #{e.backtrace.join("\n ")}"
46
+ raise
47
47
  end
48
48
 
49
49
  # Uninstalls plugins by the given names
@@ -245,10 +245,11 @@ module Bundler
245
245
  # @param [Array<String>] names of inferred source plugins that can be ignored
246
246
  def save_plugins(plugins, specs, optional_plugins = [])
247
247
  plugins.each do |name|
248
+ next if index.installed?(name)
249
+
248
250
  spec = specs[name]
249
- validate_plugin! Pathname.new(spec.full_gem_path)
250
- installed = register_plugin(name, spec, optional_plugins.include?(name))
251
- Bundler.ui.info "Installed plugin #{name}" if installed
251
+
252
+ save_plugin(name, spec, optional_plugins.include?(name))
252
253
  end
253
254
  end
254
255
 
@@ -263,6 +264,22 @@ module Bundler
263
264
  raise MalformattedPlugin, "#{PLUGIN_FILE_NAME} was not found in the plugin." unless plugin_file.file?
264
265
  end
265
266
 
267
+ # Validates and registers a plugin.
268
+ #
269
+ # @param [String] name the name of the plugin
270
+ # @param [Specification] spec of installed plugin
271
+ # @param [Boolean] optional_plugin, removed if there is conflict with any
272
+ # other plugin (used for default source plugins)
273
+ #
274
+ # @raise [PluginInstallError] if validation or registration raises any error
275
+ def save_plugin(name, spec, optional_plugin = false)
276
+ validate_plugin! Pathname.new(spec.full_gem_path)
277
+ installed = register_plugin(name, spec, optional_plugin)
278
+ Bundler.ui.info "Installed plugin #{name}" if installed
279
+ rescue PluginError => e
280
+ raise PluginInstallError, "Failed to install plugin `#{spec.name}`, due to #{e.class} (#{e.message})"
281
+ end
282
+
266
283
  # Runs the plugins.rb file in an isolated namespace, records the plugin
267
284
  # actions it registers for and then passes the data to index to be stored.
268
285
  #
@@ -255,12 +255,6 @@ module Bundler
255
255
  next if name == "bundler"
256
256
  next unless search_for(requirement).empty?
257
257
 
258
- cache_message = begin
259
- " or in gems cached in #{Bundler.settings.app_cache_path}" if Bundler.app_cache.exist?
260
- rescue GemfileNotFound
261
- nil
262
- end
263
-
264
258
  if (base = @base[name]) && !base.empty?
265
259
  version = base.first.version
266
260
  message = "You have requested:\n" \
@@ -269,18 +263,17 @@ module Bundler
269
263
  "Try running `bundle update #{name}`\n\n" \
270
264
  "If you are updating multiple gems in your Gemfile at once,\n" \
271
265
  "try passing them all to `bundle update`"
272
- elsif source = @source_requirements[name]
266
+ else
267
+ source = source_for(name)
273
268
  specs = source.specs.search(name)
274
269
  versions_with_platforms = specs.map {|s| [s.version, s.platform] }
275
- message = String.new("Could not find gem '#{SharedHelpers.pretty_dependency(requirement)}' in #{source}#{cache_message}.\n")
276
- message << if versions_with_platforms.any?
277
- "The source contains the following versions of '#{name}': #{formatted_versions_with_platforms(versions_with_platforms)}"
278
- else
279
- "The source does not contain any versions of '#{name}'"
280
- end
281
- else
282
- message = "Could not find gem '#{SharedHelpers.pretty_dependency(requirement)}' in any of the gem sources " \
283
- "listed in your Gemfile#{cache_message}."
270
+ cache_message = begin
271
+ " or in gems cached in #{Bundler.settings.app_cache_path}" if Bundler.app_cache.exist?
272
+ rescue GemfileNotFound
273
+ nil
274
+ end
275
+ message = String.new("Could not find gem '#{SharedHelpers.pretty_dependency(requirement)}' in #{source.to_err}#{cache_message}.\n")
276
+ message << "The source contains the following versions of '#{name}': #{formatted_versions_with_platforms(versions_with_platforms)}" if versions_with_platforms.any?
284
277
  end
285
278
  raise GemNotFound, message
286
279
  end
@@ -378,7 +371,7 @@ module Bundler
378
371
  o << if metadata_requirement
379
372
  "is not available in #{relevant_source}"
380
373
  else
381
- "in #{relevant_source}.\n"
374
+ "in #{relevant_source.to_err}.\n"
382
375
  end
383
376
  end
384
377
  end,
@@ -61,7 +61,10 @@ module Bundler
61
61
 
62
62
  def build_extensions
63
63
  extension_cache_path = options[:bundler_extension_cache_path]
64
- return super unless extension_cache_path && extension_dir = spec.extension_dir
64
+ unless extension_cache_path && extension_dir = spec.extension_dir
65
+ require "shellwords" # compensate missing require in rubygems before version 3.2.25
66
+ return super
67
+ end
65
68
 
66
69
  extension_dir = Pathname.new(extension_dir)
67
70
  build_complete = SharedHelpers.filesystem_access(extension_cache_path.join("gem.build_complete"), :read, &:file?)
@@ -71,6 +74,7 @@ module Bundler
71
74
  FileUtils.cp_r extension_cache_path, spec.extension_dir
72
75
  end
73
76
  else
77
+ require "shellwords" # compensate missing require in rubygems before version 3.2.25
74
78
  super
75
79
  if extension_dir.directory? # not made for gems without extensions
76
80
  SharedHelpers.filesystem_access(extension_cache_path.parent, &:mkpath)
@@ -34,10 +34,12 @@ module Bundler
34
34
  end
35
35
 
36
36
  def build_args
37
+ require "rubygems/command"
37
38
  Gem::Command.build_args
38
39
  end
39
40
 
40
41
  def build_args=(args)
42
+ require "rubygems/command"
41
43
  Gem::Command.build_args = args
42
44
  end
43
45
 
@@ -22,10 +22,6 @@ module Bundler
22
22
 
23
23
  # Activate the specs
24
24
  load_paths = specs.map do |spec|
25
- unless spec.loaded_from
26
- raise GemNotFound, "#{spec.full_name} is missing. Run `bundle install` to get it."
27
- end
28
-
29
25
  check_for_activated_spec!(spec)
30
26
 
31
27
  Bundler.rubygems.mark_loaded(spec)
@@ -104,7 +100,7 @@ module Bundler
104
100
 
105
101
  alias_method :gems, :specs
106
102
 
107
- def cache(custom_path = nil)
103
+ def cache(custom_path = nil, local = false)
108
104
  cache_path = Bundler.app_cache(custom_path)
109
105
  SharedHelpers.filesystem_access(cache_path) do |p|
110
106
  FileUtils.mkdir_p(p)
@@ -112,7 +108,20 @@ module Bundler
112
108
 
113
109
  Bundler.ui.info "Updating files in #{Bundler.settings.app_cache_path}"
114
110
 
115
- specs_to_cache = Bundler.settings[:cache_all_platforms] ? @definition.resolve.materialized_for_all_platforms : specs
111
+ specs_to_cache = if Bundler.settings[:cache_all_platforms]
112
+ @definition.resolve.materialized_for_all_platforms
113
+ else
114
+ begin
115
+ specs
116
+ rescue GemNotFound
117
+ if local
118
+ Bundler.ui.warn "Some gems seem to be missing from your #{Bundler.settings.app_cache_path} directory."
119
+ end
120
+
121
+ raise
122
+ end
123
+ end
124
+
116
125
  specs_to_cache.each do |spec|
117
126
  next if spec.name == "bundler"
118
127
  next if spec.source.is_a?(Source::Gemspec)
@@ -419,7 +419,15 @@ module Bundler
419
419
  elsif is_credential(key)
420
420
  "[REDACTED]"
421
421
  elsif is_userinfo(converted)
422
- converted.gsub(/:.*$/, ":[REDACTED]")
422
+ username, pass = converted.split(":", 2)
423
+
424
+ if pass == "x-oauth-basic"
425
+ username = "[REDACTED]"
426
+ else
427
+ pass = "[REDACTED]"
428
+ end
429
+
430
+ [username, pass].join(":")
423
431
  else
424
432
  converted
425
433
  end
@@ -428,6 +436,10 @@ module Bundler
428
436
  def global_config_file
429
437
  if ENV["BUNDLE_CONFIG"] && !ENV["BUNDLE_CONFIG"].empty?
430
438
  Pathname.new(ENV["BUNDLE_CONFIG"])
439
+ elsif ENV["BUNDLE_USER_CONFIG"] && !ENV["BUNDLE_USER_CONFIG"].empty?
440
+ Pathname.new(ENV["BUNDLE_USER_CONFIG"])
441
+ elsif ENV["BUNDLE_USER_HOME"] && !ENV["BUNDLE_USER_HOME"].empty?
442
+ Pathname.new(ENV["BUNDLE_USER_HOME"]).join("config")
431
443
  elsif Bundler.rubygems.user_home && !Bundler.rubygems.user_home.empty?
432
444
  Pathname.new(Bundler.rubygems.user_home).join(".bundle/config")
433
445
  end
@@ -9,10 +9,10 @@ if Bundler::SharedHelpers.in_bundle?
9
9
  begin
10
10
  Bundler.ui.silence { Bundler.setup }
11
11
  rescue Bundler::BundlerError => e
12
- Bundler.ui.warn "\e[31m#{e.message}\e[0m"
12
+ Bundler.ui.error e.message
13
13
  Bundler.ui.warn e.backtrace.join("\n") if ENV["DEBUG"]
14
14
  if e.is_a?(Bundler::GemNotFound)
15
- Bundler.ui.warn "\e[33mRun `bundle install` to install missing gems.\e[0m"
15
+ Bundler.ui.warn "Run `bundle install` to install missing gems."
16
16
  end
17
17
  exit e.status_code
18
18
  end
@@ -152,13 +152,6 @@ module Bundler
152
152
  Bundler.ui.warn message
153
153
  end
154
154
 
155
- def trap(signal, override = false, &block)
156
- prior = Signal.trap(signal) do
157
- block.call
158
- prior.call unless override
159
- end
160
- end
161
-
162
155
  def ensure_same_dependencies(spec, old_deps, new_deps)
163
156
  new_deps = new_deps.reject {|d| d.type == :development }
164
157
  old_deps = old_deps.reject {|d| d.type == :development }
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "shellwords"
4
-
5
3
  module Bundler
6
4
  class Source
7
5
  class Git
@@ -224,6 +222,7 @@ module Bundler
224
222
  end
225
223
 
226
224
  def check_allowed(command)
225
+ require "shellwords"
227
226
  command_with_no_credentials = URICredentialsFilter.credential_filtered_string("git #{command.shelljoin}", uri)
228
227
  raise GitNotAllowedError.new(command_with_no_credentials) unless allow?
229
228
  command_with_no_credentials
@@ -29,6 +29,7 @@ module Bundler
29
29
  def local_only!
30
30
  @specs = nil
31
31
  @allow_local = true
32
+ @allow_cached = false
32
33
  @allow_remote = false
33
34
  end
34
35
 
@@ -50,6 +51,7 @@ module Bundler
50
51
  return if @allow_cached
51
52
 
52
53
  @specs = nil
54
+ @allow_local = true
53
55
  @allow_cached = true
54
56
  end
55
57
 
@@ -71,6 +73,10 @@ module Bundler
71
73
  @remotes.size > 1
72
74
  end
73
75
 
76
+ def no_remotes?
77
+ @remotes.size == 0
78
+ end
79
+
74
80
  def can_lock?(spec)
75
81
  return super unless multiple_remotes?
76
82
  include?(spec.source)
@@ -92,11 +98,22 @@ module Bundler
92
98
  out << " specs:\n"
93
99
  end
94
100
 
101
+ def to_err
102
+ if remotes.empty?
103
+ "locally installed gems"
104
+ elsif @allow_remote
105
+ "rubygems repository #{remote_names} or installed locally"
106
+ elsif @allow_cached
107
+ "cached gems from rubygems repository #{remote_names} or installed locally"
108
+ else
109
+ "locally installed gems"
110
+ end
111
+ end
112
+
95
113
  def to_s
96
114
  if remotes.empty?
97
115
  "locally installed gems"
98
116
  else
99
- remote_names = remotes.map(&:to_s).join(", ")
100
117
  "rubygems repository #{remote_names} or installed locally"
101
118
  end
102
119
  end
@@ -127,7 +144,7 @@ module Bundler
127
144
  end
128
145
  end
129
146
 
130
- if (installed?(spec) || Plugin.installed?(spec.name)) && !force
147
+ if installed?(spec) && !force
131
148
  print_using_message "Using #{version_message(spec)}"
132
149
  return nil # no post-install message
133
150
  end
@@ -315,6 +332,10 @@ module Bundler
315
332
 
316
333
  protected
317
334
 
335
+ def remote_names
336
+ remotes.map(&:to_s).join(", ")
337
+ end
338
+
318
339
  def credless_remotes
319
340
  remotes.map(&method(:suppress_configured_credentials))
320
341
  end
@@ -16,6 +16,10 @@ module Bundler
16
16
  @index
17
17
  end
18
18
 
19
+ def to_err
20
+ to_s
21
+ end
22
+
19
23
  def to_s
20
24
  "any of the sources"
21
25
  end
@@ -67,6 +67,10 @@ module Bundler
67
67
  "#<#{self.class}:0x#{object_id} #{self}>"
68
68
  end
69
69
 
70
+ def to_err
71
+ to_s
72
+ end
73
+
70
74
  def path?
71
75
  instance_of?(Bundler::Source::Path)
72
76
  end
@@ -37,6 +37,10 @@ module Bundler
37
37
  global_rubygems_source.multiple_remotes?
38
38
  end
39
39
 
40
+ def implicit_global_source?
41
+ global_rubygems_source.no_remotes?
42
+ end
43
+
40
44
  def add_path_source(options = {})
41
45
  if options["gemspec"]
42
46
  add_source_to_list Source::Gemspec.new(options), path_sources
@@ -117,7 +121,8 @@ module Bundler
117
121
  def replace_sources!(replacement_sources)
118
122
  return false if replacement_sources.empty?
119
123
 
120
- @path_sources, @git_sources, @plugin_sources = map_sources(replacement_sources)
124
+ @rubygems_sources, @path_sources, @git_sources, @plugin_sources = map_sources(replacement_sources)
125
+ @global_rubygems_source = global_replacement_source(replacement_sources)
121
126
 
122
127
  different_sources?(lock_sources, replacement_sources)
123
128
  end
@@ -152,13 +157,21 @@ module Bundler
152
157
  end
153
158
 
154
159
  def map_sources(replacement_sources)
155
- [path_sources, git_sources, plugin_sources].map do |sources|
160
+ [@rubygems_sources, @path_sources, @git_sources, @plugin_sources].map do |sources|
156
161
  sources.map do |source|
157
162
  replacement_sources.find {|s| s == source } || source
158
163
  end
159
164
  end
160
165
  end
161
166
 
167
+ def global_replacement_source(replacement_sources)
168
+ replacement_source = replacement_sources.find {|s| s == global_rubygems_source }
169
+ return global_rubygems_source unless replacement_source
170
+
171
+ replacement_source.local!
172
+ replacement_source
173
+ end
174
+
162
175
  def different_sources?(lock_sources, replacement_sources)
163
176
  !equal_sources?(lock_sources, replacement_sources) && !equivalent_sources?(lock_sources, replacement_sources)
164
177
  end
@@ -202,7 +215,7 @@ module Bundler
202
215
  end
203
216
 
204
217
  def equal_source?(source, other_source)
205
- return source.include?(other_source) if source.is_a?(Source::Rubygems) && other_source.is_a?(Source::Rubygems) && !merged_gem_lockfile_sections?
218
+ return source.include?(other_source) if source.is_a?(Source::Rubygems) && other_source.is_a?(Source::Rubygems)
206
219
 
207
220
  source == other_source
208
221
  end
@@ -11,7 +11,7 @@ module Bundler
11
11
  @specs = specs
12
12
  end
13
13
 
14
- def for(dependencies, check = false, match_current_platform = false, raise_on_missing = true)
14
+ def for(dependencies, check = false, match_current_platform = false)
15
15
  handled = []
16
16
  deps = dependencies.dup
17
17
  specs = []
@@ -24,7 +24,7 @@ module Bundler
24
24
 
25
25
  specs_for_dep = spec_for_dependency(dep, match_current_platform)
26
26
  if specs_for_dep.any?
27
- specs += specs_for_dep
27
+ match_current_platform ? specs += specs_for_dep : specs |= specs_for_dep
28
28
 
29
29
  specs_for_dep.first.dependencies.each do |d|
30
30
  next if d.type == :development
@@ -33,11 +33,6 @@ module Bundler
33
33
  end
34
34
  elsif check
35
35
  return false
36
- elsif raise_on_missing
37
- others = lookup[dep.name] if match_current_platform
38
- message = "Unable to find a spec satisfying #{dep} in the set. Perhaps the lockfile is corrupted?"
39
- message += " Found #{others.join(", ")} that did not match the current platform." if others && !others.empty?
40
- raise GemNotFound, message
41
36
  end
42
37
  end
43
38
 
@@ -71,52 +66,35 @@ module Bundler
71
66
  lookup.dup
72
67
  end
73
68
 
74
- def materialize(deps, missing_specs = nil)
75
- materialized = self.for(deps, false, true, !missing_specs)
76
-
77
- materialized.group_by(&:source).each do |source, specs|
78
- next unless specs.any?{|s| s.is_a?(LazySpecification) }
79
-
80
- source.local!
81
- names = -> { specs.map(&:name).uniq }
82
- source.double_check_for(names)
83
- end
69
+ def materialize(deps)
70
+ materialized = self.for(deps, false, true)
84
71
 
85
72
  materialized.map! do |s|
86
73
  next s unless s.is_a?(LazySpecification)
87
- spec = s.__materialize__
88
- unless spec
89
- unless missing_specs
90
- raise GemNotFound, "Could not find #{s.full_name} in any of the sources"
91
- end
92
- missing_specs << s
93
- end
94
- spec
74
+ s.source.local!
75
+ s.__materialize__ || s
95
76
  end
96
- SpecSet.new(missing_specs ? materialized.compact : materialized)
77
+ SpecSet.new(materialized)
97
78
  end
98
79
 
99
80
  # Materialize for all the specs in the spec set, regardless of what platform they're for
100
81
  # This is in contrast to how for does platform filtering (and specifically different from how `materialize` calls `for` only for the current platform)
101
82
  # @return [Array<Gem::Specification>]
102
83
  def materialized_for_all_platforms
103
- @specs.group_by(&:source).each do |source, specs|
104
- next unless specs.any?{|s| s.is_a?(LazySpecification) }
105
-
106
- source.local!
107
- source.remote!
108
- names = -> { specs.map(&:name).uniq }
109
- source.double_check_for(names)
110
- end
111
-
112
84
  @specs.map do |s|
113
85
  next s unless s.is_a?(LazySpecification)
86
+ s.source.local!
87
+ s.source.remote!
114
88
  spec = s.__materialize__
115
89
  raise GemNotFound, "Could not find #{s.full_name} in any of the sources" unless spec
116
90
  spec
117
91
  end
118
92
  end
119
93
 
94
+ def missing_specs
95
+ @specs.select {|s| s.is_a?(LazySpecification) }
96
+ end
97
+
120
98
  def merge(set)
121
99
  arr = sorted.dup
122
100
  set.each do |set_spec|
@@ -60,16 +60,16 @@ m = Module.new do
60
60
  Regexp.last_match(1)
61
61
  end
62
62
 
63
- def bundler_version
64
- @bundler_version ||=
63
+ def bundler_requirement
64
+ @bundler_requirement ||=
65
65
  env_var_version || cli_arg_version ||
66
- lockfile_version
66
+ bundler_requirement_for(lockfile_version)
67
67
  end
68
68
 
69
- def bundler_requirement
70
- return "#{Gem::Requirement.default}.a" unless bundler_version
69
+ def bundler_requirement_for(version)
70
+ return "#{Gem::Requirement.default}.a" unless version
71
71
 
72
- bundler_gem_version = Gem::Version.new(bundler_version)
72
+ bundler_gem_version = Gem::Version.new(version)
73
73
 
74
74
  requirement = bundler_gem_version.approximate_recommendation
75
75
 
@@ -1,16 +1,27 @@
1
1
  name: Ruby
2
2
 
3
- on: [push,pull_request]
3
+ on:
4
+ push:
5
+ branches:
6
+ - <%= config[:git_default_branch] %>
7
+
8
+ pull_request:
4
9
 
5
10
  jobs:
6
11
  build:
7
12
  runs-on: ubuntu-latest
13
+
14
+ strategy:
15
+ matrix:
16
+ ruby:
17
+ - <%= RUBY_VERSION %>
18
+
8
19
  steps:
9
20
  - uses: actions/checkout@v2
10
21
  - name: Set up Ruby
11
22
  uses: ruby/setup-ruby@v1
12
23
  with:
13
- ruby-version: <%= RUBY_VERSION %>
24
+ ruby-version: ${{ matrix.ruby }}
14
25
  bundler-cache: true
15
26
  - name: Run the default task
16
27
  run: bundle exec rake
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
16
16
  <%- end -%>
17
17
  spec.required_ruby_version = ">= <%= config[:required_ruby_version] %>"
18
18
 
19
- spec.metadata["allowed_push_host"] = "TODO: Set to 'https://mygemserver.com'"
19
+ spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
20
20
 
21
21
  spec.metadata["homepage_uri"] = spec.homepage
22
22
  spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
@@ -25,7 +25,9 @@ Gem::Specification.new do |spec|
25
25
  # Specify which files should be added to the gem when it is released.
26
26
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
27
27
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
28
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
28
+ `git ls-files -z`.split("\x0").reject do |f|
29
+ (f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
30
+ end
29
31
  end
30
32
  spec.bindir = "exe"
31
33
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "2.2.24".freeze
4
+ VERSION = "2.2.28".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= VERSION.split(".").first.to_i