rubygems-update 3.2.0.rc.2 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (234) hide show
  1. checksums.yaml +4 -4
  2. data/History.txt +54 -51
  3. data/Manifest.txt +32 -29
  4. data/Rakefile +3 -1
  5. data/bundler/CHANGELOG.md +35 -1
  6. data/bundler/UPGRADING.md +1 -1
  7. data/bundler/lib/bundler.rb +4 -0
  8. data/bundler/lib/bundler/build_metadata.rb +2 -2
  9. data/bundler/lib/bundler/cli.rb +5 -2
  10. data/bundler/lib/bundler/cli/binstubs.rb +6 -2
  11. data/bundler/lib/bundler/cli/exec.rb +3 -3
  12. data/bundler/lib/bundler/cli/outdated.rb +2 -4
  13. data/bundler/lib/bundler/compact_index_client/updater.rb +5 -5
  14. data/bundler/lib/bundler/definition.rb +4 -9
  15. data/bundler/lib/bundler/env.rb +1 -1
  16. data/bundler/lib/bundler/feature_flag.rb +0 -1
  17. data/bundler/lib/bundler/fetcher/index.rb +2 -3
  18. data/bundler/lib/bundler/friendly_errors.rb +15 -0
  19. data/bundler/lib/bundler/index.rb +5 -1
  20. data/bundler/lib/bundler/injector.rb +9 -2
  21. data/bundler/lib/bundler/installer.rb +7 -5
  22. data/bundler/lib/bundler/lazy_specification.rb +5 -7
  23. data/bundler/lib/bundler/man/.document +1 -0
  24. data/bundler/{man → lib/bundler/man}/bundle-add.1.ronn +0 -0
  25. data/bundler/{man → lib/bundler/man}/bundle-binstubs.1.ronn +0 -0
  26. data/bundler/{man → lib/bundler/man}/bundle-cache.1.ronn +0 -0
  27. data/bundler/{man → lib/bundler/man}/bundle-check.1.ronn +0 -0
  28. data/bundler/{man → lib/bundler/man}/bundle-clean.1.ronn +0 -0
  29. data/bundler/{man → lib/bundler/man}/bundle-config.1.ronn +1 -9
  30. data/bundler/{man → lib/bundler/man}/bundle-doctor.1.ronn +0 -0
  31. data/bundler/{man → lib/bundler/man}/bundle-exec.1.ronn +0 -0
  32. data/bundler/{man → lib/bundler/man}/bundle-gem.1.ronn +0 -0
  33. data/bundler/{man → lib/bundler/man}/bundle-info.1.ronn +0 -0
  34. data/bundler/{man → lib/bundler/man}/bundle-init.1.ronn +0 -0
  35. data/bundler/{man → lib/bundler/man}/bundle-inject.1.ronn +0 -0
  36. data/bundler/{man → lib/bundler/man}/bundle-install.1.ronn +1 -1
  37. data/bundler/{man → lib/bundler/man}/bundle-list.1.ronn +0 -0
  38. data/bundler/{man → lib/bundler/man}/bundle-lock.1.ronn +0 -0
  39. data/bundler/{man → lib/bundler/man}/bundle-open.1.ronn +0 -0
  40. data/bundler/{man → lib/bundler/man}/bundle-outdated.1.ronn +0 -0
  41. data/bundler/{man → lib/bundler/man}/bundle-platform.1.ronn +0 -0
  42. data/bundler/{man → lib/bundler/man}/bundle-pristine.1.ronn +0 -0
  43. data/bundler/{man → lib/bundler/man}/bundle-remove.1.ronn +0 -0
  44. data/bundler/{man → lib/bundler/man}/bundle-show.1.ronn +0 -0
  45. data/bundler/{man → lib/bundler/man}/bundle-update.1.ronn +0 -0
  46. data/bundler/{man → lib/bundler/man}/bundle-viz.1.ronn +0 -0
  47. data/bundler/{man → lib/bundler/man}/bundle.1.ronn +0 -0
  48. data/bundler/{man → lib/bundler/man}/gemfile.5.ronn +0 -0
  49. data/bundler/lib/bundler/plugin/api/source.rb +1 -1
  50. data/bundler/lib/bundler/plugin/dsl.rb +1 -1
  51. data/bundler/lib/bundler/resolver.rb +2 -3
  52. data/bundler/lib/bundler/rubygems_integration.rb +4 -0
  53. data/bundler/lib/bundler/settings.rb +0 -1
  54. data/bundler/lib/bundler/source/git/git_proxy.rb +1 -1
  55. data/bundler/lib/bundler/spec_set.rb +1 -0
  56. data/bundler/lib/bundler/templates/newgem/README.md.tt +0 -1
  57. data/bundler/lib/bundler/templates/newgem/lib/newgem.rb.tt +2 -2
  58. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +6 -0
  59. data/bundler/lib/bundler/uri_credentials_filter.rb +2 -0
  60. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo.rb +0 -1
  61. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +34 -1
  62. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +2 -2
  63. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +1 -1
  64. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
  65. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +38 -40
  66. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +4 -7
  67. data/bundler/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +154 -0
  68. data/bundler/lib/bundler/vendored_tmpdir.rb +4 -0
  69. data/bundler/lib/bundler/version.rb +1 -1
  70. data/bundler/man/bundle-add.1 +1 -1
  71. data/bundler/man/bundle-binstubs.1 +1 -1
  72. data/bundler/man/bundle-cache.1 +1 -1
  73. data/bundler/man/bundle-check.1 +1 -1
  74. data/bundler/man/bundle-clean.1 +1 -1
  75. data/bundler/man/bundle-config.1 +2 -5
  76. data/bundler/man/bundle-doctor.1 +1 -1
  77. data/bundler/man/bundle-exec.1 +1 -1
  78. data/bundler/man/bundle-gem.1 +1 -1
  79. data/bundler/man/bundle-info.1 +1 -1
  80. data/bundler/man/bundle-init.1 +1 -1
  81. data/bundler/man/bundle-inject.1 +1 -1
  82. data/bundler/man/bundle-install.1 +2 -2
  83. data/bundler/man/bundle-list.1 +1 -1
  84. data/bundler/man/bundle-lock.1 +1 -1
  85. data/bundler/man/bundle-open.1 +1 -1
  86. data/bundler/man/bundle-outdated.1 +1 -1
  87. data/bundler/man/bundle-platform.1 +1 -1
  88. data/bundler/man/bundle-pristine.1 +1 -1
  89. data/bundler/man/bundle-remove.1 +1 -1
  90. data/bundler/man/bundle-show.1 +1 -1
  91. data/bundler/man/bundle-update.1 +1 -1
  92. data/bundler/man/bundle-viz.1 +1 -1
  93. data/bundler/man/bundle.1 +1 -1
  94. data/bundler/man/gemfile.5 +1 -1
  95. data/bundler/man/index.txt +25 -0
  96. data/lib/rubygems.rb +6 -2
  97. data/lib/rubygems/available_set.rb +1 -1
  98. data/lib/rubygems/command_manager.rb +2 -2
  99. data/lib/rubygems/commands/build_command.rb +37 -20
  100. data/lib/rubygems/commands/cert_command.rb +1 -1
  101. data/lib/rubygems/commands/help_command.rb +2 -0
  102. data/lib/rubygems/commands/owner_command.rb +10 -2
  103. data/lib/rubygems/commands/pristine_command.rb +1 -1
  104. data/lib/rubygems/commands/push_command.rb +7 -3
  105. data/lib/rubygems/commands/query_command.rb +17 -0
  106. data/lib/rubygems/commands/server_command.rb +4 -0
  107. data/lib/rubygems/commands/setup_command.rb +25 -45
  108. data/lib/rubygems/commands/sources_command.rb +6 -2
  109. data/lib/rubygems/commands/specification_command.rb +6 -0
  110. data/lib/rubygems/commands/yank_command.rb +4 -4
  111. data/lib/rubygems/core_ext/kernel_require.rb +3 -0
  112. data/lib/rubygems/core_ext/kernel_warn.rb +6 -7
  113. data/lib/rubygems/defaults.rb +2 -2
  114. data/lib/rubygems/dependency.rb +1 -1
  115. data/lib/rubygems/dependency_installer.rb +4 -3
  116. data/lib/rubygems/ext/builder.rb +13 -32
  117. data/lib/rubygems/ext/cmake_builder.rb +4 -4
  118. data/lib/rubygems/ext/configure_builder.rb +4 -4
  119. data/lib/rubygems/ext/ext_conf_builder.rb +19 -14
  120. data/lib/rubygems/ext/rake_builder.rb +3 -3
  121. data/lib/rubygems/gemcutter_utilities.rb +90 -14
  122. data/lib/rubygems/indexer.rb +0 -1
  123. data/lib/rubygems/install_update_options.rb +2 -2
  124. data/lib/rubygems/installer.rb +12 -9
  125. data/lib/rubygems/installer_test_case.rb +7 -6
  126. data/lib/rubygems/name_tuple.rb +1 -1
  127. data/lib/rubygems/openssl.rb +4 -4
  128. data/lib/rubygems/package.rb +3 -2
  129. data/lib/rubygems/package/tar_header.rb +1 -1
  130. data/lib/rubygems/package/tar_test_case.rb +1 -1
  131. data/lib/rubygems/platform.rb +18 -7
  132. data/lib/rubygems/query_utils.rb +0 -9
  133. data/lib/rubygems/remote_fetcher.rb +1 -2
  134. data/lib/rubygems/request.rb +4 -3
  135. data/lib/rubygems/request_set/gem_dependency_api.rb +4 -4
  136. data/lib/rubygems/requirement.rb +1 -1
  137. data/lib/rubygems/resolver.rb +1 -1
  138. data/lib/rubygems/resolver/activation_request.rb +9 -1
  139. data/lib/rubygems/resolver/api_specification.rb +5 -1
  140. data/lib/rubygems/resolver/conflict.rb +1 -1
  141. data/lib/rubygems/resolver/dependency_request.rb +1 -1
  142. data/lib/rubygems/resolver/index_specification.rb +11 -0
  143. data/lib/rubygems/resolver/installer_set.rb +1 -2
  144. data/lib/rubygems/resolver/lock_set.rb +1 -1
  145. data/lib/rubygems/resolver/molinillo/lib/molinillo.rb +6 -5
  146. data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/resolution_state.rb +7 -0
  147. data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb +1 -0
  148. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb +39 -5
  149. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/action.rb +1 -0
  150. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +2 -1
  151. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +2 -1
  152. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +2 -1
  153. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +2 -1
  154. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/log.rb +7 -6
  155. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/set_payload.rb +2 -1
  156. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/tag.rb +4 -3
  157. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/vertex.rb +43 -10
  158. data/lib/rubygems/resolver/molinillo/lib/molinillo/errors.rb +75 -7
  159. data/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb +2 -1
  160. data/lib/rubygems/resolver/molinillo/lib/molinillo/modules/specification_provider.rb +1 -0
  161. data/lib/rubygems/resolver/molinillo/lib/molinillo/modules/ui.rb +3 -1
  162. data/lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb +506 -165
  163. data/lib/rubygems/resolver/molinillo/lib/molinillo/resolver.rb +3 -2
  164. data/lib/rubygems/resolver/molinillo/lib/molinillo/state.rb +8 -4
  165. data/lib/rubygems/resolver/specification.rb +1 -1
  166. data/lib/rubygems/s3_uri_signer.rb +1 -1
  167. data/lib/rubygems/security.rb +1 -2
  168. data/lib/rubygems/security/policy.rb +1 -1
  169. data/lib/rubygems/security/signer.rb +1 -1
  170. data/lib/rubygems/server.rb +1 -1
  171. data/lib/rubygems/source.rb +10 -4
  172. data/lib/rubygems/spec_fetcher.rb +1 -1
  173. data/lib/rubygems/specification.rb +8 -8
  174. data/lib/rubygems/ssl_certs/{index.rubygems.org → rubygems.org}/GlobalSignRootCA.pem +0 -0
  175. data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA_R3.pem +21 -0
  176. data/lib/rubygems/stub_specification.rb +1 -1
  177. data/lib/rubygems/test_case.rb +13 -26
  178. data/lib/rubygems/uri_formatter.rb +2 -1
  179. data/lib/rubygems/version_option.rb +6 -0
  180. data/rubygems-update.gemspec +1 -1
  181. data/test/rubygems/test_bundled_ca.rb +9 -5
  182. data/test/rubygems/test_gem.rb +3 -3
  183. data/test/rubygems/test_gem_commands_build_command.rb +197 -5
  184. data/test/rubygems/test_gem_commands_cert_command.rb +2 -2
  185. data/test/rubygems/test_gem_commands_cleanup_command.rb +1 -1
  186. data/test/rubygems/test_gem_commands_contents_command.rb +2 -2
  187. data/test/rubygems/test_gem_commands_help_command.rb +15 -2
  188. data/test/rubygems/test_gem_commands_install_command.rb +1 -1
  189. data/test/rubygems/test_gem_commands_owner_command.rb +49 -1
  190. data/test/rubygems/test_gem_commands_pristine_command.rb +2 -2
  191. data/test/rubygems/test_gem_commands_push_command.rb +31 -5
  192. data/test/rubygems/test_gem_commands_query_command.rb +3 -3
  193. data/test/rubygems/test_gem_commands_setup_command.rb +13 -18
  194. data/test/rubygems/test_gem_commands_signin_command.rb +27 -3
  195. data/test/rubygems/test_gem_commands_sources_command.rb +60 -0
  196. data/test/rubygems/test_gem_commands_specification_command.rb +28 -0
  197. data/test/rubygems/test_gem_commands_update_command.rb +2 -2
  198. data/test/rubygems/test_gem_commands_yank_command.rb +31 -1
  199. data/test/rubygems/test_gem_dependency_installer.rb +36 -2
  200. data/test/rubygems/test_gem_dependency_list.rb +2 -2
  201. data/test/rubygems/test_gem_ext_builder.rb +10 -14
  202. data/test/rubygems/test_gem_ext_cmake_builder.rb +3 -9
  203. data/test/rubygems/test_gem_ext_configure_builder.rb +3 -9
  204. data/test/rubygems/test_gem_ext_ext_conf_builder.rb +9 -26
  205. data/test/rubygems/test_gem_ext_rake_builder.rb +5 -13
  206. data/test/rubygems/test_gem_gem_runner.rb +5 -4
  207. data/test/rubygems/test_gem_gemcutter_utilities.rb +3 -3
  208. data/test/rubygems/test_gem_install_update_options.rb +15 -3
  209. data/test/rubygems/test_gem_installer.rb +74 -11
  210. data/test/rubygems/test_gem_package.rb +8 -8
  211. data/test/rubygems/test_gem_package_old.rb +4 -4
  212. data/test/rubygems/test_gem_package_tar_writer.rb +1 -1
  213. data/test/rubygems/test_gem_platform.rb +63 -4
  214. data/test/rubygems/test_gem_remote_fetcher.rb +14 -18
  215. data/test/rubygems/test_gem_request.rb +2 -2
  216. data/test/rubygems/test_gem_request_set_lockfile.rb +4 -4
  217. data/test/rubygems/test_gem_resolver_api_set.rb +8 -8
  218. data/test/rubygems/test_gem_resolver_conflict.rb +1 -1
  219. data/test/rubygems/test_gem_resolver_vendor_set.rb +1 -1
  220. data/test/rubygems/test_gem_security.rb +2 -2
  221. data/test/rubygems/test_gem_security_policy.rb +2 -2
  222. data/test/rubygems/test_gem_security_signer.rb +2 -2
  223. data/test/rubygems/test_gem_security_trust_dir.rb +2 -2
  224. data/test/rubygems/test_gem_source.rb +5 -0
  225. data/test/rubygems/test_gem_source_subpath_problem.rb +49 -0
  226. data/test/rubygems/test_gem_specification.rb +5 -4
  227. data/test/rubygems/test_gem_uninstaller.rb +7 -7
  228. data/test/rubygems/test_gem_validator.rb +1 -1
  229. data/test/rubygems/test_gem_version_option.rb +1 -1
  230. data/test/rubygems/test_require.rb +50 -9
  231. metadata +35 -32
  232. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +0 -26
  233. data/lib/rubygems/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
  234. data/lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
