bundler 2.1.4 → 2.3.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (277) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +2164 -1430
  3. data/README.md +7 -9
  4. data/bundler.gemspec +5 -6
  5. data/exe/bundle +10 -8
  6. data/exe/bundler +1 -1
  7. data/lib/bundler/.document +1 -0
  8. data/lib/bundler/build_metadata.rb +3 -11
  9. data/lib/bundler/cli/add.rb +1 -1
  10. data/lib/bundler/cli/binstubs.rb +6 -2
  11. data/lib/bundler/cli/cache.rb +3 -8
  12. data/lib/bundler/cli/check.rb +4 -2
  13. data/lib/bundler/cli/clean.rb +1 -1
  14. data/lib/bundler/cli/common.rb +30 -3
  15. data/lib/bundler/cli/config.rb +10 -1
  16. data/lib/bundler/cli/console.rb +1 -1
  17. data/lib/bundler/cli/doctor.rb +25 -6
  18. data/lib/bundler/cli/exec.rb +5 -10
  19. data/lib/bundler/cli/fund.rb +36 -0
  20. data/lib/bundler/cli/gem.rb +219 -28
  21. data/lib/bundler/cli/info.rb +38 -6
  22. data/lib/bundler/cli/init.rb +3 -3
  23. data/lib/bundler/cli/inject.rb +1 -1
  24. data/lib/bundler/cli/install.rb +20 -52
  25. data/lib/bundler/cli/issue.rb +5 -4
  26. data/lib/bundler/cli/list.rb +19 -11
  27. data/lib/bundler/cli/lock.rb +5 -1
  28. data/lib/bundler/cli/open.rb +1 -2
  29. data/lib/bundler/cli/outdated.rb +95 -75
  30. data/lib/bundler/cli/platform.rb +1 -1
  31. data/lib/bundler/cli/plugin.rb +10 -0
  32. data/lib/bundler/cli/pristine.rb +5 -0
  33. data/lib/bundler/cli/remove.rb +1 -2
  34. data/lib/bundler/cli/show.rb +2 -2
  35. data/lib/bundler/cli/update.rb +20 -9
  36. data/lib/bundler/cli.rb +101 -81
  37. data/lib/bundler/compact_index_client/cache.rb +6 -23
  38. data/lib/bundler/compact_index_client/gem_parser.rb +28 -0
  39. data/lib/bundler/compact_index_client/updater.rb +13 -22
  40. data/lib/bundler/compact_index_client.rb +3 -9
  41. data/lib/bundler/current_ruby.rb +6 -4
  42. data/lib/bundler/definition.rb +201 -385
  43. data/lib/bundler/dep_proxy.rb +16 -9
  44. data/lib/bundler/dependency.rb +23 -14
  45. data/lib/bundler/digest.rb +71 -0
  46. data/lib/bundler/dsl.rb +71 -74
  47. data/lib/bundler/endpoint_specification.rb +22 -12
  48. data/lib/bundler/env.rb +2 -2
  49. data/lib/bundler/environment_preserver.rb +29 -2
  50. data/lib/bundler/errors.rb +20 -3
  51. data/lib/bundler/feature_flag.rb +0 -8
  52. data/lib/bundler/fetcher/base.rb +1 -1
  53. data/lib/bundler/fetcher/compact_index.rb +11 -16
  54. data/lib/bundler/fetcher/downloader.rb +10 -7
  55. data/lib/bundler/fetcher/index.rb +2 -30
  56. data/lib/bundler/fetcher.rb +18 -23
  57. data/lib/bundler/friendly_errors.rb +25 -43
  58. data/lib/bundler/gem_helper.rb +53 -31
  59. data/lib/bundler/gem_helpers.rb +36 -25
  60. data/lib/bundler/gem_version_promoter.rb +4 -4
  61. data/lib/bundler/graph.rb +1 -1
  62. data/lib/bundler/index.rb +9 -9
  63. data/lib/bundler/injector.rb +33 -6
  64. data/lib/bundler/inline.rb +3 -2
  65. data/lib/bundler/installer/gem_installer.rb +7 -25
  66. data/lib/bundler/installer/parallel_installer.rb +46 -25
  67. data/lib/bundler/installer/standalone.rb +30 -10
  68. data/lib/bundler/installer.rb +36 -59
  69. data/lib/bundler/lazy_specification.rb +62 -26
  70. data/lib/bundler/lockfile_generator.rb +2 -2
  71. data/lib/bundler/lockfile_parser.rb +17 -46
  72. data/lib/bundler/man/.document +1 -0
  73. data/{man → lib/bundler/man}/bundle-add.1 +10 -2
  74. data/{man/bundle-add.ronn → lib/bundler/man/bundle-add.1.ronn} +7 -1
  75. data/{man → lib/bundler/man}/bundle-binstubs.1 +5 -3
  76. data/{man/bundle-binstubs.ronn → lib/bundler/man/bundle-binstubs.1.ronn} +2 -4
  77. data/{man → lib/bundler/man}/bundle-cache.1 +1 -1
  78. data/{man → lib/bundler/man}/bundle-check.1 +1 -1
  79. data/{man → lib/bundler/man}/bundle-clean.1 +1 -1
  80. data/{man → lib/bundler/man}/bundle-config.1 +44 -45
  81. data/{man/bundle-config.ronn → lib/bundler/man/bundle-config.1.ronn} +59 -60
  82. data/{man → lib/bundler/man}/bundle-doctor.1 +1 -1
  83. data/{man → lib/bundler/man}/bundle-exec.1 +1 -1
  84. data/{man → lib/bundler/man}/bundle-gem.1 +38 -3
  85. data/{man/bundle-gem.ronn → lib/bundler/man/bundle-gem.1.ronn} +46 -7
  86. data/{man → lib/bundler/man}/bundle-info.1 +1 -1
  87. data/{man → lib/bundler/man}/bundle-init.1 +1 -1
  88. data/{man → lib/bundler/man}/bundle-inject.1 +1 -1
  89. data/{man → lib/bundler/man}/bundle-install.1 +31 -4
  90. data/{man/bundle-install.ronn → lib/bundler/man/bundle-install.1.ronn} +27 -5
  91. data/{man → lib/bundler/man}/bundle-list.1 +7 -7
  92. data/{man/bundle-list.ronn → lib/bundler/man/bundle-list.1.ronn} +6 -6
  93. data/{man → lib/bundler/man}/bundle-lock.1 +1 -1
  94. data/{man → lib/bundler/man}/bundle-open.1 +1 -1
  95. data/{man → lib/bundler/man}/bundle-outdated.1 +3 -10
  96. data/{man/bundle-outdated.ronn → lib/bundler/man/bundle-outdated.1.ronn} +1 -10
  97. data/{man → lib/bundler/man}/bundle-platform.1 +1 -1
  98. data/{man → lib/bundler/man}/bundle-pristine.1 +1 -1
  99. data/{man → lib/bundler/man}/bundle-remove.1 +1 -1
  100. data/{man → lib/bundler/man}/bundle-show.1 +1 -1
  101. data/{man → lib/bundler/man}/bundle-update.1 +5 -5
  102. data/{man/bundle-update.ronn → lib/bundler/man/bundle-update.1.ronn} +5 -4
  103. data/{man → lib/bundler/man}/bundle-viz.1 +1 -1
  104. data/{man → lib/bundler/man}/bundle.1 +1 -1
  105. data/{man → lib/bundler/man}/gemfile.5 +31 -5
  106. data/{man → lib/bundler/man}/gemfile.5.ronn +13 -5
  107. data/lib/bundler/mirror.rb +2 -2
  108. data/lib/bundler/plugin/api/source.rb +23 -7
  109. data/lib/bundler/plugin/dsl.rb +1 -1
  110. data/lib/bundler/plugin/index.rb +13 -1
  111. data/lib/bundler/plugin/installer/rubygems.rb +1 -1
  112. data/lib/bundler/plugin/installer.rb +11 -11
  113. data/lib/bundler/plugin/source_list.rb +5 -1
  114. data/lib/bundler/plugin.rb +56 -11
  115. data/lib/bundler/process_lock.rb +1 -1
  116. data/lib/bundler/remote_specification.rb +12 -2
  117. data/lib/bundler/resolver/spec_group.rb +58 -55
  118. data/lib/bundler/resolver.rb +176 -177
  119. data/lib/bundler/retry.rb +2 -2
  120. data/lib/bundler/ruby_version.rb +2 -15
  121. data/lib/bundler/rubygems_ext.rb +137 -28
  122. data/lib/bundler/rubygems_gem_installer.rb +69 -8
  123. data/lib/bundler/rubygems_integration.rb +69 -133
  124. data/lib/bundler/runtime.rb +22 -25
  125. data/lib/bundler/self_manager.rb +168 -0
  126. data/lib/bundler/settings.rb +144 -65
  127. data/lib/bundler/setup.rb +2 -2
  128. data/lib/bundler/shared_helpers.rb +12 -27
  129. data/lib/bundler/similarity_detector.rb +1 -1
  130. data/lib/bundler/source/git/git_proxy.rb +88 -84
  131. data/lib/bundler/source/git.rb +43 -23
  132. data/lib/bundler/source/metadata.rb +3 -7
  133. data/lib/bundler/source/path/installer.rb +10 -10
  134. data/lib/bundler/source/path.rb +10 -4
  135. data/lib/bundler/source/rubygems/remote.rb +1 -1
  136. data/lib/bundler/source/rubygems.rb +126 -116
  137. data/lib/bundler/source/rubygems_aggregate.rb +68 -0
  138. data/lib/bundler/source.rb +22 -1
  139. data/lib/bundler/source_list.rb +101 -63
  140. data/lib/bundler/source_map.rb +71 -0
  141. data/lib/bundler/spec_set.rb +26 -41
  142. data/lib/bundler/stub_specification.rb +25 -7
  143. data/lib/bundler/templates/Executable +2 -4
  144. data/lib/bundler/templates/Executable.bundler +8 -8
  145. data/lib/bundler/templates/Executable.standalone +2 -4
  146. data/lib/bundler/templates/Gemfile +0 -2
  147. data/lib/bundler/templates/gems.rb +0 -3
  148. data/lib/bundler/templates/newgem/CHANGELOG.md.tt +5 -0
  149. data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +57 -47
  150. data/lib/bundler/templates/newgem/Gemfile.tt +12 -1
  151. data/lib/bundler/templates/newgem/README.md.tt +9 -14
  152. data/lib/bundler/templates/newgem/Rakefile.tt +32 -5
  153. data/lib/bundler/templates/newgem/bin/console.tt +1 -0
  154. data/lib/bundler/templates/newgem/circleci/config.yml.tt +13 -0
  155. data/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +2 -0
  156. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +27 -0
  157. data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +9 -0
  158. data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +2 -0
  159. data/lib/bundler/templates/newgem/lib/newgem.rb.tt +4 -2
  160. data/lib/bundler/templates/newgem/newgem.gemspec.tt +27 -17
  161. data/lib/bundler/templates/newgem/rubocop.yml.tt +13 -0
  162. data/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
  163. data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +2 -0
  164. data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -1
  165. data/lib/bundler/templates/newgem/standard.yml.tt +3 -0
  166. data/lib/bundler/templates/newgem/test/{test_helper.rb.tt → minitest/test_helper.rb.tt} +2 -0
  167. data/lib/bundler/templates/newgem/test/{newgem_test.rb.tt → minitest/test_newgem.rb.tt} +3 -1
  168. data/lib/bundler/templates/newgem/test/test-unit/newgem_test.rb.tt +15 -0
  169. data/lib/bundler/templates/newgem/test/test-unit/test_helper.rb.tt +6 -0
  170. data/lib/bundler/ui/shell.rb +6 -6
  171. data/lib/bundler/uri_credentials_filter.rb +3 -1
  172. data/lib/bundler/vendor/.document +1 -0
  173. data/lib/bundler/vendor/connection_pool/LICENSE +20 -0
  174. data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +19 -21
  175. data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
  176. data/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +57 -0
  177. data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +39 -74
  178. data/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
  179. data/lib/bundler/vendor/molinillo/LICENSE +9 -0
  180. data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +7 -0
  181. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +2 -2
  182. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +11 -5
  183. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +37 -5
  184. data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +34 -28
  185. data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
  186. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +12 -1
  187. data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +49 -47
  188. data/lib/bundler/vendor/molinillo/lib/molinillo.rb +0 -1
  189. data/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
  190. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +82 -189
  191. data/lib/bundler/vendor/thor/LICENSE.md +20 -0
  192. data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +2 -1
  193. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +9 -7
  194. data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +1 -2
  195. data/lib/bundler/vendor/thor/lib/thor/actions.rb +7 -3
  196. data/lib/bundler/vendor/thor/lib/thor/base.rb +9 -0
  197. data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +6 -0
  198. data/lib/bundler/vendor/thor/lib/thor/error.rb +10 -5
  199. data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +5 -1
  200. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +28 -9
  201. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +27 -6
  202. data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +5 -1
  203. data/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
  204. data/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
  205. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  206. data/lib/bundler/vendor/thor/lib/thor.rb +5 -13
  207. data/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +154 -0
  208. data/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
  209. data/lib/bundler/vendor/tsort/lib/tsort.rb +452 -0
  210. data/lib/bundler/vendor/uri/LICENSE.txt +22 -0
  211. data/lib/bundler/vendor/uri/lib/uri/common.rb +17 -80
  212. data/lib/bundler/vendor/uri/lib/uri/ftp.rb +0 -1
  213. data/lib/bundler/vendor/uri/lib/uri/generic.rb +5 -6
  214. data/lib/bundler/vendor/uri/lib/uri/http.rb +0 -1
  215. data/lib/bundler/vendor/uri/lib/uri/https.rb +0 -1
  216. data/lib/bundler/vendor/uri/lib/uri/ldap.rb +1 -1
  217. data/lib/bundler/vendor/uri/lib/uri/mailto.rb +0 -1
  218. data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +1 -14
  219. data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +1 -12
  220. data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
  221. data/lib/bundler/vendor/uri/lib/uri/ws.rb +84 -0
  222. data/lib/bundler/vendor/uri/lib/uri/wss.rb +22 -0
  223. data/lib/bundler/vendor/uri/lib/uri.rb +0 -1
  224. data/lib/bundler/vendored_persistent.rb +0 -7
  225. data/lib/bundler/vendored_tmpdir.rb +4 -0
  226. data/lib/bundler/vendored_tsort.rb +4 -0
  227. data/lib/bundler/version.rb +1 -1
  228. data/lib/bundler/worker.rb +20 -5
  229. data/lib/bundler/yaml_serializer.rb +1 -1
  230. data/lib/bundler.rb +64 -43
  231. metadata +94 -91
  232. data/lib/bundler/gemdeps.rb +0 -29
  233. data/lib/bundler/psyched_yaml.rb +0 -37
  234. data/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +0 -66
  235. data/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +0 -26
  236. data/man/bundle-add.1.txt +0 -58
  237. data/man/bundle-binstubs.1.txt +0 -48
  238. data/man/bundle-cache.1.txt +0 -78
  239. data/man/bundle-check.1.txt +0 -33
  240. data/man/bundle-clean.1.txt +0 -26
  241. data/man/bundle-config.1.txt +0 -528
  242. data/man/bundle-doctor.1.txt +0 -44
  243. data/man/bundle-exec.1.txt +0 -178
  244. data/man/bundle-gem.1.txt +0 -91
  245. data/man/bundle-info.1.txt +0 -21
  246. data/man/bundle-init.1.txt +0 -34
  247. data/man/bundle-inject.1.txt +0 -32
  248. data/man/bundle-install.1.txt +0 -401
  249. data/man/bundle-list.1.txt +0 -43
  250. data/man/bundle-lock.1.txt +0 -93
  251. data/man/bundle-open.1.txt +0 -29
  252. data/man/bundle-outdated.1.txt +0 -131
  253. data/man/bundle-platform.1.txt +0 -57
  254. data/man/bundle-pristine.1.txt +0 -44
  255. data/man/bundle-remove.1.txt +0 -34
  256. data/man/bundle-show.1.txt +0 -27
  257. data/man/bundle-update.1.txt +0 -390
  258. data/man/bundle-viz.1.txt +0 -39
  259. data/man/bundle.1.txt +0 -116
  260. data/man/gemfile.5.txt +0 -649
  261. /data/{man/bundle-cache.ronn → lib/bundler/man/bundle-cache.1.ronn} +0 -0
  262. /data/{man/bundle-check.ronn → lib/bundler/man/bundle-check.1.ronn} +0 -0
  263. /data/{man/bundle-clean.ronn → lib/bundler/man/bundle-clean.1.ronn} +0 -0
  264. /data/{man/bundle-doctor.ronn → lib/bundler/man/bundle-doctor.1.ronn} +0 -0
  265. /data/{man/bundle-exec.ronn → lib/bundler/man/bundle-exec.1.ronn} +0 -0
  266. /data/{man/bundle-info.ronn → lib/bundler/man/bundle-info.1.ronn} +0 -0
  267. /data/{man/bundle-init.ronn → lib/bundler/man/bundle-init.1.ronn} +0 -0
  268. /data/{man/bundle-inject.ronn → lib/bundler/man/bundle-inject.1.ronn} +0 -0
  269. /data/{man/bundle-lock.ronn → lib/bundler/man/bundle-lock.1.ronn} +0 -0
  270. /data/{man/bundle-open.ronn → lib/bundler/man/bundle-open.1.ronn} +0 -0
  271. /data/{man/bundle-platform.ronn → lib/bundler/man/bundle-platform.1.ronn} +0 -0
  272. /data/{man/bundle-pristine.ronn → lib/bundler/man/bundle-pristine.1.ronn} +0 -0
  273. /data/{man/bundle-remove.ronn → lib/bundler/man/bundle-remove.1.ronn} +0 -0
  274. /data/{man/bundle-show.ronn → lib/bundler/man/bundle-show.1.ronn} +0 -0
  275. /data/{man/bundle-viz.ronn → lib/bundler/man/bundle-viz.1.ronn} +0 -0
  276. /data/{man/bundle.ronn → lib/bundler/man/bundle.1.ronn} +0 -0
  277. /data/{man → lib/bundler/man}/index.txt +0 -0
