bundler 2.2.3 → 2.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +503 -7
  3. data/README.md +1 -1
  4. data/bundler.gemspec +2 -3
  5. data/exe/bundle +7 -8
  6. data/lib/bundler/.document +1 -0
  7. data/lib/bundler/build_metadata.rb +2 -2
  8. data/lib/bundler/cli/cache.rb +2 -1
  9. data/lib/bundler/cli/check.rb +4 -2
  10. data/lib/bundler/cli/common.rb +15 -2
  11. data/lib/bundler/cli/doctor.rb +15 -4
  12. data/lib/bundler/cli/exec.rb +1 -6
  13. data/lib/bundler/cli/gem.rb +132 -24
  14. data/lib/bundler/cli/info.rb +16 -4
  15. data/lib/bundler/cli/install.rb +12 -27
  16. data/lib/bundler/cli/issue.rb +4 -3
  17. data/lib/bundler/cli/list.rb +7 -1
  18. data/lib/bundler/cli/lock.rb +5 -1
  19. data/lib/bundler/cli/open.rb +1 -2
  20. data/lib/bundler/cli/outdated.rb +10 -11
  21. data/lib/bundler/cli/remove.rb +1 -2
  22. data/lib/bundler/cli/update.rb +17 -8
  23. data/lib/bundler/cli.rb +44 -60
  24. data/lib/bundler/compact_index_client/cache.rb +0 -9
  25. data/lib/bundler/compact_index_client/updater.rb +10 -19
  26. data/lib/bundler/compact_index_client.rb +2 -8
  27. data/lib/bundler/current_ruby.rb +5 -4
  28. data/lib/bundler/definition.rb +158 -316
  29. data/lib/bundler/dep_proxy.rb +15 -8
  30. data/lib/bundler/dependency.rb +5 -7
  31. data/lib/bundler/digest.rb +71 -0
  32. data/lib/bundler/dsl.rb +67 -66
  33. data/lib/bundler/endpoint_specification.rb +21 -11
  34. data/lib/bundler/environment_preserver.rb +4 -1
  35. data/lib/bundler/errors.rb +19 -3
  36. data/lib/bundler/feature_flag.rb +0 -5
  37. data/lib/bundler/fetcher/compact_index.rb +10 -15
  38. data/lib/bundler/fetcher/downloader.rb +9 -6
  39. data/lib/bundler/fetcher/index.rb +0 -27
  40. data/lib/bundler/fetcher.rb +10 -17
  41. data/lib/bundler/friendly_errors.rb +5 -32
  42. data/lib/bundler/gem_helper.rb +28 -21
  43. data/lib/bundler/gem_version_promoter.rb +2 -2
  44. data/lib/bundler/index.rb +8 -12
  45. data/lib/bundler/injector.rb +12 -3
  46. data/lib/bundler/inline.rb +2 -1
  47. data/lib/bundler/installer/gem_installer.rb +4 -22
  48. data/lib/bundler/installer/parallel_installer.rb +36 -15
  49. data/lib/bundler/installer/standalone.rb +29 -9
  50. data/lib/bundler/installer.rb +8 -34
  51. data/lib/bundler/lazy_specification.rb +32 -20
  52. data/lib/bundler/lockfile_generator.rb +1 -1
  53. data/lib/bundler/lockfile_parser.rb +16 -45
  54. data/{man → lib/bundler/man}/bundle-add.1 +10 -2
  55. data/lib/bundler/man/bundle-add.1.ronn +7 -1
  56. data/{man → lib/bundler/man}/bundle-binstubs.1 +1 -1
  57. data/{man → lib/bundler/man}/bundle-cache.1 +1 -1
  58. data/{man → lib/bundler/man}/bundle-check.1 +1 -1
  59. data/{man → lib/bundler/man}/bundle-clean.1 +1 -1
  60. data/{man → lib/bundler/man}/bundle-config.1 +27 -19
  61. data/lib/bundler/man/bundle-config.1.ronn +33 -25
  62. data/{man → lib/bundler/man}/bundle-doctor.1 +1 -1
  63. data/{man → lib/bundler/man}/bundle-exec.1 +1 -1
  64. data/{man → lib/bundler/man}/bundle-gem.1 +14 -1
  65. data/lib/bundler/man/bundle-gem.1.ronn +16 -0
  66. data/{man → lib/bundler/man}/bundle-info.1 +1 -1
  67. data/{man → lib/bundler/man}/bundle-init.1 +1 -1
  68. data/{man → lib/bundler/man}/bundle-inject.1 +1 -1
  69. data/{man → lib/bundler/man}/bundle-install.1 +2 -2
  70. data/lib/bundler/man/bundle-install.1.ronn +2 -2
  71. data/{man → lib/bundler/man}/bundle-list.1 +1 -1
  72. data/{man → lib/bundler/man}/bundle-lock.1 +1 -1
  73. data/{man → lib/bundler/man}/bundle-open.1 +1 -1
  74. data/{man → lib/bundler/man}/bundle-outdated.1 +1 -1
  75. data/{man → lib/bundler/man}/bundle-platform.1 +1 -1
  76. data/{man → lib/bundler/man}/bundle-pristine.1 +1 -1
  77. data/{man → lib/bundler/man}/bundle-remove.1 +1 -1
  78. data/{man → lib/bundler/man}/bundle-show.1 +1 -1
  79. data/{man → lib/bundler/man}/bundle-update.1 +5 -5
  80. data/lib/bundler/man/bundle-update.1.ronn +5 -4
  81. data/{man → lib/bundler/man}/bundle-viz.1 +1 -1
  82. data/{man → lib/bundler/man}/bundle.1 +1 -1
  83. data/{man → lib/bundler/man}/gemfile.5 +28 -2
  84. data/lib/bundler/man/gemfile.5.ronn +9 -1
  85. data/{man → lib/bundler/man}/index.txt +0 -0
  86. data/lib/bundler/plugin/api/source.rb +22 -0
  87. data/lib/bundler/plugin/index.rb +4 -1
  88. data/lib/bundler/plugin/installer.rb +10 -10
  89. data/lib/bundler/plugin/source_list.rb +4 -0
  90. data/lib/bundler/plugin.rb +28 -8
  91. data/lib/bundler/process_lock.rb +1 -1
  92. data/lib/bundler/psyched_yaml.rb +1 -13
  93. data/lib/bundler/resolver/spec_group.rb +36 -48
  94. data/lib/bundler/resolver.rb +97 -151
  95. data/lib/bundler/retry.rb +1 -1
  96. data/lib/bundler/ruby_version.rb +1 -1
  97. data/lib/bundler/rubygems_ext.rb +46 -8
  98. data/lib/bundler/rubygems_gem_installer.rb +68 -1
  99. data/lib/bundler/rubygems_integration.rb +43 -60
  100. data/lib/bundler/runtime.rb +18 -11
  101. data/lib/bundler/self_manager.rb +168 -0
  102. data/lib/bundler/settings.rb +97 -21
  103. data/lib/bundler/setup.rb +2 -2
  104. data/lib/bundler/shared_helpers.rb +6 -21
  105. data/lib/bundler/source/git/git_proxy.rb +60 -53
  106. data/lib/bundler/source/git.rb +38 -18
  107. data/lib/bundler/source/metadata.rb +1 -5
  108. data/lib/bundler/source/path/installer.rb +3 -1
  109. data/lib/bundler/source/path.rb +3 -1
  110. data/lib/bundler/source/rubygems.rb +113 -100
  111. data/lib/bundler/source/rubygems_aggregate.rb +68 -0
  112. data/lib/bundler/source.rb +21 -0
  113. data/lib/bundler/source_list.rb +100 -62
  114. data/lib/bundler/source_map.rb +58 -0
  115. data/lib/bundler/spec_set.rb +21 -34
  116. data/lib/bundler/stub_specification.rb +8 -0
  117. data/lib/bundler/templates/Executable.bundler +7 -7
  118. data/lib/bundler/templates/Gemfile +0 -2
  119. data/lib/bundler/templates/gems.rb +0 -3
  120. data/lib/bundler/templates/newgem/CHANGELOG.md.tt +5 -0
  121. data/lib/bundler/templates/newgem/Gemfile.tt +5 -2
  122. data/lib/bundler/templates/newgem/README.md.tt +5 -3
  123. data/lib/bundler/templates/newgem/Rakefile.tt +15 -2
  124. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +15 -6
  125. data/lib/bundler/templates/newgem/newgem.gemspec.tt +18 -16
  126. data/lib/bundler/templates/newgem/rubocop.yml.tt +3 -0
  127. data/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
  128. data/lib/bundler/templates/newgem/standard.yml.tt +2 -0
  129. data/lib/bundler/templates/newgem/test/minitest/{newgem_test.rb.tt → test_newgem.rb.tt} +1 -1
  130. data/lib/bundler/ui/shell.rb +1 -1
  131. data/lib/bundler/vendor/.document +1 -0
  132. data/lib/bundler/vendor/connection_pool/LICENSE +20 -0
  133. data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +19 -21
  134. data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
  135. data/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +57 -0
  136. data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +39 -74
  137. data/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
  138. data/lib/bundler/vendor/molinillo/LICENSE +9 -0
  139. data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +7 -0
  140. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +11 -5
  141. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +2 -3
  142. data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +2 -2
  143. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +12 -1
  144. data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +11 -7
  145. data/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
  146. data/lib/bundler/vendor/thor/LICENSE.md +20 -0
  147. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +9 -7
  148. data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +1 -2
  149. data/lib/bundler/vendor/thor/lib/thor/actions.rb +7 -3
  150. data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +6 -0
  151. data/lib/bundler/vendor/thor/lib/thor/error.rb +10 -5
  152. data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +5 -1
  153. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +28 -9
  154. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +27 -6
  155. data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +5 -1
  156. data/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
  157. data/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
  158. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  159. data/lib/bundler/vendor/thor/lib/thor.rb +5 -6
  160. data/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +1 -1
  161. data/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
  162. data/lib/bundler/vendor/tsort/lib/tsort.rb +453 -0
  163. data/lib/bundler/vendor/uri/LICENSE.txt +22 -0
  164. data/lib/bundler/vendor/uri/lib/uri/common.rb +17 -80
  165. data/lib/bundler/vendor/uri/lib/uri/ftp.rb +0 -1
  166. data/lib/bundler/vendor/uri/lib/uri/generic.rb +5 -6
  167. data/lib/bundler/vendor/uri/lib/uri/http.rb +0 -1
  168. data/lib/bundler/vendor/uri/lib/uri/https.rb +0 -1
  169. data/lib/bundler/vendor/uri/lib/uri/ldap.rb +1 -1
  170. data/lib/bundler/vendor/uri/lib/uri/mailto.rb +0 -1
  171. data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +1 -14
  172. data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +1 -12
  173. data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
  174. data/lib/bundler/vendor/uri/lib/uri/ws.rb +84 -0
  175. data/lib/bundler/vendor/uri/lib/uri/wss.rb +22 -0
  176. data/lib/bundler/vendor/uri/lib/uri.rb +0 -1
  177. data/lib/bundler/vendored_tsort.rb +4 -0
  178. data/lib/bundler/version.rb +1 -1
  179. data/lib/bundler/worker.rb +19 -4
  180. data/lib/bundler.rb +29 -33
  181. metadata +54 -35
  182. data/lib/bundler/gemdeps.rb +0 -29
  183. data/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +0 -66