@@ -76,8 +76,6 @@ module Bundler
76
76
  next unless gems.empty? || gems.include?(current_spec.name)
77
77
 
78
78
  active_spec = retrieve_active_spec(definition, current_spec)
79
- next unless active_spec
80
-
81
79
  next unless filter_options_patch.empty? || update_present_via_semver_portions(current_spec, active_spec, options)
82
80
 
83
81
  gem_outdated = Gem::Version.new(active_spec.version) > Gem::Version.new(current_spec.version)
@@ -146,8 +144,6 @@ module Bundler
146
144
  end
147
145
 
148
146
  def retrieve_active_spec(definition, current_spec)
149
- return unless current_spec.match_platform(Bundler.local_platform)
150
-
151
147
  if strict
152
148
  active_spec = definition.find_resolved_spec(current_spec)
153
149
  else
@@ -233,6 +229,8 @@ module Bundler
233
229
  end
234
230
 
235
231
  def update_present_via_semver_portions(current_spec, active_spec, options)
232
+ return false if active_spec.nil?
233
+
236
234
  current_major = current_spec.version.segments.first
237
235
  active_major = active_spec.version.segments.first
238
236
 
@@ -22,13 +22,13 @@ module Bundler
22
22
 
23
23
  def initialize(fetcher)
24
24
  @fetcher = fetcher
