rubygems-update 3.5.5 → 3.5.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (214) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +107 -0
  3. data/Manifest.txt +84 -64
  4. data/POLICIES.md +75 -6
  5. data/bundler/CHANGELOG.md +75 -0
  6. data/bundler/lib/bundler/build_metadata.rb +2 -2
  7. data/bundler/lib/bundler/cli/binstubs.rb +1 -1
  8. data/bundler/lib/bundler/cli/gem.rb +1 -1
  9. data/bundler/lib/bundler/cli/lock.rb +5 -4
  10. data/bundler/lib/bundler/cli/plugin.rb +3 -2
  11. data/bundler/lib/bundler/cli.rb +7 -24
  12. data/bundler/lib/bundler/definition.rb +111 -56
  13. data/bundler/lib/bundler/dependency.rb +2 -1
  14. data/bundler/lib/bundler/dsl.rb +16 -1
  15. data/bundler/lib/bundler/environment_preserver.rb +5 -23
  16. data/bundler/lib/bundler/fetcher/downloader.rb +1 -1
  17. data/bundler/lib/bundler/fetcher.rb +2 -2
  18. data/bundler/lib/bundler/gem_version_promoter.rb +42 -38
  19. data/bundler/lib/bundler/injector.rb +3 -2
  20. data/bundler/lib/bundler/installer.rb +2 -2
  21. data/bundler/lib/bundler/man/bundle-add.1 +1 -1
  22. data/bundler/lib/bundler/man/bundle-binstubs.1 +1 -1
  23. data/bundler/lib/bundler/man/bundle-cache.1 +1 -1
  24. data/bundler/lib/bundler/man/bundle-check.1 +3 -1
  25. data/bundler/lib/bundler/man/bundle-check.1.ronn +3 -0
  26. data/bundler/lib/bundler/man/bundle-clean.1 +1 -1
  27. data/bundler/lib/bundler/man/bundle-config.1 +1 -3
  28. data/bundler/lib/bundler/man/bundle-config.1.ronn +0 -3
  29. data/bundler/lib/bundler/man/bundle-console.1 +1 -1
  30. data/bundler/lib/bundler/man/bundle-doctor.1 +1 -1
  31. data/bundler/lib/bundler/man/bundle-exec.1 +1 -1
  32. data/bundler/lib/bundler/man/bundle-gem.1 +1 -1
  33. data/bundler/lib/bundler/man/bundle-help.1 +1 -1
  34. data/bundler/lib/bundler/man/bundle-info.1 +1 -1
  35. data/bundler/lib/bundler/man/bundle-init.1 +1 -1
  36. data/bundler/lib/bundler/man/bundle-inject.1 +1 -1
  37. data/bundler/lib/bundler/man/bundle-install.1 +3 -3
  38. data/bundler/lib/bundler/man/bundle-install.1.ronn +2 -2
  39. data/bundler/lib/bundler/man/bundle-list.1 +1 -1
  40. data/bundler/lib/bundler/man/bundle-lock.1 +1 -1
  41. data/bundler/lib/bundler/man/bundle-open.1 +1 -1
  42. data/bundler/lib/bundler/man/bundle-outdated.1 +1 -1
  43. data/bundler/lib/bundler/man/bundle-platform.1 +1 -1
  44. data/bundler/lib/bundler/man/bundle-plugin.1 +7 -4
  45. data/bundler/lib/bundler/man/bundle-plugin.1.ronn +7 -3
  46. data/bundler/lib/bundler/man/bundle-pristine.1 +1 -1
  47. data/bundler/lib/bundler/man/bundle-remove.1 +1 -1
  48. data/bundler/lib/bundler/man/bundle-show.1 +1 -1
  49. data/bundler/lib/bundler/man/bundle-update.1 +1 -1
  50. data/bundler/lib/bundler/man/bundle-version.1 +1 -1
  51. data/bundler/lib/bundler/man/bundle-viz.1 +1 -1
  52. data/bundler/lib/bundler/man/bundle.1 +1 -1
  53. data/bundler/lib/bundler/man/gemfile.5 +3 -3
  54. data/bundler/lib/bundler/man/gemfile.5.ronn +2 -2
  55. data/bundler/lib/bundler/mirror.rb +3 -3
  56. data/bundler/lib/bundler/plugin/api/source.rb +2 -2
  57. data/bundler/lib/bundler/plugin/installer/path.rb +18 -0
  58. data/bundler/lib/bundler/plugin/installer.rb +36 -16
  59. data/bundler/lib/bundler/plugin/source_list.rb +4 -4
  60. data/bundler/lib/bundler/resolver/candidate.rb +1 -1
  61. data/bundler/lib/bundler/resolver.rb +54 -24
  62. data/bundler/lib/bundler/rubygems_ext.rb +12 -0
  63. data/bundler/lib/bundler/runtime.rb +1 -1
  64. data/bundler/lib/bundler/self_manager.rb +1 -1
  65. data/bundler/lib/bundler/settings.rb +14 -12
  66. data/bundler/lib/bundler/setup.rb +3 -0
  67. data/bundler/lib/bundler/source/git/git_proxy.rb +1 -1
  68. data/bundler/lib/bundler/source/git.rb +1 -1
  69. data/bundler/lib/bundler/source/rubygems/remote.rb +1 -1
  70. data/bundler/lib/bundler/source/rubygems.rb +7 -20
  71. data/bundler/lib/bundler/source_list.rb +17 -4
  72. data/bundler/lib/bundler/spec_set.rb +1 -1
  73. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +4 -3
  74. data/bundler/lib/bundler/templates/newgem/rubocop.yml.tt +0 -5
  75. data/bundler/lib/bundler/uri_credentials_filter.rb +2 -2
  76. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +22 -22
  77. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +1 -0
  78. data/bundler/lib/bundler/vendored_net_http.rb +7 -3
  79. data/bundler/lib/bundler/vendored_timeout.rb +7 -3
  80. data/bundler/lib/bundler/vendored_uri.rb +18 -1
  81. data/bundler/lib/bundler/version.rb +1 -1
  82. data/bundler/lib/bundler/yaml_serializer.rb +12 -0
  83. data/bundler/lib/bundler.rb +23 -2
  84. data/lib/rubygems/command.rb +1 -1
  85. data/lib/rubygems/command_manager.rb +2 -1
  86. data/lib/rubygems/commands/build_command.rb +2 -11
  87. data/lib/rubygems/commands/help_command.rb +2 -2
  88. data/lib/rubygems/commands/rdoc_command.rb +1 -8
  89. data/lib/rubygems/commands/rebuild_command.rb +264 -0
  90. data/lib/rubygems/commands/sources_command.rb +2 -2
  91. data/lib/rubygems/commands/update_command.rb +8 -9
  92. data/lib/rubygems/config_file.rb +20 -8
  93. data/lib/rubygems/defaults.rb +4 -4
  94. data/lib/rubygems/dependency.rb +2 -2
  95. data/lib/rubygems/dependency_list.rb +1 -1
  96. data/lib/rubygems/deprecate.rb +79 -77
  97. data/lib/rubygems/ext/cargo_builder.rb +1 -1
  98. data/lib/rubygems/gemcutter_utilities/webauthn_listener.rb +1 -1
  99. data/lib/rubygems/gemcutter_utilities/webauthn_poller.rb +3 -1
  100. data/lib/rubygems/gemcutter_utilities.rb +40 -23
  101. data/lib/rubygems/gemspec_helpers.rb +19 -0
  102. data/lib/rubygems/local_remote_options.rb +6 -6
  103. data/lib/rubygems/package.rb +13 -7
  104. data/lib/rubygems/remote_fetcher.rb +3 -3
  105. data/lib/rubygems/request.rb +5 -5
  106. data/lib/rubygems/request_set.rb +1 -1
  107. data/lib/rubygems/requirement.rb +5 -0
  108. data/lib/rubygems/resolver/api_set.rb +1 -1
  109. data/lib/rubygems/resolver/best_set.rb +1 -1
  110. data/lib/rubygems/resolver/spec_specification.rb +7 -0
  111. data/lib/rubygems/resolver.rb +5 -5
  112. data/lib/rubygems/s3_uri_signer.rb +3 -3
  113. data/lib/rubygems/safe_yaml.rb +10 -1
  114. data/lib/rubygems/security.rb +1 -1
  115. data/lib/rubygems/source/git.rb +2 -2
  116. data/lib/rubygems/source_list.rb +1 -1
  117. data/lib/rubygems/specification.rb +6 -6
  118. data/lib/rubygems/specification_policy.rb +15 -7
  119. data/lib/rubygems/uri.rb +6 -6
  120. data/lib/rubygems/util/licenses.rb +43 -0
  121. data/lib/rubygems/util.rb +1 -1
  122. data/lib/rubygems/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +57 -0
  123. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/delegates/specification_provider.rb +11 -11
  124. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/action.rb +1 -1
  125. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +1 -1
  126. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +1 -1
  127. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +1 -1
  128. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -1
  129. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/log.rb +1 -1
  130. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/set_payload.rb +1 -1
  131. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/tag.rb +1 -1
  132. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/vertex.rb +1 -1
  133. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph.rb +2 -2
  134. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/errors.rb +1 -1
  135. data/lib/rubygems/vendor/molinillo/lib/molinillo/gem_metadata.rb +6 -0
  136. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/modules/specification_provider.rb +2 -2
  137. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/modules/ui.rb +1 -1
  138. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/resolution.rb +3 -3
  139. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/resolver.rb +1 -1
  140. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/state.rb +1 -1
  141. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo.rb +2 -2
  142. data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/generic_request.rb +9 -9
  143. data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/header.rb +2 -2
  144. data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/request.rb +3 -3
  145. data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/requests.rb +30 -30
  146. data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/response.rb +2 -2
  147. data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/responses.rb +6 -6
  148. data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/status.rb +1 -1
  149. data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http.rb +15 -15
  150. data/lib/rubygems/{net-http → vendor/net-http}/lib/net/https.rb +1 -1
  151. data/lib/rubygems/vendor/optparse/lib/optparse/uri.rb +7 -0
  152. data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse.rb +11 -11
  153. data/lib/rubygems/{timeout → vendor/timeout}/lib/timeout.rb +1 -1
  154. data/lib/rubygems/{tsort → vendor/tsort}/lib/tsort.rb +2 -2
  155. data/lib/rubygems/vendor/uri/.document +1 -0
  156. data/lib/rubygems/vendor/uri/LICENSE.txt +22 -0
  157. data/lib/rubygems/vendor/uri/lib/uri/common.rb +853 -0
  158. data/lib/rubygems/vendor/uri/lib/uri/file.rb +100 -0
  159. data/lib/rubygems/vendor/uri/lib/uri/ftp.rb +267 -0
  160. data/lib/rubygems/vendor/uri/lib/uri/generic.rb +1588 -0
  161. data/lib/rubygems/vendor/uri/lib/uri/http.rb +125 -0
  162. data/lib/rubygems/vendor/uri/lib/uri/https.rb +23 -0
  163. data/lib/rubygems/vendor/uri/lib/uri/ldap.rb +261 -0
  164. data/lib/rubygems/vendor/uri/lib/uri/ldaps.rb +22 -0
  165. data/lib/rubygems/vendor/uri/lib/uri/mailto.rb +293 -0
  166. data/lib/rubygems/vendor/uri/lib/uri/rfc2396_parser.rb +539 -0
  167. data/lib/rubygems/vendor/uri/lib/uri/rfc3986_parser.rb +183 -0
  168. data/lib/rubygems/vendor/uri/lib/uri/version.rb +6 -0
  169. data/lib/rubygems/vendor/uri/lib/uri/ws.rb +83 -0
  170. data/lib/rubygems/vendor/uri/lib/uri/wss.rb +23 -0
  171. data/lib/rubygems/vendor/uri/lib/uri.rb +104 -0
  172. data/lib/rubygems/vendored_molinillo.rb +3 -0
  173. data/lib/rubygems/vendored_net_http.rb +5 -0
  174. data/lib/rubygems/vendored_optparse.rb +3 -0
  175. data/lib/rubygems/vendored_timeout.rb +5 -0
  176. data/lib/rubygems/vendored_tsort.rb +3 -0
  177. data/lib/rubygems/yaml_serializer.rb +12 -0
  178. data/lib/rubygems.rb +2 -2
  179. data/rubygems-update.gemspec +7 -2
  180. metadata +90 -67
  181. data/lib/rubygems/net/http.rb +0 -3
  182. data/lib/rubygems/optparse/lib/optparse/uri.rb +0 -7
  183. data/lib/rubygems/optparse.rb +0 -3
  184. data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/resolution_state.rb +0 -57
  185. data/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb +0 -6
  186. data/lib/rubygems/resolver/molinillo.rb +0 -3
  187. data/lib/rubygems/timeout.rb +0 -3
  188. data/lib/rubygems/tsort.rb +0 -3
  189. /data/lib/rubygems/{net-http → vendor/molinillo}/.document +0 -0
  190. /data/lib/rubygems/{resolver → vendor}/molinillo/LICENSE +0 -0
  191. /data/lib/rubygems/{net-protocol → vendor/net-http}/.document +0 -0
  192. /data/lib/rubygems/{net-http → vendor/net-http}/LICENSE.txt +0 -0
  193. /data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/backward.rb +0 -0
  194. /data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/exceptions.rb +0 -0
  195. /data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/proxy_delta.rb +0 -0
  196. /data/lib/rubygems/{optparse → vendor/net-protocol}/.document +0 -0
  197. /data/lib/rubygems/{net-protocol → vendor/net-protocol}/LICENSE.txt +0 -0
  198. /data/lib/rubygems/{net-protocol → vendor/net-protocol}/lib/net/protocol.rb +0 -0
  199. /data/lib/rubygems/{resolv → vendor/optparse}/.document +0 -0
  200. /data/lib/rubygems/{optparse → vendor/optparse}/COPYING +0 -0
  201. /data/lib/rubygems/{optparse → vendor/optparse}/lib/optionparser.rb +0 -0
  202. /data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse/ac.rb +0 -0
  203. /data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse/date.rb +0 -0
  204. /data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse/kwargs.rb +0 -0
  205. /data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse/shellwords.rb +0 -0
  206. /data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse/time.rb +0 -0
  207. /data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse/version.rb +0 -0
  208. /data/lib/rubygems/{resolver/molinillo → vendor/resolv}/.document +0 -0
  209. /data/lib/rubygems/{resolv → vendor/resolv}/LICENSE.txt +0 -0
  210. /data/lib/rubygems/{resolv → vendor/resolv}/lib/resolv.rb +0 -0
  211. /data/lib/rubygems/{timeout → vendor/timeout}/.document +0 -0
  212. /data/lib/rubygems/{timeout → vendor/timeout}/LICENSE.txt +0 -0
  213. /data/lib/rubygems/{tsort → vendor/tsort}/.document +0 -0
  214. /data/lib/rubygems/{tsort → vendor/tsort}/LICENSE.txt +0 -0