@@ -9,14 +9,18 @@ module Bundler
9
9
  end
10
10
 
11
11
  def run
12
- Bundler.ui.level = "error" if options[:quiet]
12
+ Bundler.ui.level = "warn" if options[:quiet]
13
+
14
+ update_bundler = options[:bundler]
15
+
16
+ Bundler.self_manager.update_bundler_and_restart_with_it_if_needed(update_bundler) if update_bundler
13
17
 
14
18
  Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.feature_flag.plugins?
15
19
 
16
20
  sources = Array(options[:source])
17
21
  groups = Array(options[:group]).map(&:to_sym)
18
22
 
19
- full_update = gems.empty? && sources.empty? && groups.empty? && !options[:ruby] && !options[:bundler]
23
+ full_update = gems.empty? && sources.empty? && groups.empty? && !options[:ruby] && !update_bundler
20
24
 
21
25
  if full_update && !options[:all]
22
26
  if Bundler.feature_flag.update_requires_all_flag?
@@ -27,9 +31,14 @@ module Bundler
27
31
  raise InvalidOption, "Cannot specify --all along with specific options."
28
32
  end
29
33
 
34
+ conservative = options[:conservative]
35
+
30
36
  if full_update
31
- # We're doing a full update
32
- Bundler.definition(true)
37
+ if conservative
38
+ Bundler.definition(:conservative => conservative)
39
+ else
40
+ Bundler.definition(true)
41
+ end
33
42
  else
