bundler 2.0.0.pre.1 → 2.1.0.pre.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bundler might be problematic. Click here for more details.

Files changed (230) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +774 -574
  3. data/LICENSE.md +18 -19
  4. data/README.md +9 -8
  5. data/bundler.gemspec +12 -23
  6. data/exe/bundle +19 -3
  7. data/lib/bundler.rb +203 -87
  8. data/lib/bundler/build_metadata.rb +14 -7
  9. data/lib/bundler/capistrano.rb +5 -5
  10. data/lib/bundler/cli.rb +181 -143
  11. data/lib/bundler/cli/add.rb +28 -16
  12. data/lib/bundler/cli/cache.rb +25 -13
  13. data/lib/bundler/cli/common.rb +11 -12
  14. data/lib/bundler/cli/config.rb +161 -86
  15. data/lib/bundler/cli/console.rb +2 -2
  16. data/lib/bundler/cli/doctor.rb +4 -4
  17. data/lib/bundler/cli/exec.rb +4 -16
  18. data/lib/bundler/cli/gem.rb +5 -5
  19. data/lib/bundler/cli/info.rb +17 -5
  20. data/lib/bundler/cli/init.rb +1 -1
  21. data/lib/bundler/cli/install.rb +12 -11
  22. data/lib/bundler/cli/issue.rb +3 -3
  23. data/lib/bundler/cli/open.rb +10 -6
  24. data/lib/bundler/cli/outdated.rb +85 -81
  25. data/lib/bundler/cli/plugin.rb +9 -2
  26. data/lib/bundler/cli/pristine.rb +1 -1
  27. data/lib/bundler/cli/show.rb +1 -1
  28. data/lib/bundler/cli/update.rb +32 -12
  29. data/lib/bundler/compact_index_client.rb +25 -9
  30. data/lib/bundler/compact_index_client/updater.rb +2 -6
  31. data/lib/bundler/current_ruby.rb +9 -7
  32. data/lib/bundler/definition.rb +36 -27
  33. data/lib/bundler/dependency.rb +16 -4
  34. data/lib/bundler/deployment.rb +2 -2
  35. data/lib/bundler/dsl.rb +18 -42
  36. data/lib/bundler/env.rb +8 -13
  37. data/lib/bundler/environment_preserver.rb +0 -1
  38. data/lib/bundler/feature_flag.rb +1 -11
  39. data/lib/bundler/fetcher.rb +14 -11
  40. data/lib/bundler/fetcher/compact_index.rb +26 -12
  41. data/lib/bundler/fetcher/dependency.rb +1 -1
  42. data/lib/bundler/fetcher/downloader.rb +4 -1
  43. data/lib/bundler/fetcher/index.rb +4 -2
  44. data/lib/bundler/friendly_errors.rb +5 -6
  45. data/lib/bundler/gem_helper.rb +38 -25
  46. data/lib/bundler/gem_helpers.rb +2 -4
  47. data/lib/bundler/gem_tasks.rb +1 -1
  48. data/lib/bundler/gem_version_promoter.rb +3 -3
  49. data/lib/bundler/graph.rb +2 -2
  50. data/lib/bundler/injector.rb +10 -8
  51. data/lib/bundler/inline.rb +25 -20
  52. data/lib/bundler/installer.rb +7 -14
  53. data/lib/bundler/installer/gem_installer.rb +5 -1
  54. data/lib/bundler/installer/parallel_installer.rb +4 -8
  55. data/lib/bundler/installer/standalone.rb +1 -2
  56. data/lib/bundler/lazy_specification.rb +2 -2
  57. data/lib/bundler/lockfile_parser.rb +14 -21
  58. data/lib/bundler/match_platform.rb +1 -1
  59. data/lib/bundler/plugin.rb +42 -29
  60. data/lib/bundler/plugin/api.rb +1 -1
  61. data/lib/bundler/plugin/api/source.rb +2 -2
  62. data/lib/bundler/plugin/index.rb +14 -3
  63. data/lib/bundler/plugin/installer.rb +28 -15
  64. data/lib/bundler/psyched_yaml.rb +1 -1
  65. data/lib/bundler/resolver.rb +72 -24
  66. data/lib/bundler/resolver/spec_group.rb +3 -2
  67. data/lib/bundler/retry.rb +2 -2
  68. data/lib/bundler/ruby_version.rb +4 -19
  69. data/lib/bundler/rubygems_ext.rb +11 -67
  70. data/lib/bundler/rubygems_gem_installer.rb +1 -1
  71. data/lib/bundler/rubygems_integration.rb +143 -395
  72. data/lib/bundler/runtime.rb +2 -9
  73. data/lib/bundler/settings.rb +15 -48
  74. data/lib/bundler/setup.rb +7 -13
  75. data/lib/bundler/shared_helpers.rb +57 -73
  76. data/lib/bundler/similarity_detector.rb +2 -2
  77. data/lib/bundler/source.rb +5 -5
  78. data/lib/bundler/source/git.rb +19 -12
  79. data/lib/bundler/source/git/git_proxy.rb +36 -40
  80. data/lib/bundler/source/metadata.rb +9 -5
  81. data/lib/bundler/source/path.rb +13 -8
  82. data/lib/bundler/source/rubygems.rb +11 -5
  83. data/lib/bundler/source/rubygems/remote.rb +1 -2
  84. data/lib/bundler/source_list.rb +9 -12
  85. data/lib/bundler/spec_set.rb +23 -12
  86. data/lib/bundler/stub_specification.rb +18 -30
  87. data/lib/bundler/templates/Executable.bundler +23 -14
  88. data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +3 -3
  89. data/lib/bundler/templates/newgem/Gemfile.tt +8 -2
  90. data/lib/bundler/templates/newgem/README.md.tt +4 -3
  91. data/lib/bundler/templates/newgem/newgem.gemspec.tt +6 -27
  92. data/lib/bundler/templates/newgem/test/test_helper.rb.tt +1 -1
  93. data/lib/bundler/templates/newgem/travis.yml.tt +0 -1
  94. data/lib/bundler/ui.rb +3 -3
  95. data/lib/bundler/ui/rg_proxy.rb +1 -1
  96. data/lib/bundler/ui/shell.rb +4 -8
  97. data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +161 -0
  98. data/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +66 -0
  99. data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +176 -0
  100. data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +3 -0
  101. data/lib/bundler/vendor/fileutils/lib/fileutils.rb +273 -147
  102. data/lib/bundler/vendor/fileutils/lib/fileutils/version.rb +5 -0
  103. data/lib/bundler/vendor/molinillo/lib/molinillo.rb +6 -6
  104. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +2 -2
  105. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +1 -1
  106. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +1 -1
  107. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +1 -1
  108. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -1
  109. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +6 -6
  110. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +1 -1
  111. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +1 -1
  112. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +30 -8
  113. data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +1 -1
  114. data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +4 -4
  115. data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +2 -2
  116. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +248 -279
  117. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb +40 -0
  118. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +53 -0
  119. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +79 -0
  120. data/lib/bundler/vendor/thor/lib/thor.rb +12 -4
  121. data/lib/bundler/vendor/thor/lib/thor/actions.rb +22 -11
  122. data/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +1 -1
  123. data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +1 -1
  124. data/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +7 -17
  125. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +16 -7
  126. data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +19 -8
  127. data/lib/bundler/vendor/thor/lib/thor/base.rb +25 -24
  128. data/lib/bundler/vendor/thor/lib/thor/command.rb +21 -14
  129. data/lib/bundler/vendor/thor/lib/thor/error.rb +78 -0
  130. data/lib/bundler/vendor/thor/lib/thor/group.rb +3 -3
  131. data/lib/bundler/vendor/thor/lib/thor/invocation.rb +1 -0
  132. data/lib/bundler/vendor/thor/lib/thor/line_editor.rb +2 -2
  133. data/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +1 -1
  134. data/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +6 -6
  135. data/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -4
  136. data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +1 -1
  137. data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +8 -6
  138. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +20 -5
  139. data/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +1 -0
  140. data/lib/bundler/vendor/thor/lib/thor/runner.rb +8 -6
  141. data/lib/bundler/vendor/thor/lib/thor/shell.rb +4 -4
  142. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +52 -7
  143. data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +6 -2
  144. data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +1 -1
  145. data/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
  146. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  147. data/lib/bundler/vendored_fileutils.rb +1 -6
  148. data/lib/bundler/vendored_molinillo.rb +1 -1
  149. data/lib/bundler/vendored_persistent.rb +7 -5
  150. data/lib/bundler/vendored_thor.rb +2 -2
  151. data/lib/bundler/version.rb +1 -20
  152. data/lib/bundler/version_ranges.rb +51 -5
  153. data/lib/bundler/vlad.rb +3 -3
  154. data/lib/bundler/worker.rb +1 -3
  155. data/lib/bundler/yaml_serializer.rb +2 -3
  156. data/man/bundle-add.1 +10 -2
  157. data/man/bundle-add.1.txt +11 -5
  158. data/man/bundle-add.ronn +7 -1
  159. data/man/bundle-binstubs.1 +2 -2
  160. data/man/bundle-binstubs.1.txt +2 -2
  161. data/man/bundle-binstubs.ronn +1 -1
  162. data/man/bundle-cache.1 +55 -0
  163. data/man/bundle-cache.1.txt +78 -0
  164. data/man/{bundle-package.ronn → bundle-cache.ronn} +15 -15
  165. data/man/bundle-check.1 +1 -1
  166. data/man/bundle-check.1.txt +6 -6
  167. data/man/bundle-clean.1 +1 -1
  168. data/man/bundle-clean.1.txt +1 -1
  169. data/man/bundle-config.1 +36 -36
  170. data/man/bundle-config.1.txt +66 -67
  171. data/man/bundle-config.ronn +42 -40
  172. data/man/bundle-doctor.1 +1 -1
  173. data/man/bundle-doctor.1.txt +1 -1
  174. data/man/bundle-exec.1 +2 -2
  175. data/man/bundle-exec.1.txt +2 -2
  176. data/man/bundle-exec.ronn +1 -1
  177. data/man/bundle-gem.1 +1 -1
  178. data/man/bundle-gem.1.txt +3 -3
  179. data/man/bundle-info.1 +1 -1
  180. data/man/bundle-info.1.txt +1 -1
  181. data/man/bundle-init.1 +2 -2
  182. data/man/bundle-init.1.txt +2 -2
  183. data/man/bundle-init.ronn +1 -1
  184. data/man/bundle-inject.1 +1 -1
  185. data/man/bundle-inject.1.txt +1 -1
  186. data/man/bundle-install.1 +8 -5
  187. data/man/bundle-install.1.txt +56 -51
  188. data/man/bundle-install.ronn +9 -4
  189. data/man/bundle-list.1 +1 -1
  190. data/man/bundle-list.1.txt +1 -1
  191. data/man/bundle-lock.1 +1 -1
  192. data/man/bundle-lock.1.txt +16 -16
  193. data/man/bundle-open.1 +1 -1
  194. data/man/bundle-open.1.txt +1 -1
  195. data/man/bundle-outdated.1 +1 -1
  196. data/man/bundle-outdated.1.txt +1 -1
  197. data/man/bundle-platform.1 +1 -1
  198. data/man/bundle-platform.1.txt +1 -1
  199. data/man/bundle-pristine.1 +1 -1
  200. data/man/bundle-pristine.1.txt +1 -1
  201. data/man/bundle-remove.1 +1 -1
  202. data/man/bundle-remove.1.txt +1 -1
  203. data/man/bundle-show.1 +1 -1
  204. data/man/bundle-show.1.txt +1 -1
  205. data/man/bundle-update.1 +4 -4
  206. data/man/bundle-update.1.txt +64 -65
  207. data/man/bundle-update.ronn +3 -3
  208. data/man/bundle-viz.1 +1 -1
  209. data/man/bundle-viz.1.txt +1 -1
  210. data/man/bundle.1 +7 -3
  211. data/man/bundle.1.txt +11 -8
  212. data/man/bundle.ronn +5 -2
  213. data/man/gemfile.5 +17 -20
  214. data/man/gemfile.5.ronn +14 -18
  215. data/man/gemfile.5.txt +108 -112
  216. data/man/index.txt +1 -1
  217. metadata +19 -107
  218. data/exe/bundle_ruby +0 -60
  219. data/lib/bundler/cli/package.rb +0 -49
  220. data/lib/bundler/compatibility_guard.rb +0 -14
  221. data/lib/bundler/ssl_certs/.document +0 -1
  222. data/lib/bundler/ssl_certs/certificate_manager.rb +0 -66
  223. data/lib/bundler/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +0 -21
  224. data/lib/bundler/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
  225. data/lib/bundler/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
  226. data/lib/bundler/vendor/net-http-persistent/lib/net/http/faster.rb +0 -27
  227. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/ssl_reuse.rb +0 -129
  228. data/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +0 -129
  229. data/man/bundle-package.1 +0 -55
  230. data/man/bundle-package.1.txt +0 -79
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "bundler/shared_helpers"
4
- Bundler::SharedHelpers.major_deprecation 3, "Bundler no longer integrates with " \
3
+ require_relative "shared_helpers"
4
+ Bundler::SharedHelpers.major_deprecation 2, "Bundler no longer integrates with " \
5
5
  "Capistrano, but Capistrano provides its own integration with " \