25
- require "tmpdir"
25
+ require_relative "../vendored_tmpdir"
26
26
  end
27
27
 
28
28
  def update(local_path, remote_path, retrying = nil)
29
29
  headers = {}
30
30
 
31
- Dir.mktmpdir("bundler-compact-index-") do |local_temp_dir|
31
+ Bundler::Dir.mktmpdir("bundler-compact-index-") do |local_temp_dir|
32
32
  local_temp_path = Pathname.new(local_temp_dir).join(local_path.basename)
33
33
 
34
34
  # first try to fetch any new bytes on the existing file
@@ -66,8 +66,8 @@ module Bundler
66
66
  end
67
67
  end
68
68
 
69
- response_etag = (response["ETag"] || "").gsub(%r{\AW/}, "")
70
- if etag_for(local_temp_path) == response_etag
69
+ etag = (response["ETag"] || "").gsub(%r{\AW/}, "")
70
+ if etag.length.zero? || etag_for(local_temp_path) == etag
71
71
  SharedHelpers.filesystem_access(local_path) do
72
72
  FileUtils.mv(local_temp_path, local_path)
73
73
  end
@@ -75,7 +75,7 @@ module Bundler
75
75
  end
76
76
 
77
77
  if retrying
78
- raise MisMatchedChecksumError.new(remote_path, response_etag, etag_for(local_temp_path))
78
+ raise MisMatchedChecksumError.new(remote_path, etag, etag_for(local_temp_path))
79
79
  end