34
43
  unless Bundler.default_lockfile.exist?
35
44
  raise GemfileLockNotFound, "This Bundle hasn't been installed yet. " \
@@ -43,8 +52,8 @@ module Bundler
43
52
  end
44
53
 
45
54
  Bundler.definition(:gems => gems, :sources => sources, :ruby => options[:ruby],
46
- :lock_shared_dependencies => options[:conservative],
47
- :bundler => options[:bundler])
55
+ :conservative => conservative,
56
+ :bundler => update_bundler)
48
57
  end
49
58
 
50
59
  Bundler::CLI::Common.configure_gem_version_promoter(Bundler.definition, options)
@@ -61,7 +70,7 @@ module Bundler
61
70
 
62
71
  if locked_gems = Bundler.definition.locked_gems
63
72
  previous_locked_info = locked_gems.specs.reduce({}) do |h, s|
64
- h[s.name] = { :spec => s, :version => s.version, :source => s.source.to_s }
73
+ h[s.name] = { :spec => s, :version => s.version, :source => s.source.identifier }
65
74
  h
66
75
  end
67
76
  end
@@ -90,7 +99,7 @@ module Bundler
90
99
  end
91
100
 
92
101
  locked_source = locked_info[:source]
93
- new_source = new_spec.source.to_s
102
+ new_source = new_spec.source.identifier
94
103
  next if locked_source != new_source