6
6
  "Bundler via the capistrano-bundler gem. Use it instead."
7
7
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "bundler/dependency"
4
- require "bundler/ruby_dsl"
3
+ require_relative "dependency"
4
+ require_relative "ruby_dsl"
5
5
 
6
6
  module Bundler
7
7
  class Dsl
@@ -44,8 +44,8 @@ module Bundler
44
44
  @gemfile = expanded_gemfile_path
45
45
  @gemfiles << expanded_gemfile_path
46
46
  contents ||= Bundler.read_file(@gemfile.to_s)
47
- instance_eval(contents.dup.untaint, gemfile.to_s, 1)
48
- rescue Exception => e
47
+ instance_eval(contents.dup.tap{|x| x.untaint if RUBY_VERSION < "2.7" }, gemfile.to_s, 1)
48
+ rescue Exception => e # rubocop:disable Lint/RescueException
49
49
  message = "There was an error " \
50
50
  "#{e.is_a?(GemfileEvalError) ? "evaluating" : "parsing"} " \
51
51
  "`#{File.basename gemfile.to_s}`: #{e.message}"
@@ -128,7 +128,7 @@ module Bundler
128
128
  else
129
129
  Bundler.ui.warn "Your Gemfile lists the gem #{current.name} (#{current.requirement}) more than once.\n" \
