bundler 1.15.1 → 1.17.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 (294) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +320 -0
  3. data/README.md +17 -8
  4. data/bundler.gemspec +25 -9
  5. data/exe/bundle +1 -6
  6. data/exe/bundle_ruby +4 -3
  7. data/lib/bundler/build_metadata.rb +53 -0
  8. data/lib/bundler/capistrano.rb +5 -0
  9. data/lib/bundler/cli/add.rb +15 -6
  10. data/lib/bundler/cli/binstubs.rb +17 -9
  11. data/lib/bundler/cli/cache.rb +5 -4
  12. data/lib/bundler/cli/check.rb +3 -5
  13. data/lib/bundler/cli/clean.rb +5 -6
  14. data/lib/bundler/cli/common.rb +11 -2
  15. data/lib/bundler/cli/config.rb +2 -1
  16. data/lib/bundler/cli/console.rb +2 -1
  17. data/lib/bundler/cli/doctor.rb +48 -1
  18. data/lib/bundler/cli/exec.rb +6 -5
  19. data/lib/bundler/cli/gem.rb +13 -8
  20. data/lib/bundler/cli/info.rb +0 -1
  21. data/lib/bundler/cli/init.rb +18 -6
  22. data/lib/bundler/cli/inject.rb +1 -0
  23. data/lib/bundler/cli/install.rb +64 -77
  24. data/lib/bundler/cli/issue.rb +1 -1
  25. data/lib/bundler/cli/list.rb +58 -0
  26. data/lib/bundler/cli/lock.rb +0 -1
  27. data/lib/bundler/cli/open.rb +2 -2
  28. data/lib/bundler/cli/outdated.rb +20 -9
  29. data/lib/bundler/cli/package.rb +9 -6
  30. data/lib/bundler/cli/platform.rb +1 -0
  31. data/lib/bundler/cli/plugin.rb +1 -0
  32. data/lib/bundler/cli/pristine.rb +20 -6
  33. data/lib/bundler/cli/remove.rb +18 -0
  34. data/lib/bundler/cli/show.rb +0 -1
  35. data/lib/bundler/cli/update.rb +35 -7
  36. data/lib/bundler/cli/viz.rb +4 -0
  37. data/lib/bundler/cli.rb +234 -90
  38. data/lib/bundler/compact_index_client/cache.rb +1 -2
  39. data/lib/bundler/compact_index_client/updater.rb +35 -7
  40. data/lib/bundler/compact_index_client.rb +1 -0
  41. data/lib/bundler/compatibility_guard.rb +14 -0
  42. data/lib/bundler/constants.rb +1 -0
  43. data/lib/bundler/current_ruby.rb +13 -5
  44. data/lib/bundler/definition.rb +192 -139
  45. data/lib/bundler/dep_proxy.rb +3 -1
  46. data/lib/bundler/dependency.rb +9 -9
  47. data/lib/bundler/deployment.rb +1 -1
  48. data/lib/bundler/deprecate.rb +15 -3
  49. data/lib/bundler/dsl.rb +115 -64
  50. data/lib/bundler/endpoint_specification.rb +10 -1
  51. data/lib/bundler/env.rb +90 -29
  52. data/lib/bundler/environment_preserver.rb +27 -6
  53. data/lib/bundler/errors.rb +1 -0
  54. data/lib/bundler/feature_flag.rb +46 -4
  55. data/lib/bundler/fetcher/base.rb +1 -0
  56. data/lib/bundler/fetcher/compact_index.rb +2 -11
  57. data/lib/bundler/fetcher/dependency.rb +2 -1
  58. data/lib/bundler/fetcher/downloader.rb +11 -5
  59. data/lib/bundler/fetcher/index.rb +3 -2
  60. data/lib/bundler/fetcher.rb +18 -11
  61. data/lib/bundler/friendly_errors.rb +6 -1
  62. data/lib/bundler/gem_helper.rb +19 -10
  63. data/lib/bundler/gem_helpers.rb +1 -0
  64. data/lib/bundler/gem_remote_fetcher.rb +1 -0
  65. data/lib/bundler/gem_tasks.rb +1 -0
  66. data/lib/bundler/gem_version_promoter.rb +17 -2
  67. data/lib/bundler/gemdeps.rb +1 -0
  68. data/lib/bundler/graph.rb +1 -0
  69. data/lib/bundler/index.rb +8 -8
  70. data/lib/bundler/injector.rb +192 -30
  71. data/lib/bundler/inline.rb +10 -10
  72. data/lib/bundler/installer/gem_installer.rb +12 -2
  73. data/lib/bundler/installer/parallel_installer.rb +78 -42
  74. data/lib/bundler/installer/standalone.rb +1 -0
  75. data/lib/bundler/installer.rb +138 -53
  76. data/lib/bundler/lazy_specification.rb +3 -2
  77. data/lib/bundler/lockfile_generator.rb +95 -0
  78. data/lib/bundler/lockfile_parser.rb +10 -4
  79. data/lib/bundler/match_platform.rb +1 -0
  80. data/lib/bundler/mirror.rb +8 -5
  81. data/lib/bundler/plugin/api/source.rb +9 -2
  82. data/lib/bundler/plugin/events.rb +61 -0
  83. data/lib/bundler/plugin/index.rb +7 -2
  84. data/lib/bundler/plugin/installer.rb +7 -6
  85. data/lib/bundler/plugin/source_list.rb +7 -8
  86. data/lib/bundler/plugin.rb +13 -5
  87. data/lib/bundler/process_lock.rb +24 -0
  88. data/lib/bundler/psyched_yaml.rb +10 -0
  89. data/lib/bundler/remote_specification.rb +10 -1
  90. data/lib/bundler/resolver/spec_group.rb +106 -0
  91. data/lib/bundler/resolver.rb +158 -195
  92. data/lib/bundler/retry.rb +1 -0
  93. data/lib/bundler/ruby_dsl.rb +1 -0
  94. data/lib/bundler/ruby_version.rb +2 -1
  95. data/lib/bundler/rubygems_ext.rb +5 -4
  96. data/lib/bundler/rubygems_gem_installer.rb +31 -1
  97. data/lib/bundler/rubygems_integration.rb +71 -32
  98. data/lib/bundler/runtime.rb +11 -9
  99. data/lib/bundler/settings/validator.rb +102 -0
  100. data/lib/bundler/settings.rb +213 -86
  101. data/lib/bundler/setup.rb +4 -7
  102. data/lib/bundler/shared_helpers.rb +131 -26
  103. data/lib/bundler/similarity_detector.rb +1 -0
  104. data/lib/bundler/source/gemspec.rb +1 -0
  105. data/lib/bundler/source/git/git_proxy.rb +21 -11
  106. data/lib/bundler/source/git.rb +24 -19
  107. data/lib/bundler/source/metadata.rb +62 -0
  108. data/lib/bundler/source/path/installer.rb +2 -0
  109. data/lib/bundler/source/path.rb +11 -7
  110. data/lib/bundler/source/rubygems/remote.rb +8 -2
  111. data/lib/bundler/source/rubygems.rb +161 -84
  112. data/lib/bundler/source.rb +36 -0
  113. data/lib/bundler/source_list.rb +75 -15
  114. data/lib/bundler/spec_set.rb +12 -6
  115. data/lib/bundler/ssl_certs/certificate_manager.rb +2 -1
  116. data/lib/bundler/stub_specification.rb +1 -0
  117. data/lib/bundler/templates/.document +1 -0
  118. data/lib/bundler/templates/Executable +12 -0
  119. data/lib/bundler/templates/Executable.bundler +105 -0
  120. data/lib/bundler/templates/Gemfile +3 -0
  121. data/lib/bundler/templates/gems.rb +8 -0
  122. data/lib/bundler/templates/newgem/Gemfile.tt +2 -0
  123. data/lib/bundler/templates/newgem/README.md.tt +1 -1
  124. data/lib/bundler/templates/newgem/gitignore.tt +0 -1
  125. data/lib/bundler/templates/newgem/lib/newgem.rb.tt +1 -0
  126. data/lib/bundler/templates/newgem/newgem.gemspec.tt +12 -3
  127. data/lib/bundler/templates/newgem/rspec.tt +1 -0
  128. data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +0 -2
  129. data/lib/bundler/templates/newgem/{.travis.yml.tt → travis.yml.tt} +2 -0
  130. data/lib/bundler/ui/rg_proxy.rb +1 -0
  131. data/lib/bundler/ui/shell.rb +17 -4
  132. data/lib/bundler/ui/silent.rb +1 -0
  133. data/lib/bundler/ui.rb +1 -0
  134. data/lib/bundler/uri_credentials_filter.rb +1 -0
  135. data/lib/bundler/vendor/fileutils/lib/fileutils.rb +1638 -0
  136. data/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +26 -0
  137. data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +7 -0
  138. data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +1 -0
  139. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +1 -0
  140. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +1 -0
  141. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +1 -0
  142. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +1 -0
  143. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -0
  144. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +1 -0
  145. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +1 -0
  146. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +1 -0
  147. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +15 -4
  148. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +3 -2
  149. data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +75 -7
  150. data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +2 -1
  151. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +1 -0
  152. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +3 -1
  153. data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +491 -148
  154. data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +1 -0
  155. data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +8 -4
  156. data/lib/bundler/vendor/molinillo/lib/molinillo.rb +2 -0
  157. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +3 -1
  158. data/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +1 -0
  159. data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +1 -0
  160. data/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +9 -1
  161. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +45 -8
  162. data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +9 -3
  163. data/lib/bundler/vendor/thor/lib/thor/actions.rb +6 -3
  164. data/lib/bundler/vendor/thor/lib/thor/base.rb +27 -4
  165. data/lib/bundler/vendor/thor/lib/thor/command.rb +9 -7
  166. data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +12 -0
  167. data/lib/bundler/vendor/thor/lib/thor/group.rb +1 -1
  168. data/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +2 -0
  169. data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +5 -5
  170. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +6 -5
  171. data/lib/bundler/vendor/thor/lib/thor/runner.rb +6 -4
  172. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +10 -9
  173. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  174. data/lib/bundler/vendor/thor/lib/thor.rb +25 -8
  175. data/lib/bundler/vendored_fileutils.rb +9 -0
  176. data/lib/bundler/vendored_molinillo.rb +1 -0
  177. data/lib/bundler/vendored_persistent.rb +35 -0
  178. data/lib/bundler/vendored_thor.rb +1 -0
  179. data/lib/bundler/version.rb +6 -2
  180. data/lib/bundler/version_ranges.rb +1 -0
  181. data/lib/bundler/vlad.rb +5 -0
  182. data/lib/bundler/worker.rb +1 -0
  183. data/lib/bundler/yaml_serializer.rb +3 -3
  184. data/lib/bundler.rb +86 -52
  185. data/man/bundle-add.1 +18 -3
  186. data/man/bundle-add.1.txt +26 -14
  187. data/man/bundle-add.ronn +13 -2
  188. data/man/bundle-binstubs.1 +11 -1
  189. data/man/bundle-binstubs.1.txt +33 -18
  190. data/man/bundle-binstubs.ronn +15 -1
  191. data/man/bundle-check.1 +4 -4
  192. data/man/bundle-check.1.txt +15 -14
  193. data/man/bundle-check.ronn +3 -3
  194. data/man/bundle-clean.1 +1 -1
  195. data/man/bundle-clean.1.txt +10 -10
  196. data/man/bundle-config.1 +129 -29
  197. data/man/bundle-config.1.txt +285 -174
  198. data/man/bundle-config.ronn +167 -88
  199. data/man/bundle-doctor.1 +44 -0
  200. data/man/bundle-doctor.1.txt +44 -0
  201. data/man/bundle-doctor.ronn +33 -0
  202. data/man/bundle-exec.1 +6 -3
  203. data/man/bundle-exec.1.txt +78 -71
  204. data/man/bundle-exec.ronn +10 -3
  205. data/man/bundle-gem.1 +4 -4
  206. data/man/bundle-gem.1.txt +41 -40
  207. data/man/bundle-gem.ronn +3 -2
  208. data/man/bundle-info.1 +1 -1
  209. data/man/bundle-info.1.txt +8 -8
  210. data/man/bundle-init.1 +9 -4
  211. data/man/bundle-init.1.txt +23 -13
  212. data/man/bundle-init.ronn +15 -4
  213. data/man/bundle-inject.1 +4 -4
  214. data/man/bundle-inject.1.txt +10 -10
  215. data/man/bundle-inject.ronn +3 -3
  216. data/man/bundle-install.1 +31 -28
  217. data/man/bundle-install.1.txt +205 -194
  218. data/man/bundle-install.ronn +44 -35
  219. data/man/bundle-list.1 +50 -0
  220. data/man/bundle-list.1.txt +43 -0
  221. data/man/bundle-list.ronn +33 -0
  222. data/man/bundle-lock.1 +1 -1
  223. data/man/bundle-lock.1.txt +47 -47
  224. data/man/bundle-lock.ronn +1 -1
  225. data/man/bundle-open.1 +1 -1
  226. data/man/bundle-open.1.txt +7 -7
  227. data/man/bundle-outdated.1 +7 -3
  228. data/man/bundle-outdated.1.txt +40 -36
  229. data/man/bundle-outdated.ronn +6 -2
  230. data/man/bundle-package.1 +6 -3
  231. data/man/bundle-package.1.txt +44 -39
  232. data/man/bundle-package.ronn +7 -2
  233. data/man/bundle-platform.1 +1 -1
  234. data/man/bundle-platform.1.txt +13 -13
  235. data/man/bundle-pristine.1 +21 -3
  236. data/man/bundle-pristine.1.txt +33 -10
  237. data/man/bundle-pristine.ronn +24 -3
  238. data/man/bundle-remove.1 +31 -0
  239. data/man/bundle-remove.1.txt +34 -0
  240. data/man/bundle-remove.ronn +23 -0
  241. data/man/bundle-show.1 +3 -3
  242. data/man/bundle-show.1.txt +14 -12
  243. data/man/bundle-show.ronn +3 -2
  244. data/man/bundle-update.1 +13 -9
  245. data/man/bundle-update.1.txt +133 -130
  246. data/man/bundle-update.ronn +21 -17
  247. data/man/bundle-viz.1 +7 -7
  248. data/man/bundle-viz.1.txt +17 -15
  249. data/man/bundle-viz.ronn +6 -6
  250. data/man/bundle.1 +31 -32
  251. data/man/bundle.1.txt +63 -75
  252. data/man/bundle.ronn +35 -47
  253. data/man/gemfile.5 +44 -8
  254. data/man/gemfile.5.ronn +54 -8
  255. data/man/gemfile.5.txt +218 -165
  256. data/man/index.txt +25 -15
  257. metadata +36 -44
  258. data/.codeclimate.yml +0 -25
  259. data/.gitignore +0 -18
  260. data/.rspec +0 -3
  261. data/.rubocop.yml +0 -131
  262. data/.rubocop_todo.yml +0 -418
  263. data/.travis.yml +0 -122
  264. data/CODE_OF_CONDUCT.md +0 -42
  265. data/CONTRIBUTING.md +0 -17
  266. data/Rakefile +0 -346
  267. data/bin/rake +0 -19
  268. data/bin/rspec +0 -15
  269. data/bin/rubocop +0 -17
  270. data/bin/with_rubygems +0 -39
  271. data/doc/README.md +0 -30
  272. data/doc/TROUBLESHOOTING.md +0 -64
  273. data/doc/contributing/BUG_TRIAGE.md +0 -36
  274. data/doc/contributing/COMMUNITY.md +0 -13
  275. data/doc/contributing/GETTING_HELP.md +0 -11
  276. data/doc/contributing/HOW_YOU_CAN_HELP.md +0 -27
  277. data/doc/contributing/ISSUES.md +0 -51
  278. data/doc/contributing/README.md +0 -38
  279. data/doc/development/NEW_FEATURES.md +0 -10
  280. data/doc/development/PULL_REQUESTS.md +0 -40
  281. data/doc/development/README.md +0 -19
  282. data/doc/development/RELEASING.md +0 -9
  283. data/doc/development/SETUP.md +0 -29
  284. data/doc/documentation/README.md +0 -29
  285. data/doc/documentation/VISION.md +0 -26
  286. data/doc/documentation/WRITING.md +0 -54
  287. data/lib/bundler/postit_trampoline.rb +0 -73
  288. data/lib/bundler/vendor/postit/lib/postit/environment.rb +0 -44
  289. data/lib/bundler/vendor/postit/lib/postit/installer.rb +0 -28
  290. data/lib/bundler/vendor/postit/lib/postit/parser.rb +0 -21
  291. data/lib/bundler/vendor/postit/lib/postit/setup.rb +0 -12
  292. data/lib/bundler/vendor/postit/lib/postit/version.rb +0 -3
  293. data/lib/bundler/vendor/postit/lib/postit.rb +0 -15
  294. data/task/release.rake +0 -116