95
104
 
96
105
  new_version = new_spec.version
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"],
@@ -60,6 +61,8 @@ module Bundler
60
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,9 +117,7 @@ module Bundler
122
117
  else command = "bundle-#{cli}"
123
118
  end
124
119
 
125
- man_path = File.expand_path("../../../man", __FILE__)
126
- # man files are located under ruby's mandir with the default gems of bundler
127
- man_path = RbConfig::CONFIG["mandir"] unless File.directory?(man_path)
120
+ man_path = File.expand_path("man", __dir__)
128
121
  man_pages = Hash[Dir.glob(File.join(man_path, "**", "*")).grep(/.*\.\d*\Z/).collect do |f|
129
122
  [File.basename(f, ".*"), f]
130
123
  end]
@@ -134,8 +127,7 @@ module Bundler
134
127
  if Bundler.which("man") && man_path !~ %r{^file:/.+!/META-INF/jruby.home/.+}
135
128
  Kernel.exec "man #{man_page}"
136
129
  else
137
- fallback_man_path = File.expand_path("../man", __FILE__)
138
- puts File.read("#{fallback_man_path}/#{File.basename(man_page)}.ronn")
130
+ puts File.read("#{man_path}/#{File.basename(man_page)}.ronn")
139
131
  end
140
132
  elsif command_path = Bundler.which("bundler-#{cli}")
141
133
  Kernel.exec(command_path, "--help")
@@ -194,6 +186,7 @@ module Bundler
194
186
  method_option "install", :type => :boolean, :banner =>
195
187
  "Runs 'bundle install' after removing the gems from the Gemfile"
196
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")
197
190
  require_relative "cli/remove"
198
191
  Remove.new(gems, options).run
199
192
  end
@@ -311,39 +304,19 @@ module Bundler
311
304
  end
312
305
  end
313
306
 
314
- unless Bundler.feature_flag.bundler_3_mode?
315
- desc "show GEM [OPTIONS]", "Shows all gems that are part of the bundle, or the path to a given gem"
316
- long_desc <<-D
317
- Show lists the names and versions of all gems that are required by your Gemfile.
318
- Calling show with [GEM] will list the exact location of that gem on your machine.
319
- D
320
- method_option "paths", :type => :boolean,
321
- :banner => "List the paths of all gems that are required by your Gemfile."
322
- method_option "outdated", :type => :boolean,
323
- :banner => "Show verbose output including whether gems are outdated."
324
- def show(gem_name = nil)
325
- if ARGV[0] == "show"
326
- rest = ARGV[1..-1]
327
-
328
- if flag = rest.find{|arg| ["--verbose", "--outdated"].include?(arg) }
329
- Bundler::SharedHelpers.major_deprecation(2, "the `#{flag}` flag to `bundle show` was undocumented and will be removed without replacement")
330
- else
331
- new_command = rest.find {|arg| !arg.start_with?("--") } ? "info" : "list"
332
-
333
- new_arguments = rest.map do |arg|
334
- next arg if arg != "--paths"
335
- next "--path" if new_command == "info"
336
- end
337
-
338
- old_argv = ARGV.join(" ")
339
- new_argv = [new_command, *new_arguments.compact].join(" ")
340
-
341
- Bundler::SharedHelpers.major_deprecation(2, "use `bundle #{new_argv}` instead of `bundle #{old_argv}`")
342
- end
343
- end
344
- require_relative "cli/show"
345
- Show.new(options, gem_name).run
346
- 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
347
320
  end