130
130
  "You should probably keep only one of them.\n" \
131
- "Remove any duplicate entries and specify the gem only once (per group).\n" \
131
+ "Remove any duplicate entries and specify the gem only once.\n" \
132
132
  "While it's not a problem now, it could cause errors if you change the version of one of them later."
133
133
  end
134
134
 
@@ -194,7 +194,7 @@ module Bundler
194
194
  " end\n\n"
195
195
 
196
196
  raise DeprecatedError, msg if Bundler.feature_flag.disable_multisource?
197
- SharedHelpers.major_deprecation(3, msg.strip)
197
+ SharedHelpers.major_deprecation(2, msg.strip)
198
198
  end
199
199
 
200
200
  source_options = normalize_hash(options).merge(
@@ -290,37 +290,16 @@ module Bundler
290
290
  warn_deprecated_git_source(:github, <<-'RUBY'.strip, 'Change any "reponame" :github sources to "username/reponame".')
291
291
  "https://github.com/#{repo_name}.git"
292
292
  RUBY
293
- # It would be better to use https instead of the git protocol, but this
294
- # can break deployment of existing locked bundles when switching between
295
- # different versions of Bundler. The change will be made in 2.0, which
296
- # does not guarantee compatibility with the 1.x series.
297
- #
298
- # See https://github.com/bundler/bundler/pull/2569 for discussion
299
- #
300
- # This can be overridden by adding this code to your Gemfiles:
301
- #
302
- # git_source(:github) do |repo_name|
303
- # repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
304
- # "https://github.com/#{repo_name}.git"
305
- # end
306
293
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
307
- # TODO: 2.0 upgrade this setting to the default
308
- if Bundler.settings["github.https"]
309
- Bundler::SharedHelpers.major_deprecation 3, "The `github.https` setting will be removed"
310
- "https://github.com/#{repo_name}.git"
311
- else
312
- "git://github.com/#{repo_name}.git"
313
- end
294
+ "https://github.com/#{repo_name}.git"
314
295
  end
315
296
 
316
- # TODO: 2.0 remove this deprecated git source
317
297
  git_source(:gist) do |repo_name|
318
298
  warn_deprecated_git_source(:gist, '"https://gist.github.com/#{repo_name}.git"')
319
299
 
320
300
  "https://gist.github.com/#{repo_name}.git"
321
301
  end
322
302
 
323
- # TODO: 2.0 remove this deprecated git source
324
303
  git_source(:bitbucket) do |repo_name|
325
304
  warn_deprecated_git_source(:bitbucket, <<-'RUBY'.strip)
326
305
  user_name, repo_name = repo_name.split("/")
@@ -363,9 +342,7 @@ repo_name ||= user_name
363
342
  if name =~ /\s/
364
343
  raise GemfileError, %('#{name}' is not a valid gem name because it contains whitespace)
365
344
  end
366
- if name.empty?
367
- raise GemfileError, %(an empty gem name is not valid)
368
- end
345
+ raise GemfileError, %(an empty gem name is not valid) if name.empty?
369
346
 
370
347
  normalize_hash(opts)
371
348
 
@@ -443,10 +420,10 @@ repo_name ||= user_name
443
420
  message = String.new
444
421
  message << "You passed #{invalid_keys.map {|k| ":" + k }.join(", ")} "
445
422
  message << if invalid_keys.size > 1
446
- "as options for #{command}, but they are invalid."
447
- else
448
- "as an option for #{command}, but it is invalid."
449
- end
423
+ "as options for #{command}, but they are invalid."
424
+ else
425
+ "as an option for #{command}, but it is invalid."
426
+ end
450
427
 
451
428
  message << " Valid options are: #{valid_keys.join(", ")}."
452
429
  message << " You may be able to resolve this by upgrading Bundler to the newest version."
@@ -456,7 +433,7 @@ repo_name ||= user_name
456
433
  def normalize_source(source)
457
434
  case source
458
435
  when :gemcutter, :rubygems, :rubyforge
459
- Bundler::SharedHelpers.major_deprecation 3, "The source :#{source} is deprecated because HTTP " \
436
+ Bundler::SharedHelpers.major_deprecation 2, "The source :#{source} is deprecated because HTTP " \
460
437
  "requests are insecure.\nPlease change your source to 'https://" \
461
438
  "rubygems.org' if possible, or 'http://rubygems.org' if not."
462
439
  "http://rubygems.org"
@@ -476,21 +453,20 @@ repo_name ||= user_name
476
453
  "should come from that source"
477
454
  unless Bundler.feature_flag.bundler_2_mode?
478
455
  msg += ". To downgrade this error to a warning, run " \
479
- "`bundle config --delete disable_multisource`"
456
+ "`bundle config unset disable_multisource`"
480
457
  end
481
458
  raise GemfileEvalError, msg
482
459
  else
483
- Bundler::SharedHelpers.major_deprecation 3, "Your Gemfile contains multiple primary sources. " \
460
+ Bundler::SharedHelpers.major_deprecation 2, "Your Gemfile contains multiple primary sources. " \
484
461
  "Using `source` more than once without a block is a security risk, and " \
485
462
  "may result in installing unexpected gems. To resolve this warning, use " \
486
463
  "a block to indicate which gems should come from the secondary source. " \
487
- "To upgrade this warning to an error, run `bundle config " \
464
+ "To upgrade this warning to an error, run `bundle config set " \
488
465
  "disable_multisource true`."
489
466
  end
490
467
  end
491
468
 
492
469
  def warn_deprecated_git_source(name, replacement, additional_message = nil)
493
- # TODO: 2.0 remove deprecation
494
470
  additional_message &&= " #{additional_message}"
495
471
  replacement = if replacement.count("\n").zero?
496
472
  "{|repo_name| #{replacement} }"
@@ -499,7 +475,7 @@ repo_name ||= user_name
499
475
  end
500
476
 
501
477
  Bundler::SharedHelpers.major_deprecation 3, <<-EOS
502
- The :#{name} git source is deprecated, and will be removed in Bundler 2.0.#{additional_message} Add this code to the top of your Gemfile to ensure it continues to work:
478
+ The :#{name} git source is deprecated, and will be removed in the future.#{additional_message} Add this code to the top of your Gemfile to ensure it continues to work:
503
479
 
504
480
  git_source(:#{name}) #{replacement}
505
481
 
@@ -601,7 +577,7 @@ The :#{name} git source is deprecated, and will be removed in Bundler 2.0.#{addi
601
577
  description = self.description
602
578
  if dsl_path && description =~ /((#{Regexp.quote File.expand_path(dsl_path)}|#{Regexp.quote dsl_path.to_s}):\d+)/
603
579
  trace_line = Regexp.last_match[1]
604
- description = description.sub(/#{Regexp.quote trace_line}:\s*/, "").sub("\n", " - ")
580
+ description = description.sub(/\n.*\n(\.\.\.)? *\^~+$/, "").sub(/#{Regexp.quote trace_line}:\s*/, "").sub("\n", " - ")
605
581
  end
606
582
  [trace_line, description]
607
583
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "bundler/rubygems_integration"
4
- require "bundler/source/git/git_proxy"
3
+ require_relative "rubygems_integration"
4
+ require_relative "source/git/git_proxy"
5
5
 
6
6
  module Bundler
7
7
  class Env
@@ -69,15 +69,9 @@ module Bundler
69
69
  end
70
70
 
71
71
  def self.ruby_version
72
- str = String.new("#{RUBY_VERSION}")
73
- if RUBY_VERSION < "1.9"
74
- str << " (#{RUBY_RELEASE_DATE}"
75
- str << " patchlevel #{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL
76
- str << ") [#{RUBY_PLATFORM}]"
77
- else
78
- str << "p#{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL
79
- str << " (#{RUBY_RELEASE_DATE} revision #{RUBY_REVISION}) [#{RUBY_PLATFORM}]"
80
- end
72
+ str = String.new(RUBY_VERSION)
73
+ str << "p#{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL
74
+ str << " (#{RUBY_RELEASE_DATE} revision #{RUBY_REVISION}) [#{RUBY_PLATFORM}]"
81
75
  end
82
76
 
83
77
  def self.git_version
@@ -106,8 +100,9 @@ module Bundler
106
100
  out << [" Full Path", Gem.ruby]
107
101
  out << [" Config Dir", Pathname.new(Gem::ConfigFile::SYSTEM_WIDE_CONFIG_FILE).dirname]
108
102
  out << ["RubyGems", Gem::VERSION]
109
- out << [" Gem Home", ENV.fetch("GEM_HOME") { Gem.dir }]
110
- out << [" Gem Path", ENV.fetch("GEM_PATH") { Gem.path.join(File::PATH_SEPARATOR) }]
103
+ out << [" Gem Home", Gem.dir]
104
+ out << [" Gem Path", Gem.path.join(File::PATH_SEPARATOR)]
105
+ out << [" User Home", Gem.user_home]
111
106
  out << [" User Path", Gem.user_dir]
112
107
  out << [" Bin Dir", Gem.bindir]
113
108
  if defined?(OpenSSL)
@@ -6,7 +6,6 @@ module Bundler
6
6
  BUNDLER_KEYS = %w[
7
7
  BUNDLE_BIN_PATH
8
8
  BUNDLE_GEMFILE
9
- BUNDLER_ORIG_MANPATH
10
9
  BUNDLER_VERSION
11
10
  GEM_HOME
12
11
  GEM_PATH
@@ -19,7 +19,7 @@ module Bundler
19
19
  def self.settings_method(name, key, &default)
20
20
  define_method(name) do
21
21
  value = Bundler.settings[key]
22
- value = instance_eval(&default) if value.nil? && !default.nil?
22
+ value = instance_eval(&default) if value.nil?
23
23
  value
24
24
  end
25
25
  end
@@ -32,23 +32,14 @@ module Bundler
32
32
  settings_flag(:auto_clean_without_path) { bundler_3_mode? }
33
33
  settings_flag(:auto_config_jobs) { bundler_3_mode? }
34
34
  settings_flag(:cache_all) { bundler_3_mode? }
35
- settings_flag(:cache_command_is_package) { bundler_3_mode? }
36
- settings_flag(:console_command) { !bundler_3_mode? }
37
35
  settings_flag(:default_install_uses_path) { bundler_3_mode? }
38
36
  settings_flag(:deployment_means_frozen) { bundler_3_mode? }
39
37
  settings_flag(:disable_multisource) { bundler_3_mode? }
40
- settings_flag(:error_on_stderr) { bundler_2_mode? }
41
38
  settings_flag(:forget_cli_options) { bundler_3_mode? }
42
- settings_flag(:global_path_appends_ruby_scope) { bundler_3_mode? }
43
39
  settings_flag(:global_gem_cache) { bundler_3_mode? }
44
- settings_flag(:init_gems_rb) { bundler_3_mode? }
45
- settings_flag(:list_command) { bundler_3_mode? }
46
- settings_flag(:lockfile_uses_separate_rubygems_sources) { bundler_3_mode? }
47
- settings_flag(:lockfile_upgrade_warning) { bundler_3_mode? }
48
40
  settings_flag(:only_update_to_newer_versions) { bundler_3_mode? }
49
41
  settings_flag(:path_relative_to_cwd) { bundler_3_mode? }
50
42
  settings_flag(:plugins) { @bundler_version >= Gem::Version.new("1.14") }
51
- settings_flag(:prefer_gems_rb) { bundler_3_mode? }
52
43
  settings_flag(:print_only_version_number) { bundler_3_mode? }
53
44
  settings_flag(:setup_makes_kernel_gem_public) { !bundler_3_mode? }
54
45
  settings_flag(:skip_default_git_sources) { bundler_3_mode? }
@@ -57,7 +48,6 @@ module Bundler
57
48
  settings_flag(:unlock_source_unlocks_spec) { !bundler_3_mode? }
58
49
  settings_flag(:update_requires_all_flag) { bundler_3_mode? }
59
50
  settings_flag(:use_gem_version_promoter_for_major_updates) { bundler_3_mode? }
60
- settings_flag(:viz_command) { !bundler_3_mode? }
61
51
 
62
52
  settings_option(:default_cli_command) { bundler_3_mode? ? :cli_help : :install }
63
53
 
@@ -1,20 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "bundler/vendored_persistent"
3
+ require_relative "vendored_persistent"
4
4
  require "cgi"
5
5
  require "securerandom"
6
6
  require "zlib"
7
+ require "rubygems/request"
7
8
 
8
9
  module Bundler
9
10
  # Handles all the fetching with the rubygems server
10
11
  class Fetcher
11
- autoload :CompactIndex, "bundler/fetcher/compact_index"
12
- autoload :Downloader, "bundler/fetcher/downloader"
13
- autoload :Dependency, "bundler/fetcher/dependency"
14
- autoload :Index, "bundler/fetcher/index"
12
+ autoload :CompactIndex, File.expand_path("fetcher/compact_index", __dir__)
13
+ autoload :Downloader, File.expand_path("fetcher/downloader", __dir__)
14
+ autoload :Dependency, File.expand_path("fetcher/dependency", __dir__)
15
+ autoload :Index, File.expand_path("fetcher/index", __dir__)
15
16
 
16
17
  # This error is raised when it looks like the network is down
17
18
  class NetworkDownError < HTTPError; end
19
+ # This error is raised if we should rate limit our requests to the API
20
+ class TooManyRequestsError < HTTPError; end
18
21
  # This error is raised if the API returns a 413 (only printed in verbose)
19
22
  class FallbackError < HTTPError; end
20
23
  # This is the error raised if OpenSSL fails the cert verification
@@ -44,7 +47,7 @@ module Bundler
44
47
  remote_uri = filter_uri(remote_uri)
45
48
  super "Authentication is required for #{remote_uri}.\n" \
46
49
  "Please supply credentials for this source. You can do this by running:\n" \
47
- " bundle config #{remote_uri} username:password"
50
+ " bundle config set #{remote_uri} username:password"
48
51
  end
49
52
  end
50
53
  # This error is raised if HTTP authentication is provided, but incorrect.
@@ -96,7 +99,8 @@ module Bundler
96
99
 
97
100
  uri = URI.parse("#{remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}.rz")
98
101
  if uri.scheme == "file"
99
- Bundler.load_marshal Bundler.rubygems.inflate(Gem.read_binary(uri.path))
102
+ path = Bundler.rubygems.correct_for_windows_path(uri.path)
103
+ Bundler.load_marshal Bundler.rubygems.inflate(Gem.read_binary(path))
100
104
  elsif cached_spec_path = gemspec_cached_path(spec_file_name)
101
105
  Bundler.load_gemspec(cached_spec_path)
102
106
  else
@@ -226,7 +230,7 @@ module Bundler
226
230
  "GO_SERVER_URL" => "go",
227
231
  "SNAP_CI" => "snap",
228
232
  "CI_NAME" => ENV["CI_NAME"],
229
- "CI" => "ci"
233
+ "CI" => "ci",
230
234
  }
231
235
  env_cis.find_all {|env, _| ENV[env] }.map {|_, ci| ci }
232
236
  end
@@ -238,7 +242,7 @@ module Bundler
238
242
  Bundler.settings[:ssl_client_cert]
239
243
  raise SSLError if needs_ssl && !defined?(OpenSSL::SSL)
240
244
 
241
- con = PersistentHTTP.new "bundler", :ENV
245
+ con = PersistentHTTP.new :name => "bundler", :proxy => :ENV
242
246
  if gem_proxy = Bundler.rubygems.configuration[:http_proxy]
243
247
  con.proxy = URI.parse(gem_proxy) if gem_proxy != :no_proxy
244
248
  end
@@ -293,8 +297,7 @@ module Bundler
293
297
  end
294
298
  else
295
299
  store.set_default_paths
296
- certs = File.expand_path("../ssl_certs/*/*.pem", __FILE__)
297
- Dir.glob(certs).each {|c| store.add_file c }
300
+ Gem::Request.get_cert_files.each {|c| store.add_file c }
298
301
  end
299
302
  store
300
303
  end
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "bundler/fetcher/base"
4
- require "bundler/worker"
3
+ require_relative "base"
4
+ require_relative "../worker"
5
5
 
6
6
  module Bundler
7
- autoload :CompactIndexClient, "bundler/compact_index_client"
7
+ autoload :CompactIndexClient, File.expand_path("../compact_index_client", __dir__)
8
8
 
9
9
  class Fetcher
10
10
  class CompactIndex < Base
@@ -39,7 +39,13 @@ module Bundler
39
39
  until remaining_gems.empty?
40
40
  log_specs "Looking up gems #{remaining_gems.inspect}"
41
41
 
42
- deps = compact_index_client.dependencies(remaining_gems)
42
+ deps = begin
43
+ parallel_compact_index_client.dependencies(remaining_gems)
44
+ rescue TooManyRequestsError
45
+ @bundle_worker.stop if @bundle_worker
46
+ @bundle_worker = nil # reset it. Not sure if necessary
47
+ serial_compact_index_client.dependencies(remaining_gems)
48
+ end
43
49
  next_gems = deps.map {|d| d[3].map(&:first).flatten(1) }.flatten(1).uniq
44
50
  deps.each {|dep| gem_info << dep }
45
51
  complete_gems.concat(deps.map(&:first)).uniq!
@@ -80,18 +86,26 @@ module Bundler
80
86
  private
81
87
 
82
88
  def compact_index_client
83
- @compact_index_client ||= begin
89
+ @compact_index_client ||=
84
90
  SharedHelpers.filesystem_access(cache_path) do
85
91
  CompactIndexClient.new(cache_path, client_fetcher)
86
- end.tap do |client|
87
- client.in_parallel = lambda do |inputs, &blk|
88
- func = lambda {|object, _index| blk.call(object) }
89
- worker = bundle_worker(func)
90
- inputs.each {|input| worker.enq(input) }
91
- inputs.map { worker.deq }
92
- end
93
92
  end
93
+ end
94
+
95
+ def parallel_compact_index_client
96
+ compact_index_client.execution_mode = lambda do |inputs, &blk|
97
+ func = lambda {|object, _index| blk.call(object) }
98
+ worker = bundle_worker(func)
99
+ inputs.each {|input| worker.enq(input) }
100
+ inputs.map { worker.deq }
94
101
  end
102
+
103
+ compact_index_client
104
+ end
105
+
106
+ def serial_compact_index_client
107
+ compact_index_client.sequential_execution_mode!
108
+ compact_index_client
95
109
  end
96
110
 
97
111
  def bundle_worker(func = nil)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "bundler/fetcher/base"
3
+ require_relative "base"
4
4
  require "cgi"
5
5
 
6
6
  module Bundler
@@ -34,10 +34,13 @@ module Bundler
34
34
  fetch(uri, new_headers)
35
35
  when Net::HTTPRequestEntityTooLarge
36
36
  raise FallbackError, response.body
37
+ when Net::HTTPTooManyRequests
38
+ raise TooManyRequestsError, response.body
37
39
  when Net::HTTPUnauthorized
40
+ raise BadAuthenticationError, uri.host if uri.userinfo
38
41
  raise AuthenticationRequiredError, uri.host
39
42
  when Net::HTTPNotFound
40
- raise FallbackError, "Net::HTTPNotFound"
43
+ raise FallbackError, "Net::HTTPNotFound: #{URICredentialsFilter.credential_filtered_uri(uri)}"
41
44
  else
42
45
  raise HTTPError, "#{response.class}#{": #{response.body}" unless response.body.empty?}"
43
46
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "bundler/fetcher/base"
3
+ require_relative "base"
4
4
  require "rubygems/remote_fetcher"
5
5
 
6
6
  module Bundler
@@ -13,6 +13,7 @@ module Bundler
13
13
  when /certificate verify failed/
14
14
  raise CertificateFailureError.new(display_uri)
15
15
  when /401/
16
+ raise BadAuthenticationError, remote_uri if remote_uri.userinfo
16
17
  raise AuthenticationRequiredError, remote_uri
17
18
  when /403/
18
19
  raise BadAuthenticationError, remote_uri if remote_uri.userinfo
@@ -29,7 +30,8 @@ module Bundler
29
30
 
30
31
  uri = URI.parse("#{remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}.rz")
31
32
  if uri.scheme == "file"
32
- Bundler.load_marshal Bundler.rubygems.inflate(Gem.read_binary(uri.path))
33
+ path = Bundler.rubygems.correct_for_windows_path(uri.path)
34
+ Bundler.load_marshal Bundler.rubygems.inflate(Gem.read_binary(path))
33
35
  elsif cached_spec_path = gemspec_cached_path(spec_file_name)
34
36
  Bundler.load_gemspec(cached_spec_path)
35
37
  else
@@ -1,8 +1,7 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  require "cgi"
5
- require "bundler/vendored_thor"
4
+ require_relative "vendored_thor"
6
5
 
7
6
  module Bundler
8
7
  module FriendlyErrors
@@ -17,7 +16,7 @@ module Bundler
17
16
  Bundler.ui.error error.message
18
17
  when GemRequireError
19
18
  Bundler.ui.error error.message
20
- Bundler.ui.trace error.orig_exception, nil, true
19
+ Bundler.ui.trace error.orig_exception
21
20
  when BundlerError
22
21
  Bundler.ui.error error.message, :wrap => true
23
22
  Bundler.ui.trace error
@@ -29,7 +28,7 @@ module Bundler
29
28
  Bundler.ui.warn <<-WARN, :wrap => true
30
29
  You must recompile Ruby with OpenSSL support or change the sources in your \
31
30
  Gemfile from 'https' to 'http'. Instructions for compiling with OpenSSL \
32
- using RVM are available at http://rvm.io/packages/openssl.
31
+ using RVM are available at https://rvm.io/packages/openssl.
33
32
  WARN
34
33
  Bundler.ui.trace error
35
34
  when Interrupt
@@ -45,7 +44,7 @@ module Bundler
45
44
  "Alternatively, you can increase the amount of memory the JVM is able to use by running Bundler with jruby -J-Xmx1024m -S bundle (JRuby defaults to 500MB)."
46
45
  else request_issue_report_for(error)
47
46
  end
48
- rescue
47
+ rescue StandardError
49
48
  raise error
50
49
  end
51
50
 
@@ -124,7 +123,7 @@ module Bundler
124
123
  yield
125
124
  rescue SignalException
126
125
  raise
127
- rescue Exception => e
126
+ rescue Exception => e # rubocop:disable Lint/RescueException
128
127
  FriendlyErrors.log_error(e)
129
128
  exit FriendlyErrors.exit_status(e)
130
129
  end