@@ -158,10 +158,6 @@ class Bundler::Thor
158
158
  end
159
159
  alias_method :option, :method_option
160
160
 
161
- def disable_class_options
162
- @disable_class_options = true
163
- end
164
-
165
161
  # Prints help information for the given command.
166
162
  #
167
163
  # ==== Parameters
@@ -241,6 +237,9 @@ class Bundler::Thor
241
237
  invoke_args.unshift "help" if opts.delete("--help") || opts.delete("-h")
242
238
  invoke subcommand_class, *invoke_args
243
239
  end
240
+ subcommand_class.commands.each do |_meth, command|
241
+ command.ancestor_name = subcommand
242
+ end
244
243
  end
245
244
  alias_method :subtask, :subcommand
246
245
 
@@ -326,12 +325,31 @@ class Bundler::Thor
326
325
  command && stop_on_unknown_option.include?(command.name.to_sym)
327
326
  end
328
327
 
328
+ # Disable the check for required options for the given commands.
329
+ # This is useful if you have a command that does not need the required options
330
+ # to work, like help.
331
+ #
332
+ # ==== Parameters
333
+ # Symbol ...:: A list of commands that should be affected.
334
+ def disable_required_check!(*command_names)
335
+ disable_required_check.merge(command_names)
336
+ end
337
+
338
+ def disable_required_check?(command) #:nodoc:
339
+ command && disable_required_check.include?(command.name.to_sym)
340
+ end
341
+
329
342
  protected