80
80
 
81
81
  update(local_path, remote_path, :retrying)
@@ -118,7 +118,7 @@ module Bundler
118
118
  end
119
119
  @unlocking ||= @unlock[:ruby] ||= (!@locked_ruby_version ^ !@ruby_version)
120
120
 
121
- add_platforms unless Bundler.frozen_bundle?
121
+ add_current_platform unless Bundler.frozen_bundle?
122
122
 
123
123
  converge_path_sources_to_gemspec_sources
124
124
  @path_changes = converge_paths
@@ -547,17 +547,12 @@ module Bundler
547
547
 
548
548
  private
549
549
 
550
- def add_platforms
551
- (@dependencies.flat_map(&:expanded_platforms) + current_platforms).uniq.each do |platform|
552
- add_platform(platform)
553
- end
550
+ def add_current_platform
551
+ current_platforms.each {|platform| add_platform(platform) }
554
552
  end
555
553
 
556
554
  def current_platforms
557
- [].tap do |platforms|
558
- platforms << local_platform if Bundler.feature_flag.specific_platform?
559
- platforms << generic_local_platform
560
- end
555
+ [local_platform, generic_local_platform].uniq
561
556
  end
562
557
 
563
558
  def change_reason
@@ -105,7 +105,7 @@ module Bundler
105
105
  out << [" User Home", Gem.user_home]