@@ -50,26 +50,26 @@ module Bundler
50
50
  specs[name] = matches.sort_by {|s| [s.version, s.platform.to_s] }
51
51
  end
52
52
 
53
+ @all_versions = Hash.new do |candidates, package|
54
+ candidates[package] = all_versions_for(package)
55
+ end
56
+
53
57
  @sorted_versions = Hash.new do |candidates, package|
54
- candidates[package] = if package.root?
55
- [root_version]
56
- else
57
- all_versions_for(package).sort
58
- end
58
+ candidates[package] = filtered_versions_for(package).sort
59
59
  end
60
60
 
61
+ @sorted_versions[root] = [root_version]
62
+
61
63
  root_dependencies = prepare_dependencies(@requirements, @packages)
62
64
 
63
65
  @cached_dependencies = Hash.new do |dependencies, package|
64
- dependencies[package] = if package.root?
65
- { root_version => root_dependencies }
66
- else
67
- Hash.new do |versions, version|
68
- versions[version] = to_dependency_hash(version.dependencies.reject {|d| d.name == package.name }, @packages)
69
- end
66
+ dependencies[package] = Hash.new do |versions, version|
67
+ versions[version] = to_dependency_hash(version.dependencies.reject {|d| d.name == package.name }, @packages)
70
68
  end