330
343
 
331
344
  def stop_on_unknown_option #:nodoc:
332
345
  @stop_on_unknown_option ||= Set.new
333
346
  end
334
347
 
348
+ # help command has the required check disabled by default.
349
+ def disable_required_check #:nodoc:
350
+ @disable_required_check ||= Set.new([:help])
351
+ end
352
+
335
353
  # The method responsible for dispatching given the args.
336
354
  def dispatch(meth, given_args, given_opts, config) #:nodoc: # rubocop:disable MethodLength
337
355
  meth ||= retrieve_command_name(given_args)
@@ -390,12 +408,12 @@ class Bundler::Thor
390
408
  @usage ||= nil
391
409
  @desc ||= nil
392
410
  @long_desc ||= nil
393
- @disable_class_options ||= nil
411
+ @hide ||= nil
394
412
 
395
413
  if @usage && @desc
396
414
  base_class = @hide ? Bundler::Thor::HiddenCommand : Bundler::Thor::Command
397
- commands[meth] = base_class.new(meth, @desc, @long_desc, @usage, method_options, @disable_class_options)
398
- @usage, @desc, @long_desc, @method_options, @hide, @disable_class_options = nil
415
+ commands[meth] = base_class.new(meth, @desc, @long_desc, @usage, method_options)
416
+ @usage, @desc, @long_desc, @method_options, @hide = nil
399
417
  true