348
321
 
349
322
  desc "list", "List all gems in the bundle"
@@ -360,6 +333,7 @@ module Bundler
360
333
 
361
334
  desc "info GEM [OPTIONS]", "Show information for the given gem"
362
335
  method_option "path", :type => :boolean, :banner => "Print full path to gem"
336
+ method_option "version", :type => :boolean, :banner => "Print gem version"
363
337
  def info(gem_name)
364
338
  require_relative "cli/info"
365
339
  Info.new(options, gem_name).run
@@ -395,8 +369,11 @@ module Bundler
395
369
  method_option "version", :aliases => "-v", :type => :string
396
370
  method_option "group", :aliases => "-g", :type => :string
397
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."
398
373
  method_option "git", :type => :string
374
+ method_option "github", :type => :string
399
375
  method_option "branch", :type => :string
376
+ method_option "ref", :type => :string
400
377
  method_option "skip-install", :type => :boolean, :banner =>
401
378
  "Adds gem to the Gemfile but does not install it"
402
379
  method_option "optimistic", :type => :boolean, :banner => "Adds optimistic declaration of version to gem"
@@ -478,6 +455,12 @@ module Bundler
478
455
  "do in future versions. Instead please use `bundle config set cache_all true`, " \
479
456
  "and stop using this flag" if ARGV.include?("--all")
480
457
 
458
+ SharedHelpers.major_deprecation 2,
459
+ "The `--path` flag is deprecated because its semantics are unclear. " \
460
+ "Use `bundle config cache_path` to configure the path of your cache of gems, " \
461
+ "and `bundle config path` to configure the path where your gems are installed, " \
462
+ "and stop using this flag" if ARGV.include?("--path")
463
+
481
464
  require_relative "cli/cache"
482
465
  Cache.new(options).run
483
466
  end
@@ -485,7 +468,7 @@ module Bundler
485
468
  map aliases_for("cache")
486
469
 
487
470
  desc "exec [OPTIONS]", "Run the command in context of the bundle"
488
- method_option :keep_file_descriptors, :type => :boolean, :default => false
471
+ method_option :keep_file_descriptors, :type => :boolean, :default => true
489
472
  method_option :gemfile, :type => :string, :required => false
490
473
  long_desc <<-D
491
474
  Exec runs a command, providing it access to the gems in the bundle. While using
@@ -493,6 +476,10 @@ module Bundler
493
476
  into the system wide RubyGems repository.
494
477
  D
495
478
  def exec(*args)
479
+ if ARGV.include?("--no-keep-file-descriptors")
480
+ 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")
481
+ end
482
+
496
483
  require_relative "cli/exec"
497
484
  Exec.new(options, args).run
498
485
  end
@@ -507,8 +494,8 @@ module Bundler
507
494
  By default, setting a configuration value sets it for all projects
508
495
  on the machine.
509
496
 
510
- If a global setting is superceded by local configuration, this command
511
- will show the current value, as well as any superceded values and
497
+ If a global setting is superseded by local configuration, this command
498
+ will show the current value, as well as any superseded values and
512
499
  where they were specified.
513
500
  D
514
501
  require_relative "cli/config"
@@ -571,7 +558,7 @@ module Bundler
571
558
  method_option :version, :type => :boolean, :default => false, :aliases => "-v", :desc => "Set to show each gem version."
572
559
  method_option :without, :type => :array, :default => [], :aliases => "-W", :banner => "GROUP[ GROUP...]", :desc => "Exclude gems that are part of the specified named group."
573
560
  def viz
574
- SharedHelpers.major_deprecation 2, "The `viz` command has been moved to the `bundle-viz` gem, see https://github.com/bundler/bundler-viz"
561
+ SharedHelpers.major_deprecation 2, "The `viz` command has been renamed to `graph` and moved to a plugin. See https://github.com/rubygems/bundler-graph"
575
562
  require_relative "cli/viz"
576
563
  Viz.new(options.dup).run
577
564
  end
@@ -589,10 +576,14 @@ module Bundler
589
576
  method_option :git, :type => :boolean, :default => true, :desc => "Initialize a git repo inside your library."