71
69
  end
72
70
 
71
+ @cached_dependencies[root] = { root_version => root_dependencies }
72
+
73
73
  logger = Bundler::UI::Shell.new
74
74
  logger.level = debug? ? "debug" : "warn"
75
75
 
@@ -156,9 +156,15 @@ module Bundler
156
156
  end
157
157
 
158
158
  def versions_for(package, range=VersionRange.any)
159
- versions = range.select_versions(@sorted_versions[package])
159
+ versions = select_sorted_versions(package, range)
160
160
 
161
- sort_versions(package, versions)
161
+ # Conditional avoids (among other things) calling
162
+ # sort_versions_by_preferred with the root package
163
+ if versions.size > 1
164
+ sort_versions_by_preferred(package, versions)
165
+ else
166
+ versions
167
+ end
162
168
  end
163
169
 
164
170
  def no_versions_incompatibility_for(package, unsatisfied_term)
@@ -247,7 +253,7 @@ module Bundler
247
253
  locked_requirement = base_requirements[name]
248
254
  results = filter_matching_specs(results, locked_requirement) if locked_requirement
249
255
 
250
- versions = results.group_by(&:version).reduce([]) do |groups, (version, specs)|
256
+ results.group_by(&:version).reduce([]) do |groups, (version, specs)|
251
257
  platform_specs = package.platforms.map {|platform| select_best_platform_match(specs, platform) }