400
418
  elsif all_commands[meth] || meth == "method_missing"
401
419
  true
@@ -477,7 +495,6 @@ class Bundler::Thor
477
495
  map HELP_MAPPINGS => :help
478
496
 
479
497
  desc "help [COMMAND]", "Describe available commands or one specific command"
480
- disable_class_options
481
498
  def help(command = nil, subcommand = false)
482
499
  if command
483
500
  if self.class.subcommands.include? command
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bundler; end
4
+ if RUBY_VERSION >= "2.4"
5
+ require "bundler/vendor/fileutils/lib/fileutils"
6
+ else
7
+ # the version we vendor is 2.4+
8
+ require "fileutils"
9
+ end
@@ -1,3 +1,4 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Bundler; end
3
4
  require "bundler/vendor/molinillo/lib/molinillo"
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # We forcibly require OpenSSL, because net/http/persistent will only autoload
3
4
  # it. On some Rubies, autoload fails but explicit require succeeds.
4
5
  begin
@@ -15,3 +16,37 @@ module Bundler
15
16
  end
16
17
  end
17
18
  require "bundler/vendor/net-http-persistent/lib/net/http/persistent"
19
+
20
+ module Bundler
21
+ class PersistentHTTP < Persistent::Net::HTTP::Persistent
22
+ def connection_for(uri)
23
+ connection = super
24
+ warn_old_tls_version_rubygems_connection(uri, connection)
25
+ connection
26
+ end
27
+
28
+ def warn_old_tls_version_rubygems_connection(uri, connection)
29
+ return unless connection.use_ssl?
30
+ return unless (uri.host || "").end_with?("rubygems.org")
31
+
32
+ socket = connection.instance_variable_get(:@socket)
33
+ return unless socket
34
+ socket_io = socket.io
35
+ return unless socket_io.respond_to?(:ssl_version)
36
+ ssl_version = socket_io.ssl_version
37
+
38
+ case ssl_version
39
+ when /TLSv([\d\.]+)/
40
+ version = Gem::Version.new($1)
41
+ if version < Gem::Version.new("1.2")
42
+ Bundler.ui.warn \
43
+ "Warning: Your Ruby version is compiled against a copy of OpenSSL that is very old. " \
44
+ "Starting in January 2018, RubyGems.org will refuse connection requests from these " \
45
+ "very old versions of OpenSSL. If you will need to continue installing gems after " \
46
+ "January 2018, please follow this guide to upgrade: http://ruby.to/tls-outdated.",
47
+ :wrap => true
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Bundler
3
4
  def self.require_thor_actions
4
5
  Kernel.send(:require, "bundler/vendor/thor/lib/thor/actions")
@@ -1,4 +1,4 @@
1
- # frozen_string_literal: true
1
+ # frozen_string_literal: false
2
2
 
3
3
  # Ruby 1.9.3 and old RubyGems don't play nice with frozen version strings
4
4
  # rubocop:disable MutableConstant