106
106
  out << [" User Path", Gem.user_dir]
107
107
  out << [" Bin Dir", Gem.bindir]
108
- if defined?(OpenSSL)
108
+ if defined?(OpenSSL::SSL)
109
109
  out << ["OpenSSL"]
110
110
  out << [" Compiled", OpenSSL::OPENSSL_VERSION] if defined?(OpenSSL::OPENSSL_VERSION)
111
111
  out << [" Loaded", OpenSSL::OPENSSL_LIBRARY_VERSION] if defined?(OpenSSL::OPENSSL_LIBRARY_VERSION)
@@ -41,7 +41,6 @@ module Bundler
41
41
  settings_flag(:plugins) { @bundler_version >= Gem::Version.new("1.14") }
42
42
  settings_flag(:print_only_version_number) { bundler_3_mode? }
43
43
  settings_flag(:setup_makes_kernel_gem_public) { !bundler_3_mode? }
44
- settings_flag(:specific_platform) { bundler_3_mode? }
45
44
  settings_flag(:suppress_install_using_messages) { bundler_3_mode? }
46
45
  settings_flag(:unlock_source_unlocks_spec) { !bundler_3_mode? }
47
46
  settings_flag(:update_requires_all_flag) { bundler_4_mode? }
@@ -8,7 +8,7 @@ module Bundler
8
8
  class Index < Base
9
9
  def specs(_gem_names)
10
10
  Bundler.rubygems.fetch_all_remote_specs(remote)
11
- rescue Gem::RemoteFetcher::FetchError, OpenSSL::SSL::SSLError, Net::HTTPFatalError => e
11
+ rescue Gem::RemoteFetcher::FetchError => e
12
12
  case e.message
13
13
  when /certificate verify failed/
14
14
  raise CertificateFailureError.new(display_uri)
@@ -19,8 +19,7 @@ module Bundler
19
19
  raise BadAuthenticationError, remote_uri if remote_uri.userinfo
20
20
  raise AuthenticationRequiredError, remote_uri
21
21
  else
