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

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 (217) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +721 -572
  3. data/LICENSE.md +18 -19
  4. data/README.md +9 -8
  5. data/bundler.gemspec +8 -25
  6. data/exe/bundle +19 -3
  7. data/lib/bundler.rb +121 -68
  8. data/lib/bundler/build_metadata.rb +3 -3
  9. data/lib/bundler/capistrano.rb +5 -5
  10. data/lib/bundler/cli.rb +133 -125
  11. data/lib/bundler/cli/add.rb +27 -16
  12. data/lib/bundler/cli/common.rb +11 -12
  13. data/lib/bundler/cli/config.rb +161 -86
  14. data/lib/bundler/cli/console.rb +2 -2
  15. data/lib/bundler/cli/doctor.rb +4 -4
  16. data/lib/bundler/cli/exec.rb +4 -9
  17. data/lib/bundler/cli/gem.rb +5 -5
  18. data/lib/bundler/cli/info.rb +17 -5
  19. data/lib/bundler/cli/init.rb +1 -1
  20. data/lib/bundler/cli/install.rb +12 -11
  21. data/lib/bundler/cli/issue.rb +3 -3
  22. data/lib/bundler/cli/open.rb +10 -6
  23. data/lib/bundler/cli/outdated.rb +85 -81
  24. data/lib/bundler/cli/package.rb +8 -9
  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 +8 -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 -13
  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 +4 -5
  45. data/lib/bundler/gem_helper.rb +39 -24
  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 +19 -18
  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 +13 -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 +2 -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 +10 -66
  70. data/lib/bundler/rubygems_gem_installer.rb +1 -1
  71. data/lib/bundler/rubygems_integration.rb +144 -395
  72. data/lib/bundler/runtime.rb +2 -9
  73. data/lib/bundler/settings.rb +15 -48
  74. data/lib/bundler/setup.rb +6 -5
  75. data/lib/bundler/shared_helpers.rb +58 -71
  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 +35 -39
  80. data/lib/bundler/source/metadata.rb +7 -2
  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 +1 -6
  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 -0
  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 +151 -48
  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 +1 -1
  121. data/lib/bundler/vendor/thor/lib/thor/actions.rb +21 -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 +1 -1
  125. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +11 -2
  126. data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +1 -1
  127. data/lib/bundler/vendor/thor/lib/thor/base.rb +16 -17
  128. data/lib/bundler/vendor/thor/lib/thor/error.rb +82 -0
  129. data/lib/bundler/vendor/thor/lib/thor/group.rb +3 -3
  130. data/lib/bundler/vendor/thor/lib/thor/line_editor.rb +2 -2
  131. data/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -4
  132. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +7 -2
  133. data/lib/bundler/vendor/thor/lib/thor/runner.rb +6 -6
  134. data/lib/bundler/vendor/thor/lib/thor/shell.rb +4 -4
  135. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +52 -7
  136. data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +1 -1
  137. data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +1 -1
  138. data/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
  139. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  140. data/lib/bundler/vendored_fileutils.rb +1 -6
  141. data/lib/bundler/vendored_molinillo.rb +1 -1
  142. data/lib/bundler/vendored_persistent.rb +7 -5
  143. data/lib/bundler/vendored_thor.rb +2 -2
  144. data/lib/bundler/version.rb +1 -20
  145. data/lib/bundler/version_ranges.rb +51 -5
  146. data/lib/bundler/vlad.rb +3 -3
  147. data/lib/bundler/worker.rb +1 -3
  148. data/lib/bundler/yaml_serializer.rb +2 -3
  149. data/man/bundle-add.1 +10 -2
  150. data/man/bundle-add.1.txt +11 -5
  151. data/man/bundle-add.ronn +7 -1
  152. data/man/bundle-binstubs.1 +2 -2
  153. data/man/bundle-binstubs.1.txt +2 -2
  154. data/man/bundle-binstubs.ronn +1 -1
  155. data/man/bundle-check.1 +1 -1
  156. data/man/bundle-check.1.txt +6 -6
  157. data/man/bundle-clean.1 +1 -1
  158. data/man/bundle-clean.1.txt +1 -1
  159. data/man/bundle-config.1 +36 -36
  160. data/man/bundle-config.1.txt +66 -67
  161. data/man/bundle-config.ronn +42 -40
  162. data/man/bundle-doctor.1 +1 -1
  163. data/man/bundle-doctor.1.txt +1 -1
  164. data/man/bundle-exec.1 +1 -1
  165. data/man/bundle-exec.1.txt +1 -1
  166. data/man/bundle-gem.1 +1 -1
  167. data/man/bundle-gem.1.txt +3 -3
  168. data/man/bundle-info.1 +1 -1
  169. data/man/bundle-info.1.txt +1 -1
  170. data/man/bundle-init.1 +2 -2
  171. data/man/bundle-init.1.txt +2 -2
  172. data/man/bundle-init.ronn +1 -1
  173. data/man/bundle-inject.1 +1 -1
  174. data/man/bundle-inject.1.txt +1 -1
  175. data/man/bundle-install.1 +8 -5
  176. data/man/bundle-install.1.txt +56 -51
  177. data/man/bundle-install.ronn +9 -4
  178. data/man/bundle-list.1 +1 -1
  179. data/man/bundle-list.1.txt +1 -1
  180. data/man/bundle-lock.1 +1 -1
  181. data/man/bundle-lock.1.txt +16 -16
  182. data/man/bundle-open.1 +1 -1
  183. data/man/bundle-open.1.txt +1 -1
  184. data/man/bundle-outdated.1 +1 -1
  185. data/man/bundle-outdated.1.txt +1 -1
  186. data/man/bundle-package.1 +1 -1
  187. data/man/bundle-package.1.txt +1 -1
  188. data/man/bundle-platform.1 +1 -1
  189. data/man/bundle-platform.1.txt +1 -1
  190. data/man/bundle-pristine.1 +1 -1
  191. data/man/bundle-pristine.1.txt +1 -1
  192. data/man/bundle-remove.1 +1 -1
  193. data/man/bundle-remove.1.txt +1 -1
  194. data/man/bundle-show.1 +1 -1
  195. data/man/bundle-show.1.txt +1 -1
  196. data/man/bundle-update.1 +4 -4
  197. data/man/bundle-update.1.txt +64 -65
  198. data/man/bundle-update.ronn +3 -3
  199. data/man/bundle-viz.1 +1 -1
  200. data/man/bundle-viz.1.txt +1 -1
  201. data/man/bundle.1 +3 -3
  202. data/man/bundle.1.txt +8 -8
  203. data/man/bundle.ronn +2 -2
  204. data/man/gemfile.5 +13 -16
  205. data/man/gemfile.5.ronn +10 -14
  206. data/man/gemfile.5.txt +104 -108
  207. metadata +16 -102
  208. data/exe/bundle_ruby +0 -60
  209. data/lib/bundler/cli/cache.rb +0 -36
  210. data/lib/bundler/compatibility_guard.rb +0 -14
  211. data/lib/bundler/ssl_certs/.document +0 -1
  212. data/lib/bundler/ssl_certs/certificate_manager.rb +0 -66
  213. data/lib/bundler/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +0 -21
  214. data/lib/bundler/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
  215. data/lib/bundler/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
  216. data/lib/bundler/vendor/net-http-persistent/lib/net/http/faster.rb +0 -27
  217. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/ssl_reuse.rb +0 -129
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "rubygems/dependency"
4
- require "bundler/shared_helpers"
5
- require "bundler/rubygems_ext"
4
+ require_relative "shared_helpers"
5
+ require_relative "rubygems_ext"
6
6
 