252
258
 
253
259
  # If package is a top-level dependency,
@@ -274,8 +280,6 @@ module Bundler
274
280
 
275
281
  groups
276
282
  end
277
-
278
- sort_versions(package, versions)
279
283
  end
280
284
 
281
285
  def source_for(name)
@@ -334,6 +338,21 @@ module Bundler
334
338
 
335
339
  private
336
340
 
341
+ def filtered_versions_for(package)
342
+ @gem_version_promoter.filter_versions(package, @all_versions[package])
343
+ end
344
+
345
+ def raise_all_versions_filtered_out!(package)
346
+ level = @gem_version_promoter.level
347
+ name = package.name
348
+ locked_version = package.locked_version
349
+ requirement = package.dependency
350
+
351
+ raise GemNotFound,
352
+ "#{name} is locked to #{locked_version}, while Gemfile is requesting #{requirement}. " \
353
+ "--strict --#{level} was specified, but there are no #{level} level upgrades from #{locked_version} satisfying #{requirement}, so version solving has failed"
354
+ end
355
+
337
356
  def filter_matching_specs(specs, requirements)
338
357
  Array(requirements).flat_map do |requirement|
339
358
  specs.select {| spec| requirement_satisfied_by?(requirement, spec) }
@@ -357,12 +376,8 @@ module Bundler
357
376
  requirement.satisfied_by?(spec.version) || spec.source.is_a?(Source::Gemspec)
358
377
  end
359
378
 
360
- def sort_versions(package, versions)
361
- if versions.size > 1
362
- @gem_version_promoter.sort_versions(package, versions).reverse
363
- else
364
- versions
365
- end
379
+ def sort_versions_by_preferred(package, versions)
380
+ @gem_version_promoter.sort_versions(package, versions)
366
381
  end
367
382
 
368
383
  def repository_for(package)
@@ -379,12 +394,19 @@ module Bundler
379
394
 
380
395
  next [dep_package, dep_constraint] if name == "bundler"
381
396
 
382
- versions = versions_for(dep_package, dep_constraint.range)
397
+ dep_range = dep_constraint.range
398
+ versions = select_sorted_versions(dep_package, dep_range)
383
399
  if versions.empty? && dep_package.ignores_prereleases?
400
+ @all_versions.delete(dep_package)
384
401
  @sorted_versions.delete(dep_package)
385
402
  dep_package.consider_prereleases!
386
- versions = versions_for(dep_package, dep_constraint.range)
403
+ versions = select_sorted_versions(dep_package, dep_range)
387
404
  end
405
+
406
+ if versions.empty? && select_all_versions(dep_package, dep_range).any?
407
+ raise_all_versions_filtered_out!(dep_package)
408
+ end
409
+
388
410
  next [dep_package, dep_constraint] unless versions.empty?
389
411
 
390
412
  next unless dep_package.current_platform?
@@ -393,6 +415,14 @@ module Bundler
393
415
  end.compact.to_h
394
416
  end
395
417
 
418
+ def select_sorted_versions(package, range)
419
+ range.select_versions(@sorted_versions[package])
420
+ end
421
+
422
+ def select_all_versions(package, range)
423
+ range.select_versions(@all_versions[package])
424
+ end
425
+
396
426
  def other_specs_matching_message(specs, requirement)
397
427
  message = String.new("The source contains the following gems matching '#{requirement}':\n")
398
428
  message << specs.map {|s| " * #{s.full_name}" }.join("\n")
@@ -146,6 +146,18 @@ module Gem
146
146
  end
147
147
  end
148
148
 
149
+ module BetterPermissionError
150
+ def data
151
+ Bundler::SharedHelpers.filesystem_access(loaded_from, :read) do
152
+ super
153
+ end
154
+ end
155
+ end
156
+
157
+ class StubSpecification
158
+ prepend BetterPermissionError
159
+ end
160
+
149
161
  class Dependency
150
162
  include ::Bundler::ForcePlatform
151
163
 
@@ -95,7 +95,7 @@ module Bundler
95
95
 
96
96
  def lock(opts = {})
97
97
  return if @definition.no_resolve_needed?
98
- @definition.lock(Bundler.default_lockfile, opts[:preserve_unknown_sections])
98
+ @definition.lock(opts[:preserve_unknown_sections])
99
99
  end
100
100
 
101
101
  alias_method :gems, :specs
@@ -113,7 +113,7 @@ module Bundler
113
113
  end
114
114
 
115
115
  def local_specs