@@ -7,7 +7,7 @@ module Bundler
7
7
  # We're doing this because we might write tests that deal
8
8
  # with other versions of bundler and we are unsure how to
9
9
  # handle this better.
10
- VERSION = "1.15.1" unless defined?(::Bundler::VERSION)
10
+ VERSION = "1.17.3" unless defined?(::Bundler::VERSION)
11
11
 
12
12
  def self.overwrite_loaded_gem_version
13
13
  begin
@@ -21,4 +21,8 @@ module Bundler
21
21
  end
22
22
  private_class_method :overwrite_loaded_gem_version
23
23
  overwrite_loaded_gem_version
24
+
25
+ def self.bundler_major_version
26
+ @bundler_major_version ||= VERSION.split(".").first.to_i
27
+ end
24
28
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Bundler
3
4
  module VersionRanges
4
5
  NEq = Struct.new(:version)
data/lib/bundler/vlad.rb CHANGED
@@ -1,4 +1,9 @@
1
1
  # frozen_string_literal: true
2
+
3
+ require "bundler/shared_helpers"
4
+ Bundler::SharedHelpers.major_deprecation 2,
5
+ "The Bundler task for Vlad"
6
+
2
7
  # Vlad task for Bundler.
3
8
  #
4
9
  # Add "require 'bundler/vlad'" in your Vlad deploy.rb, and
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require "thread"
3
4
 
4
5
  module Bundler
@@ -37,7 +37,7 @@ module Bundler
37
37
  HASH_REGEX = /
38
38
  ^
39
39
  ([ ]*) # indentations
40
- (.*) # key
40
+ (.+) # key
41
41
  (?::(?=(?:\s|$))) # : (without the lookahead the #key includes this when : is present in value)
42
42
  [ ]?
43
43
  (?: !\s)? # optional exclamation mark found with ruby 1.9.3
@@ -54,10 +54,10 @@ module Bundler
54
54
  last_empty_key = nil
55
55
  str.split(/\r?\n/).each do |line|
56
56
  if match = HASH_REGEX.match(line)
57
- indent, key, _, val = match.captures
57
+ indent, key, quote, val = match.captures
58
58
  key = convert_to_backward_compatible_key(key)
59
59
  depth = indent.scan(/ /).length
60
- if val.empty?
60
+ if quote.empty? && val.empty?
61
61
  new_hash = {}
62
62
  stack[depth][key] = new_hash
63
63
  stack[depth + 1] = new_hash
data/lib/bundler.rb CHANGED
@@ -1,9 +1,11 @@
1
1
  # frozen_string_literal: true
2
- require "fileutils"
2
+
3
+ require "bundler/compatibility_guard"
4
+
5
+ require "bundler/vendored_fileutils"
3
6
  require "pathname"
4
7
  require "rbconfig"
5
8
  require "thread"
6
- require "tmpdir"
7
9
 
8
10
  require "bundler/errors"
9
11
  require "bundler/environment_preserver"
@@ -13,9 +15,10 @@ require "bundler/rubygems_integration"
13
15
  require "bundler/version"
14
16
  require "bundler/constants"
15
17
  require "bundler/current_ruby"
18
+ require "bundler/build_metadata"
16
19
 
17
20
  module Bundler
18
- environment_preserver = EnvironmentPreserver.new(ENV, %w(PATH GEM_PATH))
21
+ environment_preserver = EnvironmentPreserver.new(ENV, EnvironmentPreserver::BUNDLER_KEYS)
19
22
  ORIGINAL_ENV = environment_preserver.restore
20
23
  ENV.replace(environment_preserver.backup)
21
24
  SUDO_MUTEX = Mutex.new
@@ -40,6 +43,7 @@ module Bundler
40
43
  autoload :LazySpecification, "bundler/lazy_specification"
41
44
  autoload :LockfileParser, "bundler/lockfile_parser"
42
45
  autoload :MatchPlatform, "bundler/match_platform"
46
+ autoload :ProcessLock, "bundler/process_lock"
43
47
  autoload :RemoteSpecification, "bundler/remote_specification"
44
48
  autoload :Resolver, "bundler/resolver"
45
49
  autoload :Retry, "bundler/retry"
@@ -58,8 +62,6 @@ module Bundler
58
62
  autoload :VersionRanges, "bundler/version_ranges"
59
63
 
60
64
  class << self
61
- attr_writer :bundle_path
62
-
63
65
  def configure
64
66
  @configured ||= configure_gem_home_and_path
65
67
  end
@@ -75,7 +77,11 @@ module Bundler
75
77
 
76
78
  # Returns absolute path of where gems are installed on the filesystem.
77
79
  def bundle_path
78
- @bundle_path ||= Pathname.new(settings.path).expand_path(root)
80
+ @bundle_path ||= Pathname.new(configured_bundle_path.path).expand_path(root)
81
+ end
82
+
83
+ def configured_bundle_path
84
+ @configured_bundle_path ||= settings.path.tap(&:validate!)
79
85
  end
80
86
 
81
87
  # Returns absolute location of where binstubs are installed to.
@@ -113,7 +119,7 @@ module Bundler
113
119
  end
114
120
 
115
121
  def environment
116
- SharedHelpers.major_deprecation "Bundler.environment has been removed in favor of Bundler.load"
122
+ SharedHelpers.major_deprecation 2, "Bundler.environment has been removed in favor of Bundler.load"
117
123
  load
118
124
  end
119
125
 
@@ -130,6 +136,12 @@ module Bundler
130
136
  end
131
137
  end
132
138
 
139
+ def frozen_bundle?
140
+ frozen = settings[:deployment]
141
+ frozen ||= settings[:frozen] unless feature_flag.deployment_means_frozen?
142
+ frozen
143
+ end
144
+
133
145
  def locked_gems