7
7
  module Bundler
8
8
  class Dependency < Gem::Dependency
9
9
  attr_reader :autorequire
10
- attr_reader :groups, :platforms, :gemfile
10
+ attr_reader :groups, :platforms, :gemfile, :git, :branch
11
11
 
12
12
  PLATFORM_MAP = {
13
13
  :ruby => Gem::Platform::RUBY,
@@ -19,6 +19,7 @@ module Bundler
19
19
  :ruby_23 => Gem::Platform::RUBY,
20
20
  :ruby_24 => Gem::Platform::RUBY,
21
21
  :ruby_25 => Gem::Platform::RUBY,
22
+ :ruby_26 => Gem::Platform::RUBY,
22
23
  :mri => Gem::Platform::RUBY,
23
24
  :mri_18 => Gem::Platform::RUBY,
24
25
  :mri_19 => Gem::Platform::RUBY,
@@ -28,6 +29,7 @@ module Bundler
28
29
  :mri_23 => Gem::Platform::RUBY,
29
30
  :mri_24 => Gem::Platform::RUBY,
30
31
  :mri_25 => Gem::Platform::RUBY,
32
+ :mri_26 => Gem::Platform::RUBY,
31
33
  :rbx => Gem::Platform::RUBY,
32
34
  :truffleruby => Gem::Platform::RUBY,
33
35
  :jruby => Gem::Platform::JAVA,
@@ -42,6 +44,7 @@ module Bundler
42
44
  :mswin_23 => Gem::Platform::MSWIN,
43
45
  :mswin_24 => Gem::Platform::MSWIN,
44
46
  :mswin_25 => Gem::Platform::MSWIN,
47
+ :mswin_26 => Gem::Platform::MSWIN,
45
48
  :mswin64 => Gem::Platform::MSWIN64,
46
49
  :mswin64_19 => Gem::Platform::MSWIN64,
47
50
  :mswin64_20 => Gem::Platform::MSWIN64,
@@ -50,6 +53,7 @@ module Bundler
50
53
  :mswin64_23 => Gem::Platform::MSWIN64,
51
54
  :mswin64_24 => Gem::Platform::MSWIN64,
52
55
  :mswin64_25 => Gem::Platform::MSWIN64,
56
+ :mswin64_26 => Gem::Platform::MSWIN64,
53
57
  :mingw => Gem::Platform::MINGW,
54
58
  :mingw_18 => Gem::Platform::MINGW,
55
59
  :mingw_19 => Gem::Platform::MINGW,
@@ -59,6 +63,7 @@ module Bundler
59
63
  :mingw_23 => Gem::Platform::MINGW,
60
64
  :mingw_24 => Gem::Platform::MINGW,
61
65
  :mingw_25 => Gem::Platform::MINGW,
66
+ :mingw_26 => Gem::Platform::MINGW,
62
67
  :x64_mingw => Gem::Platform::X64_MINGW,
63
68
  :x64_mingw_20 => Gem::Platform::X64_MINGW,
64
69
  :x64_mingw_21 => Gem::Platform::X64_MINGW,
@@ -66,6 +71,7 @@ module Bundler
66
71
  :x64_mingw_23 => Gem::Platform::X64_MINGW,
67
72
  :x64_mingw_24 => Gem::Platform::X64_MINGW,
68
73
  :x64_mingw_25 => Gem::Platform::X64_MINGW,
74
+ :x64_mingw_26 => Gem::Platform::X64_MINGW,
69
75
  }.freeze