data/lib/bundler/cli.rb CHANGED
@@ -14,6 +14,7 @@ module Bundler
14
14
  COMMAND_ALIASES = {
15
15
  "check" => "c",
16
16
  "install" => "i",
17
+ "plugin" => "",
17
18
  "list" => "ls",
18
19
  "exec" => ["e", "ex", "exe"],
19
20
  "cache" => ["package", "pack"],
@@ -57,9 +58,11 @@ module Bundler
57
58
  custom_gemfile = options[:gemfile] || Bundler.settings[:gemfile]
58
59
  if custom_gemfile && !custom_gemfile.empty?
59
60
  Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", File.expand_path(custom_gemfile)
60
- Bundler.reset_paths!
61
+ Bundler.reset_settings_and_root!
61
62
  end
62
63
 
64
+ Bundler.self_manager.restart_with_locked_bundler_if_needed
65
+
63
66
  Bundler.settings.set_command_option_if_given :retry, options[:retry]
64
67
 
65
68
  current_cmd = args.last[:current_command].name
@@ -72,14 +75,6 @@ module Bundler
72
75
  Bundler.ui = UI::Shell.new(options)
73
76
  Bundler.ui.level = "debug" if options["verbose"]
74
77
  unprinted_warnings.each {|w| Bundler.ui.warn(w) }
75
-
76
- if ENV["RUBYGEMS_GEMDEPS"] && !ENV["RUBYGEMS_GEMDEPS"].empty?
77
- Bundler.ui.warn(
78
- "The RUBYGEMS_GEMDEPS environment variable is set. This enables RubyGems' " \
79
- "experimental Gemfile mode, which may conflict with Bundler and cause unexpected errors. " \
80
- "To remove this warning, unset RUBYGEMS_GEMDEPS.", :wrap => true
81
- )
82
- end
83
78
  end
84
79
 
85
80
  check_unknown_options!(:except => [:config, :exec])
@@ -122,16 +117,17 @@ module Bundler
122
117
  else command = "bundle-#{cli}"
123
118
  end
124
119
 
125
- man_path = File.expand_path("../../../man", __FILE__)
126
- man_pages = Hash[Dir.glob(File.join(man_path, "*")).grep(/.*\.\d*\Z/).collect do |f|
120
+ man_path = File.expand_path("man", __dir__)
121
+ man_pages = Hash[Dir.glob(File.join(man_path, "**", "*")).grep(/.*\.\d*\Z/).collect do |f|
127
122
  [File.basename(f, ".*"), f]
128
123
  end]
129
124
 
130
125
  if man_pages.include?(command)
126
+ man_page = man_pages[command]
131
127
  if Bundler.which("man") && man_path !~ %r{^file:/.+!/META-INF/jruby.home/.+}
132
- Kernel.exec "man #{man_pages[command]}"
128
+ Kernel.exec "man #{man_page}"
133
129
  else
134
- puts File.read("#{man_path}/#{File.basename(man_pages[command])}.txt")
130
+ puts File.read("#{man_path}/#{File.basename(man_page)}.ronn")
135
131
  end
136
132
  elsif command_path = Bundler.which("bundler-#{cli}")
137
133
  Kernel.exec(command_path, "--help")
@@ -190,6 +186,7 @@ module Bundler
190
186
  method_option "install", :type => :boolean, :banner =>
191
187
  "Runs 'bundle install' after removing the gems from the Gemfile"
192
188
  def remove(*gems)
189
+ SharedHelpers.major_deprecation(2, "The `--install` flag has been deprecated. `bundle install` is triggered by default.") if ARGV.include?("--install")
193
190
  require_relative "cli/remove"
194
191
  Remove.new(gems, options).run
195
192
  end
@@ -247,10 +244,12 @@ module Bundler
247
244
  def install
248
245
  SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force")
249
246
 
250
- %w[clean deployment frozen no-cache no-prune path shebang system without with].each do |option|
247
+ %w[clean deployment frozen no-prune path shebang system without with].each do |option|
251
248
  remembered_flag_deprecation(option)
252
249
  end
253
250
 
251
+ remembered_negative_flag_deprecation("no-deployment")
252
+
254
253
  require_relative "cli/install"
255
254
  Bundler.settings.temporary(:no_install => false) do
256
255
  Install.new(options.dup).run
@@ -305,45 +304,25 @@ module Bundler
305
304
  end
306
305
  end
307
306
 
308
- unless Bundler.feature_flag.bundler_3_mode?
309
- desc "show GEM [OPTIONS]", "Shows all gems that are part of the bundle, or the path to a given gem"
310
- long_desc <<-D
311
- Show lists the names and versions of all gems that are required by your Gemfile.
312
- Calling show with [GEM] will list the exact location of that gem on your machine.
313
- D
314
- method_option "paths", :type => :boolean,
315
- :banner => "List the paths of all gems that are required by your Gemfile."
316
- method_option "outdated", :type => :boolean,
317
- :banner => "Show verbose output including whether gems are outdated."
318
- def show(gem_name = nil)
319
- if ARGV[0] == "show"
320
- rest = ARGV[1..-1]
321
-
322
- if flag = rest.find{|arg| ["--verbose", "--outdated"].include?(arg) }
323
- Bundler::SharedHelpers.major_deprecation(2, "the `#{flag}` flag to `bundle show` was undocumented and will be removed without replacement")
324
- else
325
- new_command = rest.find {|arg| !arg.start_with?("--") } ? "info" : "list"
326
-
327
- new_arguments = rest.map do |arg|
328
- next arg if arg != "--paths"
329
- next "--path" if new_command == "info"
330
- end
331
-
332
- old_argv = ARGV.join(" ")
333
- new_argv = [new_command, *new_arguments.compact].join(" ")
334
-
335
- Bundler::SharedHelpers.major_deprecation(2, "use `bundle #{new_argv}` instead of `bundle #{old_argv}`")
336
- end
337
- end
338
- require_relative "cli/show"
339
- Show.new(options, gem_name).run
340
- end
307
+ desc "show GEM [OPTIONS]", "Shows all gems that are part of the bundle, or the path to a given gem"
308
+ long_desc <<-D
309
+ Show lists the names and versions of all gems that are required by your Gemfile.
310
+ Calling show with [GEM] will list the exact location of that gem on your machine.
311
+ D
312
+ method_option "paths", :type => :boolean,
313
+ :banner => "List the paths of all gems that are required by your Gemfile."
314
+ method_option "outdated", :type => :boolean,
315
+ :banner => "Show verbose output including whether gems are outdated."
316
+ def show(gem_name = nil)
317
+ SharedHelpers.major_deprecation(2, "the `--outdated` flag to `bundle show` was undocumented and will be removed without replacement") if ARGV.include?("--outdated")
318
+ require_relative "cli/show"
319
+ Show.new(options, gem_name).run
341
320
  end
342
321
 
343
322
  desc "list", "List all gems in the bundle"
344
323
  method_option "name-only", :type => :boolean, :banner => "print only the gem names"
345
- method_option "only-group", :type => :string, :banner => "print gems from a particular group"
346
- method_option "without-group", :type => :string, :banner => "print all gems except from a group"
324
+ method_option "only-group", :type => :array, :default => [], :banner => "print gems from a given set of groups"
325
+ method_option "without-group", :type => :array, :default => [], :banner => "print all gems except from a given set of groups"
347
326
  method_option "paths", :type => :boolean, :banner => "print the path to each gem in the bundle"
348
327
  def list
349
328
  require_relative "cli/list"
@@ -354,6 +333,7 @@ module Bundler
354
333
 
355
334
  desc "info GEM [OPTIONS]", "Show information for the given gem"
356
335
  method_option "path", :type => :boolean, :banner => "Print full path to gem"
336
+ method_option "version", :type => :boolean, :banner => "Print gem version"
357
337
  def info(gem_name)
358
338
  require_relative "cli/info"
359
339
  Info.new(options, gem_name).run
@@ -375,6 +355,8 @@ module Bundler
375
355
  "Make binstubs that can work without the Bundler runtime"
376
356
  method_option "all", :type => :boolean, :banner =>
377
357
  "Install binstubs for all gems"
358
+ method_option "all-platforms", :type => :boolean, :default => false, :banner =>
359
+ "Install binstubs for all platforms"
378
360
  def binstubs(*gems)
379
361
  require_relative "cli/binstubs"
380
362
  Binstubs.new(options, gems).run
@@ -387,8 +369,11 @@ module Bundler
387
369
  method_option "version", :aliases => "-v", :type => :string
388
370
  method_option "group", :aliases => "-g", :type => :string
389
371
  method_option "source", :aliases => "-s", :type => :string
372
+ method_option "require", :aliases => "-r", :type => :string, :banner => "Adds require path to gem. Provide false, or a path as a string."
390
373
  method_option "git", :type => :string
374
+ method_option "github", :type => :string
391
375
  method_option "branch", :type => :string
376
+ method_option "ref", :type => :string
392
377
  method_option "skip-install", :type => :boolean, :banner =>
393
378
  "Adds gem to the Gemfile but does not install it"
394
379
  method_option "optimistic", :type => :boolean, :banner => "Adds optimistic declaration of version to gem"
@@ -406,7 +391,7 @@ module Bundler
406
391
  are up to date, Bundler will exit with a status of 0. Otherwise, it will exit 1.
407
392
 
408
393
  For more information on patch level options (--major, --minor, --patch,
409
- --update-strict) see documentation on the same options on the update command.
394
+ --strict) see documentation on the same options on the update command.
410
395
  D
411
396
  method_option "group", :type => :string, :banner => "List gems from a specific group"
412
397
  method_option "groups", :type => :boolean, :banner => "List gems organized by groups"
@@ -414,10 +399,9 @@ module Bundler
414
399
  "Do not attempt to fetch gems remotely and use the gem cache instead"
415
400
  method_option "pre", :type => :boolean, :banner => "Check for newer pre-release gems"
416
401
  method_option "source", :type => :array, :banner => "Check against a specific source"
417
- strict_is_update = Bundler.feature_flag.forget_cli_options?
418
- method_option "filter-strict", :type => :boolean, :aliases => strict_is_update ? [] : %w[--strict], :banner =>
402
+ method_option "filter-strict", :type => :boolean, :banner =>
419
403
  "Only list newer versions allowed by your Gemfile requirements"
420
- method_option "update-strict", :type => :boolean, :aliases => strict_is_update ? %w[--strict] : [], :banner =>
404
+ method_option "strict", :type => :boolean, :aliases => "--update-strict", :banner =>
421
405
  "Strict conservative resolution, do not allow any gem to be updated past latest --patch | --minor | --major"
422
406
  method_option "minor", :type => :boolean, :banner => "Prefer updating only to next minor version"
423
407
  method_option "major", :type => :boolean, :banner => "Prefer updating to next major version (default)"
@@ -434,11 +418,18 @@ module Bundler
434
418
  Outdated.new(options, gems).run
435
419
  end
436
420
 
437
- desc "cache [OPTIONS]", "Locks and then caches all of the gems into vendor/cache"
438
- unless Bundler.feature_flag.cache_all?
439
- method_option "all", :type => :boolean,
440
- :banner => "Include all sources (including path and git)."
421
+ desc "fund [OPTIONS]", "Lists information about gems seeking funding assistance"
422
+ method_option "group", :aliases => "-g", :type => :array, :banner =>
423
+ "Fetch funding information for a specific group"
424
+ def fund
425
+ require_relative "cli/fund"
426
+ Fund.new(options).run
441
427
  end
428
+
429
+ desc "cache [OPTIONS]", "Locks and then caches all of the gems into vendor/cache"
430
+ method_option "all", :type => :boolean,
431
+ :default => Bundler.feature_flag.cache_all?,
432
+ :banner => "Include all sources (including path and git)."
442
433
  method_option "all-platforms", :type => :boolean, :banner => "Include gems for all platforms present in the lockfile, not only the current one"
443
434
  method_option "cache-path", :type => :string, :banner =>
444
435
  "Specify a different cache path than the default (vendor/cache)."
@@ -457,6 +448,18 @@ module Bundler
457
448
  bundle without having to download any additional gems.
458
449
  D
459
450
  def cache
451
+ SharedHelpers.major_deprecation 2,
452
+ "The `--all` flag is deprecated because it relies on being " \
453
+ "remembered across bundler invocations, which bundler will no longer " \
454
+ "do in future versions. Instead please use `bundle config set cache_all true`, " \
455
+ "and stop using this flag" if ARGV.include?("--all")
456
+
457
+ SharedHelpers.major_deprecation 2,
458
+ "The `--path` flag is deprecated because its semantics are unclear. " \
459
+ "Use `bundle config cache_path` to configure the path of your cache of gems, " \
460
+ "and `bundle config path` to configure the path where your gems are installed, " \
461
+ "and stop using this flag" if ARGV.include?("--path")
462
+
460
463
  require_relative "cli/cache"
461
464
  Cache.new(options).run
462
465
  end
@@ -464,7 +467,7 @@ module Bundler
464
467
  map aliases_for("cache")
465
468
 
466
469
  desc "exec [OPTIONS]", "Run the command in context of the bundle"
467
- method_option :keep_file_descriptors, :type => :boolean, :default => false
470
+ method_option :keep_file_descriptors, :type => :boolean, :default => true
468
471
  method_option :gemfile, :type => :string, :required => false
469
472
  long_desc <<-D
470
473
  Exec runs a command, providing it access to the gems in the bundle. While using
@@ -472,6 +475,10 @@ module Bundler
472
475
  into the system wide RubyGems repository.
473
476
  D
474
477
  def exec(*args)
478
+ if ARGV.include?("--no-keep-file-descriptors")
479
+ SharedHelpers.major_deprecation(2, "The `--no-keep-file-descriptors` has been deprecated. `bundle exec` no longer mess with your file descriptors. Close them in the exec'd script if you need to")
480
+ end
481
+
475
482
  require_relative "cli/exec"
476
483
  Exec.new(options, args).run
477
484
  end
@@ -486,8 +493,8 @@ module Bundler
486
493
  By default, setting a configuration value sets it for all projects
487
494
  on the machine.
488
495
 
489
- If a global setting is superceded by local configuration, this command
490
- will show the current value, as well as any superceded values and
496
+ If a global setting is superseded by local configuration, this command
497
+ will show the current value, as well as any superseded values and
491
498
  where they were specified.
492
499
  D
493
500
  require_relative "cli/config"
@@ -550,7 +557,7 @@ module Bundler
550
557
  method_option :version, :type => :boolean, :default => false, :aliases => "-v", :desc => "Set to show each gem version."
551
558
  method_option :without, :type => :array, :default => [], :aliases => "-W", :banner => "GROUP[ GROUP...]", :desc => "Exclude gems that are part of the specified named group."
552
559
  def viz
553
- SharedHelpers.major_deprecation 2, "The `viz` command has been moved to the `bundle-viz` gem, see https://github.com/bundler/bundler-viz"
560
+ SharedHelpers.major_deprecation 2, "The `viz` command has been renamed to `graph` and moved to a plugin. See https://github.com/rubygems/bundler-graph"
554
561
  require_relative "cli/viz"
555
562
  Viz.new(options.dup).run
556
563
  end
@@ -560,15 +567,23 @@ module Bundler
560
567
 
561
568
  desc "gem NAME [OPTIONS]", "Creates a skeleton for creating a rubygem"
562
569
  method_option :exe, :type => :boolean, :default => false, :aliases => ["--bin", "-b"], :desc => "Generate a binary executable for your library."
563
- method_option :coc, :type => :boolean, :desc => "Generate a code of conduct file. Set a default with `bundle config set gem.coc true`."
570
+ method_option :coc, :type => :boolean, :desc => "Generate a code of conduct file. Set a default with `bundle config set --global gem.coc true`."
564
571
  method_option :edit, :type => :string, :aliases => "-e", :required => false, :banner => "EDITOR",
565
572
  :lazy_default => [ENV["BUNDLER_EDITOR"], ENV["VISUAL"], ENV["EDITOR"]].find {|e| !e.nil? && !e.empty? },
566
573
  :desc => "Open generated gemspec in the specified editor (defaults to $EDITOR or $BUNDLER_EDITOR)"
567
574
  method_option :ext, :type => :boolean, :default => false, :desc => "Generate the boilerplate for C extension code"
568
575
  method_option :git, :type => :boolean, :default => true, :desc => "Initialize a git repo inside your library."
569
- method_option :mit, :type => :boolean, :desc => "Generate an MIT license file. Set a default with `bundle config set gem.mit true`."
570
- method_option :test, :type => :string, :lazy_default => "rspec", :aliases => "-t", :banner => "rspec",
571
- :desc => "Generate a test directory for your library, either rspec or minitest. Set a default with `bundle config set gem.test rspec`."
576
+ method_option :mit, :type => :boolean, :desc => "Generate an MIT license file. Set a default with `bundle config set --global gem.mit true`."
577
+ method_option :rubocop, :type => :boolean, :desc => "Add rubocop to the generated Rakefile and gemspec. Set a default with `bundle config set --global gem.rubocop true`."
578
+ method_option :changelog, :type => :boolean, :desc => "Generate changelog file. Set a default with `bundle config set --global gem.changelog true`."
579
+ method_option :test, :type => :string, :lazy_default => Bundler.settings["gem.test"] || "", :aliases => "-t", :banner => "Use the specified test framework for your library",
580
+ :desc => "Generate a test directory for your library, either rspec, minitest or test-unit. Set a default with `bundle config set --global gem.test (rspec|minitest|test-unit)`."
581
+ method_option :ci, :type => :string, :lazy_default => Bundler.settings["gem.ci"] || "",
582
+ :desc => "Generate CI configuration, either GitHub Actions, Travis CI, GitLab CI or CircleCI. Set a default with `bundle config set --global gem.ci (github|travis|gitlab|circle)`"
583
+ method_option :linter, :type => :string, :lazy_default => Bundler.settings["gem.linter"] || "",
584
+ :desc => "Add a linter and code formatter, either RuboCop or Standard. Set a default with `bundle config set --global gem.linter (rubocop|standard)`"
585
+ method_option :github_username, :type => :string, :default => Bundler.settings["gem.github_username"], :banner => "Set your username on GitHub", :desc => "Fill in GitHub username on README so that you don't have to do it manually. Set a default with `bundle config set --global gem.github_username <your_username>`."
586
+
572
587
  def gem(name)
573
588
  end
574
589
 
@@ -595,7 +610,7 @@ module Bundler
595
610
  private :gem
596
611
 
597
612
  def self.source_root
598
- File.expand_path(File.join(File.dirname(__FILE__), "templates"))
613
+ File.expand_path("templates", __dir__)
599
614
  end
600
615
 
601
616
  desc "clean [OPTIONS]", "Cleans up unused gems in your bundler directory", :hide => true
@@ -731,11 +746,11 @@ module Bundler
731
746
  end
732
747
  end
733
748
 
734
- private
749
+ private
735
750
 
736
751
  # Automatically invoke `bundle install` and resume if
737
752
  # Bundler.settings[:auto_install] exists. This is set through config cmd
738
- # `bundle config set auto_install 1`.
753
+ # `bundle config set --global auto_install 1`.
739
754
  #
740
755
  # Note that this method `nil`s out the global Definition object, so it
741
756
  # should be called first, before you instantiate anything like an
@@ -793,35 +808,40 @@ module Bundler
793
808
 
794
809
  current = Gem::Version.new(VERSION)
795
810
  return if current >= latest
796
- latest_installed = Bundler.rubygems.find_name("bundler").map(&:version).max
797
-
798
- installation = "To install the latest version, run `gem install bundler#{" --pre" if latest.prerelease?}`"
799
- if latest_installed && latest_installed > current
800
- suggestion = "To update to the most recent installed version (#{latest_installed}), run `bundle update --bundler`"
801
- suggestion = "#{installation}\n#{suggestion}" if latest_installed < latest
802
- else
803
- suggestion = installation
804
- end
805
811
 
806
- Bundler.ui.warn "The latest bundler is #{latest}, but you are currently running #{current}.\n#{suggestion}"
812
+ Bundler.ui.warn \
813
+ "The latest bundler is #{latest}, but you are currently running #{current}.\n" \
814
+ "To update to the most recent version, run `bundle update --bundler`"
807
815
  rescue RuntimeError
808
816
  nil
809
817
  end
810
818
 
819
+ def remembered_negative_flag_deprecation(name)
820
+ positive_name = name.gsub(/\Ano-/, "")
821
+ option = current_command.options[positive_name]
822
+ flag_name = "--no-" + option.switch_name.gsub(/\A--/, "")
823
+
824
+ flag_deprecation(positive_name, flag_name, option)
825
+ end
826
+
811
827
  def remembered_flag_deprecation(name)
812
828
  option = current_command.options[name]
813
829
  flag_name = option.switch_name
814
830
 
815
- name_index = ARGV.find {|arg| flag_name == arg }
831
+ flag_deprecation(name, flag_name, option)
832
+ end
833
+
834
+ def flag_deprecation(name, flag_name, option)
835
+ name_index = ARGV.find {|arg| flag_name == arg.split("=")[0] }
816
836
  return unless name_index
817
837
 
818
838
  value = options[name]
819
839
  value = value.join(" ").to_s if option.type == :array
820
840
 
821
- Bundler::SharedHelpers.major_deprecation 2,\
841
+ Bundler::SharedHelpers.major_deprecation 2,
822
842
  "The `#{flag_name}` flag is deprecated because it relies on being " \
823
843
  "remembered across bundler invocations, which bundler will no longer " \
824
- "do in future versions. Instead please use `bundle config set #{name} " \
844
+ "do in future versions. Instead please use `bundle config set --local #{name.tr("-", "_")} " \
825
845
  "'#{value}'`, and stop using this flag"
826
846
  end
827
847
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "gem_parser"
4
+
3
5
  module Bundler
4
6
  class CompactIndexClient
5
7
  class Cache
@@ -74,16 +76,7 @@ module Bundler
74
76
  end
75
77
  end
76
78
 
77
- def specific_dependency(name, version, platform)
78
- pattern = [version, platform].compact.join("-")
79
- return nil if pattern.empty?
80
-
81
- gem_lines = info_path(name).read
82
- gem_line = gem_lines[/^#{Regexp.escape(pattern)}\b.*/, 0]
83
- gem_line ? parse_gem(gem_line) : nil
84
- end
85
-
86
- private
79
+ private
87
80
 
88
81
  def lines(path)
89
82
  return [] unless path.file?
@@ -92,19 +85,9 @@ module Bundler
92
85
  header ? lines[header + 1..-1] : lines
93
86
  end
94
87
 
95
- def parse_gem(string)
96
- version_and_platform, rest = string.split(" ", 2)
97
- version, platform = version_and_platform.split("-", 2)
98
- dependencies, requirements = rest.split("|", 2).map {|s| s.split(",") } if rest
99
- dependencies = dependencies ? dependencies.map {|d| parse_dependency(d) } : []
100
- requirements = requirements ? requirements.map {|r| parse_dependency(r) } : []
101
- [version, platform, dependencies, requirements]
102
- end
103
-
104
- def parse_dependency(string)
105
- dependency = string.split(":")
106
- dependency[-1] = dependency[-1].split("&") if dependency.size > 1
107
- dependency
88
+ def parse_gem(line)
89
+ @dependency_parser ||= GemParser.new
90
+ @dependency_parser.parse(line)
108
91
  end
109
92
 
110
93
  def info_roots
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bundler
4
+ class CompactIndexClient
5
+ if defined?(Gem::Resolver::APISet::GemParser)
6
+ GemParser = Gem::Resolver::APISet::GemParser
7
+ else
8
+ class GemParser
9
+ def parse(line)
10
+ version_and_platform, rest = line.split(" ", 2)
11
+ version, platform = version_and_platform.split("-", 2)
12
+ dependencies, requirements = rest.split("|", 2).map {|s| s.split(",") } if rest
13
+ dependencies = dependencies ? dependencies.map {|d| parse_dependency(d) } : []
14
+ requirements = requirements ? requirements.map {|d| parse_dependency(d) } : []
15
+ [version, platform, dependencies, requirements]
16
+ end
17
+
18
+ private
19
+
20
+ def parse_dependency(string)
21
+ dependency = string.split(":")
22
+ dependency[-1] = dependency[-1].split("&") if dependency.size > 1
23
+ dependency
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -1,8 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "../vendored_fileutils"
4
- require "stringio"
5
- require "zlib"
6
4
 
7
5
  module Bundler
8
6
  class CompactIndexClient
@@ -22,13 +20,13 @@ module Bundler
22
20
 
23
21
  def initialize(fetcher)
24
22
  @fetcher = fetcher
25
- require "tmpdir"
23
+ require_relative "../vendored_tmpdir"
26
24
  end
27
25
 
28
26
  def update(local_path, remote_path, retrying = nil)
29
27
  headers = {}
30
28
 
31
- Dir.mktmpdir("bundler-compact-index-") do |local_temp_dir|
29
+ Bundler::Dir.mktmpdir("bundler-compact-index-") do |local_temp_dir|
32
30
  local_temp_path = Pathname.new(local_temp_dir).join(local_path.basename)
33
31
 
34
32
  # first try to fetch any new bytes on the existing file
@@ -45,29 +43,27 @@ module Bundler
45
43
  else
46
44
  "bytes=#{local_temp_path.size}-"
47
45
  end
48
- else
49
- # Fastly ignores Range when Accept-Encoding: gzip is set
50
- headers["Accept-Encoding"] = "gzip"
51
46
  end
52
47
 
53
48
  response = @fetcher.call(remote_path, headers)
54
49
  return nil if response.is_a?(Net::HTTPNotModified)
55
50
 
56
51
  content = response.body
57
- if response["Content-Encoding"] == "gzip"
58
- content = Zlib::GzipReader.new(StringIO.new(content)).read
59
- end
60
52
 
61
- SharedHelpers.filesystem_access(local_temp_path) do
53
+ etag = (response["ETag"] || "").gsub(%r{\AW/}, "")
54
+ correct_response = SharedHelpers.filesystem_access(local_temp_path) do
62
55
  if response.is_a?(Net::HTTPPartialContent) && local_temp_path.size.nonzero?
63
56
  local_temp_path.open("a") {|f| f << slice_body(content, 1..-1) }
57
+
58
+ etag_for(local_temp_path) == etag
64
59
  else
65
- local_temp_path.open("w") {|f| f << content }
60
+ local_temp_path.open("wb") {|f| f << content }
61
+
62
+ etag.length.zero? || etag_for(local_temp_path) == etag
66
63
  end
67
64
  end
68
65
 
69
- response_etag = (response["ETag"] || "").gsub(%r{\AW/}, "")
70
- if etag_for(local_temp_path) == response_etag
66
+ if correct_response
71
67
  SharedHelpers.filesystem_access(local_path) do
72
68
  FileUtils.mv(local_temp_path, local_path)
73
69
  end
@@ -75,16 +71,11 @@ module Bundler
75
71
  end
76
72
 
77
73
  if retrying
78
- raise MisMatchedChecksumError.new(remote_path, response_etag, etag_for(local_temp_path))
74
+ raise MisMatchedChecksumError.new(remote_path, etag, etag_for(local_temp_path))
79
75
  end
80
76
 
81
77
  update(local_path, remote_path, :retrying)
82
78
  end
83
- rescue Errno::EACCES
84
- raise Bundler::PermissionError,
85
- "Bundler does not have write access to create a temp directory " \
86
- "within #{Dir.tmpdir}. Bundler must have write access to your " \
87
- "systems temp directory to function properly. "
88
79
  rescue Zlib::GzipFile::Error
89
80
  raise Bundler::HTTPError
90
81
  end
@@ -100,11 +91,11 @@ module Bundler
100
91
 
101
92
  def checksum_for_file(path)
102
93
  return nil unless path.file?
103
- # This must use IO.read instead of Digest.file().hexdigest
94
+ # This must use File.read instead of Digest.file().hexdigest
104
95
  # because we need to preserve \n line endings on windows when calculating
105
96
  # the checksum
106
97
  SharedHelpers.filesystem_access(path, :read) do
107
- SharedHelpers.digest(:MD5).hexdigest(IO.read(path))
98
+ SharedHelpers.digest(:MD5).hexdigest(File.read(path))
108
99
  end
109
100
  end
110
101
  end
@@ -5,7 +5,7 @@ require "set"
5
5
 
6
6
  module Bundler
7
7
  class CompactIndexClient
8
- DEBUG_MUTEX = Mutex.new
8
+ DEBUG_MUTEX = Thread::Mutex.new
9
9
  def self.debug
10
10
  return unless ENV["DEBUG_COMPACT_INDEX"]
11
11
  DEBUG_MUTEX.synchronize { warn("[#{self}] #{yield}") }
@@ -25,7 +25,7 @@ module Bundler
25
25
  @endpoints = Set.new
26
26
  @info_checksums_by_name = {}
27
27
  @parsed_checksums = false
28
- @mutex = Mutex.new
28
+ @mutex = Thread::Mutex.new
29
29
  end
30
30
 
31
31
  def execution_mode=(block)
@@ -73,12 +73,6 @@ module Bundler
73
73
  end.flatten(1)
74
74
  end
75
75
 
76
- def spec(name, version, platform = nil)
77
- Bundler::CompactIndexClient.debug { "spec(name = #{name}, version = #{version}, platform = #{platform})" }
78
- update_info(name)
79
- @cache.specific_dependency(name, version, platform)
80
- end
81
-
82
76
  def update_and_parse_checksums!
83
77
  Bundler::CompactIndexClient.debug { "update_and_parse_checksums!" }
84
78
  return @info_checksums_by_name if @parsed_checksums
@@ -87,7 +81,7 @@ module Bundler
87
81
  @parsed_checksums = true
88
82
  end
89
83
 
90
- private
84
+ private
91
85
 
92
86
  def update(local_path, remote_path)
93
87
  Bundler::CompactIndexClient.debug { "update(#{local_path}, #{remote_path})" }
@@ -20,6 +20,8 @@ module Bundler
20
20
  2.5
21
21
  2.6
22
22
  2.7
23
+ 3.0
24
+ 3.1
23
25
  ].freeze
24
26
 
25
27
  KNOWN_MAJOR_VERSIONS = KNOWN_MINOR_VERSIONS.map {|v| v.split(".", 2).first }.uniq.freeze
@@ -64,19 +66,19 @@ module Bundler
64
66
  end
65
67
 
66
68
  def mswin?
67
- Bundler::WINDOWS
69
+ Gem.win_platform?
68
70
  end
69
71
 
70
72
  def mswin64?
71
- Bundler::WINDOWS && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mswin64" && Bundler.local_platform.cpu == "x64"
73
+ Gem.win_platform? && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mswin64" && Bundler.local_platform.cpu == "x64"
72
74
  end
73
75
 
74
76
  def mingw?
75
- Bundler::WINDOWS && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mingw32" && Bundler.local_platform.cpu != "x64"
77
+ Gem.win_platform? && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mingw32" && Bundler.local_platform.cpu != "x64"
76
78
  end
77
79
 
78
80
  def x64_mingw?
79
- Bundler::WINDOWS && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mingw32" && Bundler.local_platform.cpu == "x64"
81
+ Gem.win_platform? && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mingw32" && Bundler.local_platform.cpu == "x64"
80
82
  end
81
83
 
82
84
  (KNOWN_MINOR_VERSIONS + KNOWN_MAJOR_VERSIONS).each do |version|