134
146
  @locked_gems ||=
135
147
  if defined?(@definition) && @definition
@@ -147,16 +159,18 @@ module Bundler
147
159
  def user_home
148
160
  @user_home ||= begin
149
161
  home = Bundler.rubygems.user_home
162
+ bundle_home = home ? File.join(home, ".bundle") : nil
150
163
 
151
164
  warning = if home.nil?
152
165
  "Your home directory is not set."
153
166
  elsif !File.directory?(home)
154
167
  "`#{home}` is not a directory."
155
- elsif !File.writable?(home)
168
+ elsif !File.writable?(home) && (!File.directory?(bundle_home) || !File.writable?(bundle_home))
156
169
  "`#{home}` is not writable."
157
170
  end
158
171
 
159
172
  if warning
173
+ Kernel.send(:require, "etc")
160
174
  user_home = tmp_home_path(Etc.getlogin, warning)
161
175
  Bundler.ui.warn "#{warning}\nBundler will use `#{user_home}' as your home directory temporarily.\n"
162
176
  user_home
@@ -168,6 +182,7 @@ module Bundler
168
182
 
169
183
  def tmp_home_path(login, warning)
170
184
  login ||= "unknown"
185
+ Kernel.send(:require, "tmpdir")
171
186
  path = Pathname.new(Dir.tmpdir).join("bundler", "home")
172
187
  SharedHelpers.filesystem_access(path) do |tmp_home_path|
173
188
  unless tmp_home_path.exist?
@@ -176,12 +191,30 @@ module Bundler
176
191
  end
177
192
  tmp_home_path.join(login).tap(&:mkpath)
178
193
  end
179
- rescue => e
194
+ rescue RuntimeError => e
180
195
  raise e.exception("#{warning}\nBundler also failed to create a temporary home directory at `#{path}':\n#{e}")
181
196
  end
182
197
 
183
- def user_bundle_path
184
- Pathname.new(user_home).join(".bundle")
198
+ def user_bundle_path(dir = "home")
199
+ env_var, fallback = case dir
200
+ when "home"
201
+ ["BUNDLE_USER_HOME", Pathname.new(user_home).join(".bundle")]
202
+ when "cache"
203
+ ["BUNDLE_USER_CACHE", user_bundle_path.join("cache")]
204
+ when "config"
205
+ ["BUNDLE_USER_CONFIG", user_bundle_path.join("config")]
206
+ when "plugin"
207
+ ["BUNDLE_USER_PLUGIN", user_bundle_path.join("plugin")]
208
+ else
209
+ raise BundlerError, "Unknown user path requested: #{dir}"
210
+ end
211
+ # `fallback` will already be a Pathname, but Pathname.new() is
212
+ # idempotent so it's OK
213
+ Pathname.new(ENV.fetch(env_var, fallback))
214
+ end
215
+
216
+ def user_cache
217
+ user_bundle_path("cache")
185
218
  end
186
219
 
187
220
  def home
@@ -196,17 +229,9 @@ module Bundler
196
229
  bundle_path.join("specifications")
197
230
  end
198
231
 
199
- def cache
200
- bundle_path.join("cache/bundler")
201
- end
202
-
203
- def user_cache
204
- user_bundle_path.join("cache")
205
- end
206
-
207
232
  def root
208
233
  @root ||= begin
209
- default_gemfile.dirname.expand_path
234
+ SharedHelpers.root
210
235
  rescue GemfileNotFound
211
236
  bundle_dir = default_bundle_dir
212
237
  raise GemfileNotFound, "Could not locate Gemfile or .bundle/ directory" unless bundle_dir
@@ -215,8 +240,8 @@ module Bundler
215
240
  end
216
241
 
217
242
  def app_config_path
218
- if ENV["BUNDLE_APP_CONFIG"]
219
- Pathname.new(ENV["BUNDLE_APP_CONFIG"]).expand_path(root)
243
+ if app_config = ENV["BUNDLE_APP_CONFIG"]
244
+ Pathname.new(app_config).expand_path(root)
220
245
  else
221
246
  root.join(".bundle")
222
247
  end
@@ -224,10 +249,11 @@ module Bundler
224
249
 
225
250
  def app_cache(custom_path = nil)
226
251
  path = custom_path || root
227
- path.join(settings.app_cache_path)
252
+ Pathname.new(path).join(settings.app_cache_path)
228
253
  end
229
254
 
230
255
  def tmp(name = Process.pid.to_s)
256
+ Kernel.send(:require, "tmpdir")
231
257
  Pathname.new(Dir.mktmpdir(["bundler", name]))
232
258
  end
233
259
 
@@ -257,7 +283,7 @@ EOF
257
283
  # @deprecated Use `original_env` instead
258
284
  # @return [Hash] Environment with all bundler-related variables removed
259
285
  def clean_env
260
- Bundler::SharedHelpers.major_deprecation("`Bundler.clean_env` has weird edge cases, use `.original_env` instead")
286
+ Bundler::SharedHelpers.major_deprecation(2, "`Bundler.clean_env` has weird edge cases, use `.original_env` instead")
261
287
  env = original_env
262
288
 
263
289
  if env.key?("BUNDLER_ORIG_MANPATH")
@@ -313,21 +339,25 @@ EOF
313
339
  end
314
340
 
315
341
  def system_bindir
316
- # Gem.bindir doesn't always return the location that Rubygems will install
317
- # system binaries. If you put '-n foo' in your .gemrc, Rubygems will
318
- # install binstubs there instead. Unfortunately, Rubygems doesn't expose
342
+ # Gem.bindir doesn't always return the location that RubyGems will install
343
+ # system binaries. If you put '-n foo' in your .gemrc, RubyGems will
344
+ # install binstubs there instead. Unfortunately, RubyGems doesn't expose
319
345
  # that directory at all, so rather than parse .gemrc ourselves, we allow