590
577
  method_option :mit, :type => :boolean, :desc => "Generate an MIT license file. Set a default with `bundle config set --global gem.mit true`."
591
578
  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`."
579
+ method_option :changelog, :type => :boolean, :desc => "Generate changelog file. Set a default with `bundle config set --global gem.changelog true`."
592
580
  method_option :test, :type => :string, :lazy_default => Bundler.settings["gem.test"] || "", :aliases => "-t", :banner => "Use the specified test framework for your library",
593
581
  :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)`."
594
582
  method_option :ci, :type => :string, :lazy_default => Bundler.settings["gem.ci"] || "",
595
583
  :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)`"
584
+ method_option :linter, :type => :string, :lazy_default => Bundler.settings["gem.linter"] || "",
585
+ :desc => "Add a linter and code formatter, either RuboCop or Standard. Set a default with `bundle config set --global gem.linter (rubocop|standard)`"
586
+ 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>`."
596
587
 
597
588
  def gem(name)
598
589
  end
@@ -818,17 +809,10 @@ module Bundler
818
809
 
819
810
  current = Gem::Version.new(VERSION)
820
811
  return if current >= latest
821
- latest_installed = Bundler.rubygems.find_name("bundler").map(&:version).max
822
-
823
- installation = "To install the latest version, run `gem install bundler#{" --pre" if latest.prerelease?}`"
824
- if latest_installed && latest_installed > current
825
- suggestion = "To update to the most recent installed version (#{latest_installed}), run `bundle update --bundler`"
826
- suggestion = "#{installation}\n#{suggestion}" if latest_installed < latest
827
- else
828
- suggestion = installation
829
- end
830
812
 
831
- Bundler.ui.warn "The latest bundler is #{latest}, but you are currently running #{current}.\n#{suggestion}"
813
+ Bundler.ui.warn \
814
+ "The latest bundler is #{latest}, but you are currently running #{current}.\n" \
815
+ "To update to the most recent version, run `bundle update --bundler`"
832
816
  rescue RuntimeError
833
817
  nil
834
818
  end
@@ -76,15 +76,6 @@ module Bundler
76
76
  end
77
77
  end
78
78
 
79
- def specific_dependency(name, version, platform)
80
- pattern = [version, platform].compact.join("-")
81
- return nil if pattern.empty?
82
-
83
- gem_lines = info_path(name).read
84
- gem_line = gem_lines[/^#{Regexp.escape(pattern)}\b.*/, 0]
85
- gem_line ? parse_gem(gem_line) : nil
86
- end
87
-
88
79
  private
89
80
 
90
81
  def lines(path)
@@ -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
@@ -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
- etag = (response["ETag"] || "").gsub(%r{\AW/}, "")
70
- if etag.length.zero? || etag_for(local_temp_path) == 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
@@ -80,11 +76,6 @@ module Bundler
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
@@ -20,6 +20,7 @@ module Bundler
20
20
  2.5
21
21
  2.6
22
22
  2.7
23
+ 3.0
23
24
  ].freeze
24
25
 
25
26
  KNOWN_MAJOR_VERSIONS = KNOWN_MINOR_VERSIONS.map {|v| v.split(".", 2).first }.uniq.freeze
@@ -64,19 +65,19 @@ module Bundler
64
65
  end
65
66
 
66
67
  def mswin?
67
- Bundler::WINDOWS
68
+ Gem.win_platform?
68
69
  end
69
70
 
70
71
  def mswin64?
71
- Bundler::WINDOWS && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mswin64" && Bundler.local_platform.cpu == "x64"
72
+ Gem.win_platform? && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mswin64" && Bundler.local_platform.cpu == "x64"
72
73
  end
73
74
 
74
75
  def mingw?
75
- Bundler::WINDOWS && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mingw32" && Bundler.local_platform.cpu != "x64"
76
+ Gem.win_platform? && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mingw32" && Bundler.local_platform.cpu != "x64"
76
77
  end
77
78
 
78
79
  def x64_mingw?
79
- Bundler::WINDOWS && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mingw32" && Bundler.local_platform.cpu == "x64"
80
+ Gem.win_platform? && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mingw32" && Bundler.local_platform.cpu == "x64"
80
81
  end
81
82
 
82
83
  (KNOWN_MINOR_VERSIONS + KNOWN_MAJOR_VERSIONS).each do |version|