22
- Bundler.ui.trace e
23
- raise HTTPError, "Could not fetch specs from #{display_uri}"
22
+ raise HTTPError, "Could not fetch specs from #{display_uri} due to underlying error <#{e.message}>"
24
23
  end
25
24
  end
26
25
 
@@ -6,6 +6,18 @@ module Bundler
6
6
  module FriendlyErrors
7
7
  module_function
8
8
 
9
+ def enable!
10
+ @disabled = false
11
+ end
12
+
13
+ def disabled?
14
+ @disabled
15
+ end
16
+
17
+ def disable!
18
+ @disabled = true
19
+ end
20
+
9
21
  def log_error(error)
10
22
  case error
11
23
  when YamlSyntaxError
@@ -114,10 +126,13 @@ module Bundler
114
126
  end
115
127
 
116
128
  def self.with_friendly_errors
129
+ FriendlyErrors.enable!
117
130
  yield
118
131
  rescue SignalException
119
132
  raise
120
133
  rescue Exception => e # rubocop:disable Lint/RescueException
134
+ raise if FriendlyErrors.disabled?
135
+
121
136
  FriendlyErrors.log_error(e)
122
137
  exit FriendlyErrors.exit_status(e)
123
138
  end
@@ -195,7 +195,11 @@ module Bundler
195
195
  if base # allow all platforms when searching from a lockfile
196
196
  dependency.matches_spec?(spec)
197
197
  else
198
- dependency.matches_spec?(spec) && Gem::Platform.match(spec.platform)
198
+ if Gem::Platform.respond_to? :match_spec?
199
+ dependency.matches_spec?(spec) && Gem::Platform.match_spec?(spec)
200
+ else
201
+ dependency.matches_spec?(spec) && Gem::Platform.match(spec.platform)
202
+ end
199
203
  end
200
204
  end
201
205
 
@@ -179,11 +179,11 @@ module Bundler
179
179
  # @param [Pathname] gemfile_path The Gemfile from which to remove dependencies.
180
180
  def remove_gems_from_gemfile(gems, gemfile_path)