320
346
  # the directory to be set as well, via `bundle config bindir foo`.
321
347
  Bundler.settings[:system_bindir] || Bundler.rubygems.gem_bindir
322
348
  end
323
349
 
350
+ def use_system_gems?
351
+ configured_bundle_path.use_system_gems?
352
+ end
353
+
324
354
  def requires_sudo?
325
355
  return @requires_sudo if defined?(@requires_sudo_ran)
326
356
 
327
357
  sudo_present = which "sudo" if settings.allow_sudo?
328
358
 
329
359
  if sudo_present
330
- # the bundle path and subdirectories need to be writable for Rubygems
360
+ # the bundle path and subdirectories need to be writable for RubyGems
331
361
  # to be able to unpack and install gems without exploding
332
362
  path = bundle_path
333
363
  path = path.parent until path.exist?
@@ -337,16 +367,20 @@ EOF
337
367
  bin_dir = bin_dir.parent until bin_dir.exist?
338
368
 
339
369
  # if any directory is not writable, we need sudo
340
- files = [path, bin_dir] | Dir[path.join("build_info/*").to_s] | Dir[path.join("*").to_s]
341
- sudo_needed = files.any? {|f| !File.writable?(f) }
370
+ files = [path, bin_dir] | Dir[bundle_path.join("build_info/*").to_s] | Dir[bundle_path.join("*").to_s]
371
+ unwritable_files = files.reject {|f| File.writable?(f) }
372
+ sudo_needed = !unwritable_files.empty?
373
+ if sudo_needed
374
+ Bundler.ui.warn "Following files may not be writable, so sudo is needed:\n #{unwritable_files.map(&:to_s).sort.join("\n ")}"
375
+ end
342
376
  end
343
377
 
344
378
  @requires_sudo_ran = true
345
379
  @requires_sudo = settings.allow_sudo? && sudo_present && sudo_needed
346
380
  end
347
381
 
348
- def mkdir_p(path)
349
- if requires_sudo?
382
+ def mkdir_p(path, options = {})
383
+ if requires_sudo? && !options[:no_sudo]
350
384
  sudo "mkdir -p '#{path}'" unless File.exist?(path)
351
385
  else
352
386
  SharedHelpers.filesystem_access(path, :write) do |p|
@@ -393,12 +427,14 @@ EOF
393
427
  end
394
428
 
395
429
  def read_file(file)
396
- File.open(file, "rb", &:read)
430
+ SharedHelpers.filesystem_access(file, :read) do
431
+ File.open(file, "r:UTF-8", &:read)
432
+ end
397
433
  end
398
434
 
399
435
  def load_marshal(data)
400
436
  Marshal.load(data)
401
- rescue => e
437
+ rescue StandardError => e
402
438
  raise MarshalError, "#{e.class}: #{e.message}"
403
439
  end
404
440
 
@@ -413,7 +449,7 @@ EOF
413
449
 
414
450
  def load_gemspec_uncached(file, validate = false)
415
451
  path = Pathname.new(file)
416
- contents = path.read
452
+ contents = read_file(file)
417
453
  spec = if contents.start_with?("---") # YAML header
418
454
  eval_yaml_gemspec(path, contents)
419
455
  else
@@ -449,14 +485,17 @@ EOF
449
485
  end
450
486
 
451
487
  def reset_paths!
452
- @root = nil
453
- @settings = nil
488
+ @bin_path = nil
489
+ @bundler_major_version = nil
490
+ @bundle_path = nil
491
+ @configured = nil
492
+ @configured_bundle_path = nil
454
493
  @definition = nil
455
- @setup = nil
456
494
  @load = nil
457
495
  @locked_gems = nil
458
- @bundle_path = nil
459
- @bin_path = nil
496
+ @root = nil
497
+ @settings = nil
498
+ @setup = nil
460
499
  @user_home = nil
461
500
  end
462
501
 
@@ -470,6 +509,8 @@ EOF
470
509
  private
471
510
 
472
511
  def eval_yaml_gemspec(path, contents)
512
+ Kernel.send(:require, "bundler/psyched_yaml")
513
+
473
514
  # If the YAML is invalid, Syck raises an ArgumentError, and Psych
474
515
  # raises a Psych::SyntaxError. See psyched_yaml.rb for more info.
475
516
  Gem::Specification.from_yaml(contents)
@@ -478,7 +519,7 @@ EOF
478
519
  end
479
520
 
480
521
  def eval_gemspec(path, contents)
481
- eval(contents, TOPLEVEL_BINDING, path.expand_path.to_s)
522
+ eval(contents, TOPLEVEL_BINDING.dup, path.expand_path.to_s)
482
523
  rescue ScriptError, StandardError => e
483
524
  msg = "There was an error while loading `#{path.basename}`: #{e.message}"
484
525
 
@@ -495,14 +536,14 @@ EOF
495
536
  bundle_path
496
537
  end
497
538
 
498
- def configure_gem_path(env = ENV, settings = self.settings)
539
+ def configure_gem_path(env = ENV)
499
540
  blank_home = env["GEM_HOME"].nil? || env["GEM_HOME"].empty?
500
- if settings[:disable_shared_gems]
541
+ if !use_system_gems?
501
542
  # this needs to be empty string to cause
502
543
  # PathSupport.split_gem_path to only load up the
503
544
  # Bundler --path setting as the GEM_PATH.
504
545
  env["GEM_PATH"] = ""
505
- elsif blank_home || Bundler.rubygems.gem_dir != bundle_path.to_s
546
+ elsif blank_home
506
547
  possibles = [Bundler.rubygems.gem_dir, Bundler.rubygems.gem_path]