70
76
 
71
77
  REVERSE_PLATFORM_MAP = {}.tap do |reverse_platform_map|
@@ -84,6 +90,8 @@ module Bundler
84
90
  @autorequire = nil
85
91
  @groups = Array(options["group"] || :default).map(&:to_sym)
86
92
  @source = options["source"]
93
+ @git = options["git"]
94
+ @branch = options["branch"]
87
95
  @platforms = Array(options["platforms"])
88
96
  @env = options["env"]
89
97
  @should_include = options.fetch("should_include", true)
@@ -97,11 +105,15 @@ module Bundler
97
105
  def gem_platforms(valid_platforms)
98
106
  return valid_platforms if @platforms.empty?
99
107
 
100
- @gem_platforms ||= @platforms.map {|pl| PLATFORM_MAP[pl] }.compact.uniq
108
+ @gem_platforms ||= expanded_platforms.compact.uniq
101
109
 
102
110
  valid_platforms & @gem_platforms
103
111
  end
104
112
 
113
+ def expanded_platforms
114
+ @platforms.map {|pl| PLATFORM_MAP[pl] }
115
+ end
116
+
105
117
  def should_include?
106
118
  @should_include && current_env? && current_platform?
107
119
  end
@@ -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
@@ -45,7 +45,7 @@ module Bundler
45
45
  @gemfiles << expanded_gemfile_path
46
46
  contents ||= Bundler.read_file(@gemfile.to_s)
47
47
  instance_eval(contents.dup.untaint, gemfile.to_s, 1)
48
- rescue Exception => e
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"
@@ -474,23 +451,22 @@ repo_name ||= user_name
474
451
  msg = "This Gemfile contains multiple primary sources. " \
475
452
  "Each source after the first must include a block to indicate which gems " \
476
453
  "should come from that source"
477
- unless Bundler.feature_flag.bundler_3_mode?
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 3.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 3.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,12 +48,9 @@ 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
 
64
- settings_method(:github_https?, "github.https") { bundler_2_mode? }
65
-
66
54
  def initialize(bundler_version)
67
55
  @bundler_version = Gem::Version.create(bundler_version)
68
56
  end
@@ -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)