181
181
  patterns = /gem\s+(['"])#{Regexp.union(gems)}\1|gem\s*\((['"])#{Regexp.union(gems)}\2\)/
182
-
183
182
  new_gemfile = []
184
183
  multiline_removal = false
185
184
  IO.readlines(gemfile_path).each do |line|
186
- if line.match(patterns)
185
+ match_data = line.match(patterns)
186
+ if match_data && is_not_within_comment?(line, match_data)
187
187
  multiline_removal = line.rstrip.end_with?(",")
188
188
  # skip lines which match the regex
189
189
  next
@@ -207,6 +207,13 @@ module Bundler
207
207
  new_gemfile.join.chomp
208
208
  end
209
209
 
210
+ # @param [String] line Individual line of gemfile content.
211
+ # @param [MatchData] match_data Data about Regex match.
212
+ def is_not_within_comment?(line, match_data)
213
+ match_start_index = match_data.offset(0).first
214
+ !line[0..match_start_index].include?("#")
215
+ end
216
+
210
217
  # @param [Array] gemfile Array of gemfile contents.
211
218
  # @param [String] block_name Name of block name to look for.
212
219
  def remove_nested_blocks(gemfile, block_name)
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "erb"
4
3
  require "rubygems/dependency_installer"
5
4
  require_relative "worker"
6
5
  require_relative "installer/parallel_installer"
@@ -136,6 +135,7 @@ module Bundler
136
135
  end
137
136
 
138
137
  mode = Bundler::WINDOWS ? "wb:UTF-8" : "w"
138
+ require "erb"
139
139
  content = if RUBY_VERSION >= "2.6"
140
140
  ERB.new(template, :trim_mode => "-").result(binding)
141
141
  else
@@ -143,7 +143,7 @@ module Bundler
143
143
  end
144
144
 
145
145
  File.write(binstub_path, content, :mode => mode, :perm => 0o777 & ~File.umask)
146
- if Bundler::WINDOWS
146
+ if Bundler::WINDOWS || options[:all_platforms]
147
147
  prefix = "@ruby -x \"%~f0\" %*\n@exit /b %ERRORLEVEL%\n\n"
148
148
  File.write("#{binstub_path}.cmd", prefix + content, :mode => mode)
149
149
  end
@@ -164,7 +164,7 @@ module Bundler
164
164
  end
165
165
  end
166
166
 
167
- def generate_standalone_bundler_executable_stubs(spec)
167
+ def generate_standalone_bundler_executable_stubs(spec, options = {})
168
168
  # double-assignment to avoid warnings about variables that will be used by ERB
169
169
  bin_path = Bundler.bin_path
170
170
  unless path = Bundler.settings[:path]
@@ -182,6 +182,7 @@ module Bundler
182
182
  executable_path = executable_path
183
183
 
184
184
  mode = Bundler::WINDOWS ? "wb:UTF-8" : "w"
185
+ require "erb"
185
186
  content = if RUBY_VERSION >= "2.6"
186
187
  ERB.new(template, :trim_mode => "-").result(binding)
187
188
  else
@@ -189,7 +190,7 @@ module Bundler
189
190
  end
190
191
 
191
192
  File.write("#{bin_path}/#{executable}", content, :mode => mode, :perm => 0o755)
192
- if Bundler::WINDOWS
193
+ if Bundler::WINDOWS || options[:all_platforms]
193
194
  prefix = "@ruby -x \"%~f0\" %*\n@exit /b %ERRORLEVEL%\n\n"
194
195
  File.write("#{bin_path}/#{executable}.cmd", prefix + content, :mode => mode)
195
196
  end
@@ -243,6 +244,7 @@ module Bundler
243
244
  end
244
245
  end.flatten
245
246
  Bundler.rubygems.load_plugin_files(path_plugin_files)
247
+ Bundler.rubygems.load_env_plugins
246
248
  end
247
249
 
248
250
  def ensure_specs_are_compatible!
@@ -297,7 +299,7 @@ module Bundler
297
299
 
298
300
  # returns whether or not a re-resolve was needed
299
301
  def resolve_if_needed(options)
300
- if !@definition.unlocking? && !options["force"] && !options["all-platforms"] && !Bundler.settings[:inline] && Bundler.default_lockfile.file?
302
+ if !@definition.unlocking? && !options["force"] && !Bundler.settings[:inline] && Bundler.default_lockfile.file?
301
303
  return false if @definition.nothing_changed? && !@definition.missing_specs?
302
304
  end
303
305
 
@@ -79,19 +79,17 @@ module Bundler
79
79
  @specification = if source.is_a?(Source::Gemspec) && source.gemspec.name == name
80
80
  source.gemspec.tap {|s| s.source = source }
81
81
  else
82
- search_object = Bundler.feature_flag.specific_platform? || Bundler.settings[:force_ruby_platform] ? self : Dependency.new(name, version)
82
+ search_object = if source.is_a?(Source::Path)
83
+ Dependency.new(name, version)
84
+ else
85
+ self
86
+ end
83
87
  platform_object = Gem::Platform.new(platform)
84
88
  candidates = source.specs.search(search_object)
85
89
  same_platform_candidates = candidates.select do |spec|
86
90
  MatchPlatform.platforms_match?(spec.platform, platform_object)
87
91
  end
88
92
  search = same_platform_candidates.last || candidates.last
89
- if search && Gem::Platform.new(search.platform) != platform_object && !search.runtime_dependencies.-(dependencies.reject {|d| d.type == :development }).empty?
90
- Bundler.ui.warn "Unable to use the platform-specific (#{search.platform}) version of #{name} (#{version}) " \
91
- "because it has different dependencies from the #{platform} version. " \
92
- "To use the platform-specific version of the gem, run `bundle config set --local specific_platform true` and install again."
93
- search = source.specs.search(self).last
94
- end
95
93
  search.dependencies = dependencies if search && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification))
96
94
  search
97
95
  end
@@ -0,0 +1 @@
1
+ # Ignore all files in this directory
@@ -250,14 +250,6 @@ learn more about their operation in [bundle install(1)](bundle-install.1.html).
250
250
  be changed in the next major version.
251
251
  * `silence_root_warning` (`BUNDLE_SILENCE_ROOT_WARNING`):
252
252
  Silence the warning Bundler prints when installing gems as root.
253
- * `specific_platform` (`BUNDLE_SPECIFIC_PLATFORM`):
254
- Allow bundler to resolve for the specific running platform and store it in
255
- the lockfile, instead of only using a generic platform.
256
- A specific platform is the exact platform triple reported by
257
- `Gem::Platform.local`, such as `x86_64-darwin-16` or `universal-java-1.8`.
258
- On the other hand, generic platforms are those such as `ruby`, `mswin`, or
259
- `java`. In this example, `x86_64-darwin-16` would map to `ruby` and
260
- `universal-java-1.8` to `java`.
261
253
  * `ssl_ca_cert` (`BUNDLE_SSL_CA_CERT`):
262
254
  Path to a designated CA certificate file or folder containing multiple
263
255
  certificates for trusted CAs in PEM format.