507
548
  paths = possibles.flatten.compact.uniq.reject(&:empty?)
508
549
  env["GEM_PATH"] = paths.join(File::PATH_SEPARATOR)
@@ -510,14 +551,7 @@ EOF
510
551
  end
511
552
 
512
553
  def configure_gem_home
513
- # TODO: This mkdir_p is only needed for JRuby <= 1.5 and should go away (GH #602)
514
- begin
515
- FileUtils.mkdir_p bundle_path.to_s
516
- rescue
517
- nil
518
- end
519
-
520
- ENV["GEM_HOME"] = File.expand_path(bundle_path, root)
554
+ Bundler::SharedHelpers.set_env "GEM_HOME", File.expand_path(bundle_path, root)
521
555
  Bundler.rubygems.clear_paths
522
556
  end
523
557
 
data/man/bundle-add.1 CHANGED
@@ -1,16 +1,16 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-ADD" "1" "May 2017" "" ""
4
+ .TH "BUNDLE\-ADD" "1" "December 2018" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-add\fR \- Add gem to the Gemfile and run bundle install
8
8
  .
9
9
  .SH "SYNOPSIS"
10
- \fBbundle add\fR \fIGEM_NAME\fR [\-\-group=GROUP] [\-\-version=VERSION] [\-\-source=SOURCE]
10
+ \fBbundle add\fR \fIGEM_NAME\fR [\-\-group=GROUP] [\-\-version=VERSION] [\-\-source=SOURCE] [\-\-skip\-install] [\-\-strict] [\-\-optimistic]
11
11
  .
12
12
  .SH "DESCRIPTION"
13
- Adds the named gem to the Gemfile and run \fBbundle install\fR\.
13
+ Adds the named gem to the Gemfile and run \fBbundle install\fR\. \fBbundle install\fR can be avoided by using the flag \fB\-\-skip\-install\fR\.
14
14
  .
15
15
  .P
16
16
  Example:
@@ -25,6 +25,9 @@ bundle add rails \-\-version "< 3\.0, > 1\.1"
25
25
  bundle add rails \-\-version "~> 5\.0\.0" \-\-source "https://gems\.example\.com" \-\-group "development"
26
26
  .
27
27
  .P
28
+ bundle add rails \-\-skip\-install
29
+ .
30
+ .P
28
31
  bundle add rails \-\-group "development, test"
29
32
  .
30
33
  .SH "OPTIONS"
@@ -40,4 +43,16 @@ Specify the group(s) for the added gem\. Multiple groups should be separated by
40
43
  .TP
41
44
  \fB\-\-source\fR, , \fB\-s\fR
42
45
  Specify the source for the added gem\.
46
+ .
47
+ .TP
48
+ \fB\-\-skip\-install\fR
49
+ Adds the gem to the Gemfile but does not install it\.
50
+ .
51
+ .TP
52
+ \fB\-\-optimistic\fR
53
+ Adds optimistic declaration of version
54
+ .
55
+ .TP
56
+ \fB\-\-strict\fR
57
+ Adds strict declaration of version
43
58
 
data/man/bundle-add.1.txt CHANGED
@@ -2,15 +2,16 @@ BUNDLE-ADD(1) BUNDLE-ADD(1)
2
2
 
3
3
 
4
4
 
5
- 1mNAME0m
6
- 1mbundle-add 22m- Add gem to the Gemfile and run bundle install
5
+ NAME
6
+ bundle-add - Add gem to the Gemfile and run bundle install
7
7
 
8
- 1mSYNOPSIS0m
9
- 1mbundle add 4m22mGEM_NAME24m [--group=GROUP] [--version=VERSION]
10
- [--source=SOURCE]
8
+ SYNOPSIS
9
+ bundle add GEM_NAME [--group=GROUP] [--version=VERSION]
10
+ [--source=SOURCE] [--skip-install] [--strict] [--optimistic]
11
11
 
12
- 1mDESCRIPTION0m
13
- Adds the named gem to the Gemfile and run 1mbundle install22m.
12
+ DESCRIPTION
13
+ Adds the named gem to the Gemfile and run bundle install. bundle
14
+ install can be avoided by using the flag --skip-install.
14
15
 
15
16
  Example:
16
17
 
@@ -18,23 +19,34 @@ BUNDLE-ADD(1) BUNDLE-ADD(1)
18
19
 
19
20
  bundle add rails --version "< 3.0, > 1.1"
20
21
 
21
- bundle add rails --version "~> 5.0.0" --source "https://gems.exam-
22
+ bundle add rails --version "~> 5.0.0" --source "https://gems.exam-
22
23
  ple.com" --group "development"
23
24
 
25
+ bundle add rails --skip-install
26
+
24
27
  bundle add rails --group "development, test"
25
28
 
26
- 1mOPTIONS0m
27
- 1m--version22m, 1m-v0m
29
+ OPTIONS
30
+ --version, -v
28
31
  Specify version requirements(s) for the added gem.
29
32
 
30
- 1m--group22m, 1m-g0m
31
- Specify the group(s) for the added gem. Multiple groups should
33
+ --group, -g
34
+ Specify the group(s) for the added gem. Multiple groups should
32
35
  be separated by commas.
33
36
 
34
- 1m--source22m, , 1m-s0m
37
+ --source, , -s
35
38
  Specify the source for the added gem.
36
39
 
40
+ --skip-install
41
+ Adds the gem to the Gemfile but does not install it.
42
+
43
+ --optimistic
44
+ Adds optimistic declaration of version
45
+
46
+ --strict
47
+ Adds strict declaration of version
48
+
37
49
 
38
50
 
39
51
 
40
- May 2017 BUNDLE-ADD(1)
52
+ December 2018 BUNDLE-ADD(1)