116
- @local_specs ||= Bundler::Source::Rubygems.new("allow_local" => true).specs.select {|spec| spec.name == "bundler" }
116
+ @local_specs ||= Bundler::Source::Rubygems.new("allow_local" => true, "allow_cached" => true).specs.select {|spec| spec.name == "bundler" }
117
117
  end
118
118
 
119
119
  def remote_specs
@@ -7,7 +7,6 @@ module Bundler
7
7
  autoload :Validator, File.expand_path("settings/validator", __dir__)
8
8
 
9
9
  BOOL_KEYS = %w[
10
- allow_deployment_source_credential_changes
11
10
  allow_offline_install
12
11
  auto_clean_without_path
13
12
  auto_install
@@ -189,7 +188,7 @@ module Bundler
189
188
  def mirror_for(uri)
190
189
  if uri.is_a?(String)
191
190
  require_relative "vendored_uri"
192
- uri = Bundler::URI(uri)
191
+ uri = Gem::URI(uri)
193
192
  end
194
193
 
195
194
  gem_mirrors.for(uri.to_s).uri
@@ -492,16 +491,19 @@ module Bundler
492
491
  valid_file = file.exist? && !file.size.zero?
493
492
  return {} unless valid_file
494
493
  serializer_class.load(file.read).inject({}) do |config, (k, v)|
495
- if k.include?("-")
496
- Bundler.ui.warn "Your #{file} config includes `#{k}`, which contains the dash character (`-`).\n" \
497
- "This is deprecated, because configuration through `ENV` should be possible, but `ENV` keys cannot include dashes.\n" \
498
- "Please edit #{file} and replace any dashes in configuration keys with a triple underscore (`___`)."
494
+ unless k.start_with?("#")
495
+ if k.include?("-")
496
+ Bundler.ui.warn "Your #{file} config includes `#{k}`, which contains the dash character (`-`).\n" \
497
+ "This is deprecated, because configuration through `ENV` should be possible, but `ENV` keys cannot include dashes.\n" \
498
+ "Please edit #{file} and replace any dashes in configuration keys with a triple underscore (`___`)."
499
499
 
500
- # string hash keys are frozen
501
- k = k.gsub("-", "___")
500
+ # string hash keys are frozen
501
+ k = k.gsub("-", "___")
502
+ end
503
+
504
+ config[k] = v
502
505
  end
503
506
 
504
- config[k] = v
505
507
  config
506
508
  end
507
509
  end
@@ -549,7 +551,7 @@ module Bundler
549
551
  end
550
552
  uri = URINormalizer.normalize_suffix(uri)
551
553
  require_relative "vendored_uri"
552
- uri = Bundler::URI(uri)
554
+ uri = Gem::URI(uri)
553
555
  unless uri.absolute?
554
556
  raise ArgumentError, format("Gem sources must be absolute. You provided '%s'.", uri)
555
557
  end
@@ -564,7 +566,7 @@ module Bundler
564
566
  key
565
567
  when Symbol
566
568
  key.name
567
- when Bundler::URI::HTTP
569
+ when Gem::URI::HTTP
568
570
  key.to_s
569
571
  else
570
572
  raise ArgumentError, "Invalid key: #{key.inspect}"
@@ -577,7 +579,7 @@ module Bundler
577
579
  key
578
580
  when Symbol
579
581
  key.to_s
580
- when Bundler::URI::HTTP
582
+ when Gem::URI::HTTP
581
583
  key.to_s
582
584
  else
583
585
  raise ArgumentError, "Invalid key: #{key.inspect}"
@@ -5,6 +5,9 @@ require_relative "shared_helpers"
5
5
  if Bundler::SharedHelpers.in_bundle?
6
6
  require_relative "../bundler"
7
7
 
8
+ # try to auto_install first before we get to the `Bundler.ui.silence`, so user knows what is happening
9
+ Bundler.auto_install
10
+
8
11
  if STDOUT.tty? || ENV["BUNDLER_FORCE_TTY"]
9
12
  begin
10
13
  Bundler.ui.silence { Bundler.setup }
@@ -320,7 +320,7 @@ module Bundler
320
320
  # Adds credentials to the URI
321
321
  def configured_uri
322
322
  if /https?:/.match?(uri)
323
- remote = Bundler::URI(uri)
323
+ remote = Gem::URI(uri)
324
324
  config_auth = Bundler.settings[remote.to_s] || Bundler.settings[remote.host]
325
325
  remote.userinfo ||= config_auth
326
326
  remote.to_s
@@ -326,7 +326,7 @@ module Bundler
326
326
  if %r{^\w+://(\w+@)?}.match?(uri)
327
327
  # Downcase the domain component of the URI
328
328
  # and strip off a trailing slash, if one is present
329
- input = Bundler::URI.parse(uri).normalize.to_s.sub(%r{/$}, "")
329
+ input = Gem::URI.parse(uri).normalize.to_s.sub(%r{/$}, "")
330
330
  else
331
331
  # If there is no URI scheme, assume it is an ssh/git URI
332
332
  input = uri
@@ -48,7 +48,7 @@ module Bundler
48
48
  end
49
49
 
50
50
  uri
51
- rescue Bundler::URI::InvalidComponentError
51
+ rescue Gem::URI::InvalidComponentError
52
52
  error_message = "Please CGI escape your usernames and passwords before " \
53
53
  "setting them for authentication."
54
54
  raise HTTPError.new(error_message)
@@ -10,14 +10,14 @@ module Bundler
10
10
  # Ask for X gems per API request
11
11
  API_REQUEST_SIZE = 50
12
12
 
13
- attr_reader :remotes
13
+ attr_accessor :remotes
14
14
 
15
15
  def initialize(options = {})
16
16
  @options = options
17
17
  @remotes = []
18
18
  @dependency_names = []
19
19
  @allow_remote = false
20
- @allow_cached = false
20
+ @allow_cached = options["allow_cached"] || false
21
21
  @allow_local = options["allow_local"] || false
22
22
  @checksum_store = Checksum::Store.new
23
23
 
@@ -96,7 +96,7 @@ module Bundler
96
96
  def to_lock
97
97
  out = String.new("GEM\n")
98
98
  remotes.reverse_each do |remote|
99
- out << " remote: #{suppress_configured_credentials remote}\n"
99
+ out << " remote: #{remove_auth remote}\n"
100
100
  end
101
101
  out << " specs:\n"
102
102
  end
@@ -133,7 +133,7 @@ module Bundler
133
133
  # sources, and large_idx.merge! small_idx is way faster than
134
134
  # small_idx.merge! large_idx.
135
135
  index = @allow_remote ? remote_specs.dup : Index.new
136
- index.merge!(cached_specs) if @allow_cached || @allow_remote
136
+ index.merge!(cached_specs) if @allow_cached
137
137
  index.merge!(installed_specs) if @allow_local
138
138
  index
139
139
  end
@@ -312,11 +312,7 @@ module Bundler
312
312
  end
313
313
 
314
314
  def credless_remotes
315
- if Bundler.settings[:allow_deployment_source_credential_changes]
316
- remotes.map(&method(:remove_auth))
317
- else
318
- remotes.map(&method(:suppress_configured_credentials))
319
- end
315
+ remotes.map(&method(:remove_auth))
320
316
  end
321
317
 
322
318
  def remotes_for_spec(spec)
@@ -349,21 +345,12 @@ module Bundler
349
345
  def normalize_uri(uri)
350
346
  uri = URINormalizer.normalize_suffix(uri.to_s)
351
347
  require_relative "../vendored_uri"
352
- uri = Bundler::URI(uri)
348
+ uri = Gem::URI(uri)
353
349
  raise ArgumentError, "The source must be an absolute URI. For example:\n" \
354
- "source 'https://rubygems.org'" if !uri.absolute? || (uri.is_a?(Bundler::URI::HTTP) && uri.host.nil?)
350
+ "source 'https://rubygems.org'" if !uri.absolute? || (uri.is_a?(Gem::URI::HTTP) && uri.host.nil?)
355
351
  uri
356
352
  end
357
353
 
358
- def suppress_configured_credentials(remote)
359
- remote_nouser = remove_auth(remote)
360
- if remote.userinfo && remote.userinfo == Bundler.settings[remote_nouser]
361
- remote_nouser
362
- else
363
- remote
364
- end
365
- end
366
-
367
354
  def remove_auth(remote)
368
355
  if remote.user || remote.password
369
356
  remote.dup.tap {|uri| uri.user = uri.password = nil }.to_s
@@ -9,7 +9,7 @@ module Bundler
9
9
  :metadata_source
10
10
 
11
11
  def global_rubygems_source
12
- @global_rubygems_source ||= rubygems_aggregate_class.new("allow_local" => true)
12
+ @global_rubygems_source ||= rubygems_aggregate_class.new("allow_local" => true, "allow_cached" => true)
13
13
  end
14
14
 
15
15
  def initialize
@@ -157,7 +157,11 @@ module Bundler
157
157
  end
158
158
 
159
159
  def map_sources(replacement_sources)
160
- rubygems, git, plugin = [@rubygems_sources, @git_sources, @plugin_sources].map do |sources|
160
+ rubygems = @rubygems_sources.map do |source|
161
+ replace_rubygems_source(replacement_sources, source) || source
162
+ end
163
+
164
+ git, plugin = [@git_sources, @plugin_sources].map do |sources|
161
165
  sources.map do |source|
162
166
  replacement_sources.find {|s| s == source } || source
163
167
  end
@@ -171,10 +175,19 @@ module Bundler
171
175
  end
172
176
 
173
177
  def global_replacement_source(replacement_sources)
174
- replacement_source = replacement_sources.find {|s| s == global_rubygems_source }
178
+ replacement_source = replace_rubygems_source(replacement_sources, global_rubygems_source)
175
179
  return global_rubygems_source unless replacement_source
176
180
 
177
- replacement_source.local!
181
+ replacement_source.cached!
182
+ replacement_source
183
+ end
184
+
185
+ def replace_rubygems_source(replacement_sources, gemfile_source)
186
+ replacement_source = replacement_sources.find {|s| s == gemfile_source }
187
+ return unless replacement_source
188
+
189
+ # locked sources never include credentials so always prefer remotes from the gemfile
190
+ replacement_source.remotes = gemfile_source.remotes
178
191
  replacement_source
179
192
  end
180
193
 
@@ -65,7 +65,7 @@ module Bundler
65
65
 
66
66
  platforms.concat(new_platforms)
67
67
 
68
- less_specific_platform = new_platforms.find {|platform| platform != Gem::Platform::RUBY && platform === Bundler.local_platform }
68
+ less_specific_platform = new_platforms.find {|platform| platform != Gem::Platform::RUBY && Bundler.local_platform === platform && platform === Bundler.local_platform }
69
69
  platforms.delete(Bundler.local_platform) if less_specific_platform
70
70
 
71
71
  platforms
@@ -27,9 +27,10 @@ Gem::Specification.new do |spec|
27
27
 
28
28
  # Specify which files should be added to the gem when it is released.
29
29
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
30
- spec.files = Dir.chdir(__dir__) do
31
- `git ls-files -z`.split("\x0").reject do |f|
32
- (File.expand_path(f) == __FILE__) ||
30
+ gemspec = File.basename(__FILE__)
31
+ spec.files = IO.popen(%w[git ls-files -z], chdir: __dir__, err: IO::NULL) do |ls|
32
+ ls.readlines("\x0", chomp: true).reject do |f|
33
+ (f == gemspec) ||
33
34
  f.start_with?(*%w[bin/ test/ spec/ features/ .git <%= config[:ci_config_path] %>appveyor Gemfile])
34
35
  end
35
36
  end
@@ -2,12 +2,7 @@ AllCops:
2
2
  TargetRubyVersion: <%= ::Gem::Version.new(config[:required_ruby_version]).segments[0..1].join(".") %>
3
3
 
4
4
  Style/StringLiterals:
5
- Enabled: true
6
5
  EnforcedStyle: double_quotes
7
6
 
8
7
  Style/StringLiteralsInInterpolation:
9
- Enabled: true
10
8
  EnforcedStyle: double_quotes
11
-
12
- Layout/LineLength:
13
- Max: 120
@@ -11,7 +11,7 @@ module Bundler
11
11
  return uri if File.exist?(uri)
12
12
 
13
13
  require_relative "vendored_uri"
14
- uri = Bundler::URI(uri)
14
+ uri = Gem::URI(uri)
15
15
  end
16
16
 
17
17
  if uri.userinfo
@@ -25,7 +25,7 @@ module Bundler
25
25
  end
26
26
  return uri.to_s if uri_to_anonymize.is_a?(String)
27
27
  uri
28
- rescue Bundler::URI::InvalidURIError # uri is not canonical uri scheme
28
+ rescue Gem::URI::InvalidURIError # uri is not canonical uri scheme
29
29
  uri
30
30
  end
31
31
 
@@ -1,5 +1,5 @@
1
1
  require_relative '../../../../../vendored_net_http'
2
- require_relative '../../../../uri/lib/uri'
2
+ require_relative '../../../../../vendored_uri'
3
3
  require 'cgi' # for escaping
4
4
  require_relative '../../../../connection_pool/lib/connection_pool'
5
5
 
@@ -22,7 +22,7 @@ autoload :OpenSSL, 'openssl'
22
22
  #
23
23
  # require 'bundler/vendor/net-http-persistent/lib/net/http/persistent'
24
24
  #
25
- # uri = Bundler::URI 'http://example.com/awesome/web/service'
25
+ # uri = Gem::URI 'http://example.com/awesome/web/service'
26
26
  #
27
27
  # http = Gem::Net::HTTP::Persistent.new
28
28
  #
@@ -39,17 +39,17 @@ autoload :OpenSSL, 'openssl'
39
39
  # post = Gem::Net::HTTP::Post.new post_uri.path
40
40
  # post.set_form_data 'some' => 'cool data'
41
41
  #
42
- # # perform the POST, the Bundler::URI is always required
42
+ # # perform the POST, the Gem::URI is always required
43
43
  # response http.request post_uri, post
44
44
  #
45
45
  # Note that for GET, HEAD and other requests that do not have a body you want
46
- # to use Bundler::URI#request_uri not Bundler::URI#path. The request_uri contains the query
46
+ # to use Gem::URI#request_uri not Gem::URI#path. The request_uri contains the query
47
47
  # params which are sent in the body for other requests.
48
48
  #
49
49
  # == TLS/SSL
50
50
  #
51
51
  # TLS connections are automatically created depending upon the scheme of the
52
- # Bundler::URI. TLS connections are automatically verified against the default
52
+ # Gem::URI. TLS connections are automatically verified against the default
53
53
  # certificate store for your computer. You can override this by changing
54
54
  # verify_mode or by specifying an alternate cert_store.
55
55
  #
@@ -72,7 +72,7 @@ autoload :OpenSSL, 'openssl'
72
72
  # == Proxies
73
73
  #
74
74
  # A proxy can be set through #proxy= or at initialization time by providing a
75
- # second argument to ::new. The proxy may be the Bundler::URI of the proxy server or
75
+ # second argument to ::new. The proxy may be the Gem::URI of the proxy server or
76
76
  # <code>:ENV</code> which will consult environment variables.
77
77
  #
78
78
  # See #proxy= and #proxy_from_env for details.
@@ -197,7 +197,7 @@ class Gem::Net::HTTP::Persistent
197
197
  # NOTE: This may not work on ruby > 1.9.
198
198
 
199
199
  def self.detect_idle_timeout uri, max = 10
200
- uri = Bundler::URI uri unless Bundler::URI::Generic === uri
200
+ uri = Gem::URI uri unless Gem::URI::Generic === uri
201
201
  uri += '/'
202
202
 
203
203
  req = Gem::Net::HTTP::Head.new uri.request_uri
@@ -455,13 +455,13 @@ class Gem::Net::HTTP::Persistent
455
455
  # Set a +name+ for fun. Your library name should be good enough, but this
456
456
  # otherwise has no purpose.
457
457
  #
458
- # +proxy+ may be set to a Bundler::URI::HTTP or :ENV to pick up proxy options from
458
+ # +proxy+ may be set to a Gem::URI::HTTP or :ENV to pick up proxy options from
459
459
  # the environment. See proxy_from_env for details.
460
460
  #
461
- # In order to use a Bundler::URI for the proxy you may need to do some extra work
462
- # beyond Bundler::URI parsing if the proxy requires a password:
461
+ # In order to use a Gem::URI for the proxy you may need to do some extra work
462
+ # beyond Gem::URI parsing if the proxy requires a password:
463
463
  #
464
- # proxy = Bundler::URI 'http://proxy.example'
464
+ # proxy = Gem::URI 'http://proxy.example'
465
465
  # proxy.user = 'AzureDiamond'
466
466
  # proxy.password = 'hunter2'
467
467
  #
@@ -510,7 +510,7 @@ class Gem::Net::HTTP::Persistent
510
510
  @verify_mode = nil
511
511
  @cert_store = nil
512
512
 
513
- @generation = 0 # incremented when proxy Bundler::URI changes
513
+ @generation = 0 # incremented when proxy Gem::URI changes
514
514
 
515
515
  if HAVE_OPENSSL then
516
516
  @verify_mode = OpenSSL::SSL::VERIFY_PEER
@@ -720,12 +720,12 @@ class Gem::Net::HTTP::Persistent
720
720
  alias key= private_key=
721
721
 
722
722
  ##
723
- # Sets the proxy server. The +proxy+ may be the Bundler::URI of the proxy server,
723
+ # Sets the proxy server. The +proxy+ may be the Gem::URI of the proxy server,
724
724
  # the symbol +:ENV+ which will read the proxy from the environment or nil to
725
725
  # disable use of a proxy. See #proxy_from_env for details on setting the
726
726
  # proxy from the environment.
727
727
  #
728
- # If the proxy Bundler::URI is set after requests have been made, the next request
728
+ # If the proxy Gem::URI is set after requests have been made, the next request
729
729
  # will shut-down and re-open all connections.
730
730
  #
731
731
  # The +no_proxy+ query parameter can be used to specify hosts which shouldn't
@@ -736,9 +736,9 @@ class Gem::Net::HTTP::Persistent
736
736
  def proxy= proxy
737
737
  @proxy_uri = case proxy
738
738
  when :ENV then proxy_from_env
739
- when Bundler::URI::HTTP then proxy
739
+ when Gem::URI::HTTP then proxy
740
740
  when nil then # ignore
741
- else raise ArgumentError, 'proxy must be :ENV or a Bundler::URI::HTTP'
741
+ else raise ArgumentError, 'proxy must be :ENV or a Gem::URI::HTTP'
742
742
  end
743
743
 
744
744
  @no_proxy.clear
@@ -763,13 +763,13 @@ class Gem::Net::HTTP::Persistent
763
763
  end
764
764
 
765
765
  ##
766
- # Creates a Bundler::URI for an HTTP proxy server from ENV variables.
766
+ # Creates a Gem::URI for an HTTP proxy server from ENV variables.
767
767
  #
768
768
  # If +HTTP_PROXY+ is set a proxy will be returned.
769
769
  #
770
- # If +HTTP_PROXY_USER+ or +HTTP_PROXY_PASS+ are set the Bundler::URI is given the
770
+ # If +HTTP_PROXY_USER+ or +HTTP_PROXY_PASS+ are set the Gem::URI is given the
771
771
  # indicated user and password unless HTTP_PROXY contains either of these in
772
- # the Bundler::URI.
772
+ # the Gem::URI.
773
773
  #
774
774
  # The +NO_PROXY+ ENV variable can be used to specify hosts which shouldn't
775
775
  # be reached via proxy; if set it should be a comma separated list of
@@ -785,7 +785,7 @@ class Gem::Net::HTTP::Persistent
785
785
 
786
786
  return nil if env_proxy.nil? or env_proxy.empty?
787
787
 
788
- uri = Bundler::URI normalize_uri env_proxy
788
+ uri = Gem::URI normalize_uri env_proxy
789
789
 
790
790
  env_no_proxy = ENV['no_proxy'] || ENV['NO_PROXY']
791
791
 
@@ -863,7 +863,7 @@ class Gem::Net::HTTP::Persistent
863
863
  # +req+ must be a Gem::Net::HTTPGenericRequest subclass (see Gem::Net::HTTP for a list).
864
864
 
865
865
  def request uri, req = nil, &block
866
- uri = Bundler::URI uri
866
+ uri = Gem::URI uri
867
867
  req = request_setup req || uri
868
868
  response = nil
869
869
 
@@ -896,7 +896,7 @@ class Gem::Net::HTTP::Persistent
896
896
  end
897
897
 
898
898
  ##
899
- # Creates a GET request if +req_or_uri+ is a Bundler::URI and adds headers to the
899
+ # Creates a GET request if +req_or_uri+ is a Gem::URI and adds headers to the
900
900
  # request.
901
901
  #
902
902
  # Returns the request.
@@ -1,4 +1,5 @@
1
1
  require_relative 'package'
2
+ require_relative 'rubygems'
2
3
  require_relative 'version_constraint'
3
4
  require_relative 'incompatibility'
4
5
  require_relative 'basic_package_source'
@@ -1,8 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  begin
4
- require "rubygems/net/http"
4
+ require "rubygems/vendored_net_http"
5
5
  rescue LoadError
6
- require "net/http"
7
- Gem::Net = Net
6
+ begin
7
+ require "rubygems/net/http"
8
+ rescue LoadError
9
+ require "net/http"
10
+ Gem::Net = Net
11
+ end
8
12
  end
@@ -1,8 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  begin
4
- require "rubygems/timeout"
4
+ require "rubygems/vendored_timeout"
5
5
  rescue LoadError
6
- require "timeout"
7
- Gem::Timeout = Timeout
6
+ begin
7
+ require "rubygems/timeout"
8
+ rescue LoadError
9
+ require "timeout"
10
+ Gem::Timeout = Timeout
11
+ end
8
12
  end