@@ -371,7 +363,7 @@ Or you can set the credentials as an environment variable like this:
371
363
 
372
364
  For gems with a git source with HTTP(S) URL you can specify credentials like so:
373
365
 
374
- bundle config set --global https://github.com/bundler/bundler.git username:password
366
+ bundle config set --global https://github.com/rubygems/rubygems.git username:password
375
367
 
376
368
  Or you can set the credentials as an environment variable like so:
377
369
 
@@ -105,7 +105,7 @@ automatically and that requires `bundler` to silently remember them. Since
105
105
 
106
106
  * `--local`:
107
107
  Do not attempt to connect to `rubygems.org`. Instead, Bundler will use the
108
- gems already present in Rubygems' cache or in `vendor/cache`. Note that if a
108
+ gems already present in Rubygems' cache or in `vendor/cache`. Note that if an
109
109
  appropriate platform-specific gem exists on `rubygems.org` it will not be
110
110
  found.
111
111
 
@@ -260,7 +260,7 @@ module Bundler
260
260
  end
261
261
 
262
262
  def to_s
263
- "plugin source for #{options[:type]} with uri #{uri}"
263
+ "plugin source for #{@type} with uri #{@uri}"
264
264
  end
265
265
 
266
266
  # Note: Do not override if you don't know what you are doing.
@@ -10,7 +10,7 @@ module Bundler
10
10
  # So that we don't have to override all there methods to dummy ones
11
11
  # explicitly.
12
12
  # They will be handled by method_missing
13
- [:gemspec, :gem, :path, :install_if, :platforms, :env].each {|m| undef_method m }
13
+ [:gemspec, :gem, :install_if, :platforms, :env].each {|m| undef_method m }
14
14
 
15
15
  # This lists the plugins that was added automatically and not specified by
16
16
  # the user.
@@ -158,9 +158,8 @@ module Bundler
158
158
  # spec group.
159
159
  sg_ruby = sg.copy_for(Gem::Platform::RUBY)
160
160
  selected_sgs << sg_ruby if sg_ruby
161
- all_platforms = @platforms + [platform]
162
- next if all_platforms.to_a == [Gem::Platform::RUBY]
163
161
  sg_all_platforms = nil
162
+ all_platforms = @platforms + [platform]
164
163
  self.class.sort_platforms(all_platforms).reverse_each do |other_platform|
165
164
  if sg_all_platforms.nil?
166
165
  sg_all_platforms = sg.copy_for(other_platform)
@@ -302,7 +301,7 @@ module Bundler
302
301
  versions_with_platforms = specs.map {|s| [s.version, s.platform] }
303
302
  message = String.new("Could not find gem '#{SharedHelpers.pretty_dependency(requirement)}' in #{source}#{cache_message}.\n")
304
303
  message << if versions_with_platforms.any?
305
- "The source contains '#{name}' at: #{formatted_versions_with_platforms(versions_with_platforms)}"
304
+ "The source contains the following versions of '#{name}': #{formatted_versions_with_platforms(versions_with_platforms)}"
306
305
  else
307
306
  "The source does not contain any versions of '#{name}'"
308
307
  end
@@ -227,6 +227,10 @@ module Bundler
227
227
  Gem.load_plugin_files(files) if Gem.respond_to?(:load_plugin_files)
228
228
  end
229
229
 
230
+ def load_env_plugins
231
+ Gem.load_env_plugins if Gem.respond_to?(:load_env_plugins)
232
+ end
233
+
230
234
  def ui=(obj)
231
235
  Gem::DefaultUserInteraction.ui = obj
232
236
  end
@@ -42,7 +42,6 @@ module Bundler
42
42
  setup_makes_kernel_gem_public
43
43
  silence_deprecations
44
44
  silence_root_warning
45
- specific_platform
46
45
  suppress_install_using_messages
47
46
  unlock_source_unlocks_spec
48
47
  update_requires_all_flag
@@ -118,7 +118,7 @@ module Bundler
118
118
  git_retry %(clone --no-checkout --quiet "#{path}" "#{destination}")
119
119
  File.chmod(((File.stat(destination).mode | 0o777) & ~File.umask), destination)
120
120
  rescue Errno::EEXIST => e
121
- file_path = e.message[%r{.*?(/.*)}, 1]
121
+ file_path = e.message[%r{.*?((?:[a-zA-Z]:)?/.*)}, 1]
122
122
  raise GitError, "Bundler could not install a gem because it needs to " \
123
123
  "create a directory, but a file exists - #{file_path}. Please delete " \
124
124
  "this file and try again."