rubygems-update 2.6.7 → 2.6.8

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

Potentially problematic release.


This version of rubygems-update might be problematic. Click here for more details.

Files changed (136) hide show
  1. checksums.yaml +4 -4
  2. data/History.txt +11 -0
  3. data/Manifest.txt +10 -5
  4. data/bundler/CHANGELOG.md +108 -0
  5. data/bundler/DEVELOPMENT.md +6 -4
  6. data/bundler/ISSUES.md +17 -0
  7. data/bundler/README.md +2 -0
  8. data/bundler/exe/bundle +4 -6
  9. data/bundler/exe/bundle_ruby +2 -4
  10. data/bundler/exe/bundler +1 -19
  11. data/bundler/lib/bundler.rb +114 -44
  12. data/bundler/lib/bundler/cli.rb +90 -17
  13. data/bundler/lib/bundler/cli/binstubs.rb +4 -3
  14. data/bundler/lib/bundler/cli/cache.rb +1 -1
  15. data/bundler/lib/bundler/cli/check.rb +1 -1
  16. data/bundler/lib/bundler/cli/clean.rb +1 -1
  17. data/bundler/lib/bundler/cli/common.rb +13 -0
  18. data/bundler/lib/bundler/cli/console.rb +3 -0
  19. data/bundler/lib/bundler/cli/doctor.rb +93 -0
  20. data/bundler/lib/bundler/cli/exec.rb +18 -2
  21. data/bundler/lib/bundler/cli/gem.rb +3 -2
  22. data/bundler/lib/bundler/cli/inject.rb +25 -7
  23. data/bundler/lib/bundler/cli/install.rb +25 -7
  24. data/bundler/lib/bundler/cli/lock.rb +20 -7
  25. data/bundler/lib/bundler/cli/outdated.rb +97 -38
  26. data/bundler/lib/bundler/cli/platform.rb +1 -1
  27. data/bundler/lib/bundler/cli/show.rb +1 -1
  28. data/bundler/lib/bundler/cli/update.rb +9 -6
  29. data/bundler/lib/bundler/compact_index_client.rb +102 -0
  30. data/bundler/lib/bundler/compact_index_client/cache.rb +119 -0
  31. data/bundler/lib/bundler/compact_index_client/updater.rb +88 -0
  32. data/bundler/lib/bundler/current_ruby.rb +3 -3
  33. data/bundler/lib/bundler/definition.rb +210 -46
  34. data/bundler/lib/bundler/dependency.rb +1 -1
  35. data/bundler/lib/bundler/deployment.rb +6 -0
  36. data/bundler/lib/bundler/deprecate.rb +16 -0
  37. data/bundler/lib/bundler/dsl.rb +70 -24
  38. data/bundler/lib/bundler/endpoint_specification.rb +2 -0
  39. data/bundler/lib/bundler/env.rb +5 -1
  40. data/bundler/lib/bundler/environment_preserver.rb +1 -1
  41. data/bundler/lib/bundler/errors.rb +12 -1
  42. data/bundler/lib/bundler/feature_flag.rb +32 -0
  43. data/bundler/lib/bundler/fetcher.rb +3 -2
  44. data/bundler/lib/bundler/fetcher/base.rb +10 -0
  45. data/bundler/lib/bundler/fetcher/compact_index.rb +33 -12
  46. data/bundler/lib/bundler/fetcher/dependency.rb +2 -13
  47. data/bundler/lib/bundler/fetcher/downloader.rb +12 -1
  48. data/bundler/lib/bundler/friendly_errors.rb +9 -2
  49. data/bundler/lib/bundler/gem_helper.rb +3 -3
  50. data/bundler/lib/bundler/gem_helpers.rb +69 -1
  51. data/bundler/lib/bundler/gem_version_promoter.rb +175 -0
  52. data/bundler/lib/bundler/gemdeps.rb +28 -0
  53. data/bundler/lib/bundler/graph.rb +4 -25
  54. data/bundler/lib/bundler/index.rb +11 -2
  55. data/bundler/lib/bundler/injector.rb +12 -5
  56. data/bundler/lib/bundler/inline.rb +4 -4
  57. data/bundler/lib/bundler/installer.rb +25 -9
  58. data/bundler/lib/bundler/installer/gem_installer.rb +13 -15
  59. data/bundler/lib/bundler/installer/parallel_installer.rb +121 -99
  60. data/bundler/lib/bundler/lazy_specification.rb +28 -3
  61. data/bundler/lib/bundler/lockfile_parser.rb +27 -17
  62. data/bundler/lib/bundler/match_platform.rb +2 -1
  63. data/bundler/lib/bundler/mirror.rb +2 -2
  64. data/bundler/lib/bundler/plugin.rb +156 -32
  65. data/bundler/lib/bundler/plugin/api.rb +29 -5
  66. data/bundler/lib/bundler/plugin/api/source.rb +293 -0
  67. data/bundler/lib/bundler/plugin/dsl.rb +25 -1
  68. data/bundler/lib/bundler/plugin/index.rb +80 -13
  69. data/bundler/lib/bundler/plugin/installer.rb +6 -10
  70. data/bundler/lib/bundler/plugin/source_list.rb +4 -0
  71. data/bundler/lib/bundler/postit_trampoline.rb +56 -40
  72. data/bundler/lib/bundler/remote_specification.rb +5 -0
  73. data/bundler/lib/bundler/resolver.rb +64 -47
  74. data/bundler/lib/bundler/retry.rb +2 -1
  75. data/bundler/lib/bundler/ruby_version.rb +11 -4
  76. data/bundler/lib/bundler/rubygems_ext.rb +25 -3
  77. data/bundler/lib/bundler/rubygems_gem_installer.rb +54 -0
  78. data/bundler/lib/bundler/rubygems_integration.rb +148 -70
  79. data/bundler/lib/bundler/runtime.rb +27 -3
  80. data/bundler/lib/bundler/settings.rb +80 -17
  81. data/bundler/lib/bundler/setup.rb +7 -4
  82. data/bundler/lib/bundler/shared_helpers.rb +45 -8
  83. data/bundler/lib/bundler/source.rb +2 -1
  84. data/bundler/lib/bundler/source/gemspec.rb +4 -0
  85. data/bundler/lib/bundler/source/git.rb +9 -6
  86. data/bundler/lib/bundler/source/git/git_proxy.rb +37 -4
  87. data/bundler/lib/bundler/source/path.rb +10 -27
  88. data/bundler/lib/bundler/source/path/installer.rb +39 -11
  89. data/bundler/lib/bundler/source/rubygems.rb +3 -2
  90. data/bundler/lib/bundler/source_list.rb +28 -8
  91. data/bundler/lib/bundler/spec_set.rb +30 -15
  92. data/bundler/lib/bundler/templates/Executable.standalone +4 -2
  93. data/bundler/lib/bundler/templates/Gemfile +0 -1
  94. data/bundler/lib/bundler/templates/newgem/README.md.tt +1 -1
  95. data/bundler/lib/bundler/templates/newgem/bin/console.tt +1 -1
  96. data/bundler/lib/bundler/ui/shell.rb +25 -9
  97. data/bundler/lib/bundler/ui/silent.rb +10 -0
  98. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
  99. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +8 -2
  100. data/bundler/lib/bundler/vendor/postit/lib/postit.rb +5 -5
  101. data/bundler/lib/bundler/vendor/postit/lib/postit/environment.rb +3 -3
  102. data/bundler/lib/bundler/vendor/postit/lib/postit/installer.rb +1 -1
  103. data/bundler/lib/bundler/vendor/postit/lib/postit/parser.rb +1 -1
  104. data/bundler/lib/bundler/vendor/postit/lib/postit/setup.rb +4 -4
  105. data/bundler/lib/bundler/vendor/postit/lib/postit/version.rb +2 -2
  106. data/bundler/lib/bundler/version.rb +1 -1
  107. data/bundler/lib/bundler/yaml_serializer.rb +34 -11
  108. data/bundler/man/bundle-binstubs.ronn +29 -0
  109. data/bundler/man/bundle-config.ronn +33 -1
  110. data/bundler/man/bundle-exec.ronn +9 -0
  111. data/bundler/man/bundle-install.ronn +6 -41
  112. data/bundler/man/bundle-package.ronn +1 -1
  113. data/bundler/man/bundle.ronn +9 -8
  114. data/bundler/man/gemfile.5.ronn +1 -1
  115. data/lib/rubygems.rb +1 -1
  116. data/lib/rubygems/dependency.rb +7 -4
  117. data/lib/rubygems/request.rb +46 -0
  118. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb +7 -0
  119. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/action.rb +1 -1
  120. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +2 -2
  121. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +2 -2
  122. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +62 -0
  123. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -1
  124. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/log.rb +12 -1
  125. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/set_payload.rb +2 -2
  126. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/tag.rb +2 -2
  127. data/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb +1 -1
  128. data/lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb +11 -3
  129. data/test/rubygems/test_gem_request.rb +132 -0
  130. data/test/rubygems/test_gem_specification.rb +7 -0
  131. metadata +34 -29
  132. data/bundler/lib/bundler/environment.rb +0 -42
  133. data/bundler/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb +0 -79
  134. data/bundler/lib/bundler/vendor/compact_index_client/lib/compact_index_client/cache.rb +0 -98
  135. data/bundler/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb +0 -80
  136. data/bundler/lib/bundler/vendor/compact_index_client/lib/compact_index_client/version.rb +0 -4
@@ -12,6 +12,12 @@ module Bundler
12
12
  rescue Exception => e
13
13
  Bundler.ui = UI::Shell.new
14
14
  raise e
15
+ ensure
16
+ Bundler::SharedHelpers.print_major_deprecations!
17
+ end
18
+
19
+ def self.dispatch(*)
20
+ super {|i| i.send(:print_command) }
15
21
  end
16
22
 
17
23
  def initialize(*args)
@@ -29,14 +35,18 @@ module Bundler
29
35
  raise InvalidOption, e.message
30
36
  ensure
31
37
  self.options ||= {}
38
+ Bundler.settings.cli_flags_given = !options.empty?
39
+ unprinted_warnings = Bundler.ui.unprinted_warnings
32
40
  Bundler.ui = UI::Shell.new(options)
33
41
  Bundler.ui.level = "debug" if options["verbose"]
42
+ unprinted_warnings.each {|w| Bundler.ui.warn(w) }
34
43
 
35
44
  if ENV["RUBYGEMS_GEMDEPS"] && !ENV["RUBYGEMS_GEMDEPS"].empty?
36
45
  Bundler.ui.warn(
37
46
  "The RUBYGEMS_GEMDEPS environment variable is set. This enables RubyGems' " \
38
47
  "experimental Gemfile mode, which may conflict with Bundler and cause unexpected errors. " \
39
- "To remove this warning, unset RUBYGEMS_GEMDEPS.", :wrap => true)
48
+ "To remove this warning, unset RUBYGEMS_GEMDEPS.", :wrap => true
49
+ )
40
50
  end
41
51
  end
42
52
 
@@ -65,7 +75,8 @@ module Bundler
65
75
  bundle-package
66
76
  bundle-update
67
77
  bundle-platform
68
- gemfile.5)
78
+ gemfile.5
79
+ )
69
80
 
70
81
  if manpages.include?(command)
71
82
  root = File.expand_path("../man", __FILE__)
@@ -83,7 +94,7 @@ module Bundler
83
94
  end
84
95
 
85
96
  def self.handle_no_command_error(command, has_namespace = $thor_runner)
86
- if Bundler.settings[:plugins] && Bundler::Plugin.command?(command)
97
+ if Bundler.feature_flag.plugins? && Bundler::Plugin.command?(command)
87
98
  return Bundler::Plugin.exec_command(command, ARGV[1..-1])
88
99
  end
89
100
 
@@ -175,11 +186,9 @@ module Bundler
175
186
  map "i" => "install"
176
187
  def install
177
188
  require "bundler/cli/install"
178
- no_install = Bundler.settings[:no_install]
179
- Bundler.settings[:no_install] = false if no_install == true
180
- Install.new(options.dup).run
181
- ensure
182
- Bundler.settings[:no_install] = no_install unless no_install.nil?
189
+ Bundler.settings.temporary(:no_install => false) do
190
+ Install.new(options.dup).run
191
+ end
183
192
  end
184
193
 
185
194
  desc "update [OPTIONS]", "update the current environment"
@@ -206,6 +215,16 @@ module Bundler
206
215
  "Update ruby specified in Gemfile.lock"
207
216
  method_option "bundler", :type => :string, :lazy_default => "> 0.a", :banner =>
208
217
  "Update the locked version of bundler"
218
+ method_option "patch", :type => :boolean, :banner =>
219
+ "Prefer updating only to next patch version"
220
+ method_option "minor", :type => :boolean, :banner =>
221
+ "Prefer updating only to next minor version"
222
+ method_option "major", :type => :boolean, :banner =>
223
+ "Prefer updating to next major version (default)"
224
+ method_option "strict", :type => :boolean, :banner =>
225
+ "Do not allow any gem to be updated past latest --patch/--minor/--major"
226
+ method_option "conservative", :type => :boolean, :banner =>
227
+ "Use bundle install conservative update behavior and do not allowed shared dependencies to be updated."
209
228
  def update(*gems)
210
229
  require "bundler/cli/update"
211
230
  Update.new(options, gems).run
@@ -221,9 +240,11 @@ module Bundler
221
240
  method_option "outdated", :type => :boolean,
222
241
  :banner => "Show verbose output including whether gems are outdated."
223
242
  def show(gem_name = nil)
243
+ Bundler::SharedHelpers.major_deprecation("use `bundle show` instead of `bundle list`") if ARGV[0] == "list"
224
244
  require "bundler/cli/show"
225
245
  Show.new(options, gem_name).run
226
246
  end
247
+ # TODO: 2.0 remove `bundle list`
227
248
  map %w(list) => "show"
228
249
 
229
250
  desc "binstubs GEM [OPTIONS]", "Install the binstubs of the listed gem"
@@ -236,7 +257,7 @@ module Bundler
236
257
  "Overwrite existing binstubs if they exist"
237
258
  method_option "path", :type => :string, :lazy_default => "bin", :banner =>
238
259
  "Binstub destination directory (default bin)"
239
- method_option "standalone", :type => :array, :lazy_default => [], :banner =>
260
+ method_option "standalone", :type => :boolean, :banner =>
240
261
  "Make binstubs that can work without the Bundler runtime"
241
262
  def binstubs(*gems)
242
263
  require "bundler/cli/binstubs"
@@ -249,16 +270,26 @@ module Bundler
249
270
  in the given source. Calling outdated with [GEM [GEM]] will only check for newer
250
271
  versions of the given gems. Prerelease gems are ignored by default. If your gems
251
272
  are up to date, Bundler will exit with a status of 0. Otherwise, it will exit 1.
273
+
274
+ For more information on conservative resolution options (--major, --minor,
275
+ --patch, --strict) see documentation on the same options on the update command.
252
276
  D
277
+ method_option "group", :aliases => "--group", :type => :string, :banner => "List gems from a specific group"
278
+ method_option "groups", :aliases => "--groups", :type => :boolean, :banner => "List gems organized by groups"
253
279
  method_option "local", :type => :boolean, :banner =>
254
280
  "Do not attempt to fetch gems remotely and use the gem cache instead"
255
281
  method_option "pre", :type => :boolean, :banner => "Check for newer pre-release gems"
256
282
  method_option "source", :type => :array, :banner => "Check against a specific source"
257
283
  method_option "strict", :type => :boolean, :banner =>
258
284
  "Only list newer versions allowed by your Gemfile requirements"
259
- method_option "major", :type => :boolean, :banner => "Only list major newer versions"
260
- method_option "minor", :type => :boolean, :banner => "Only list minor newer versions"
261
- method_option "patch", :type => :boolean, :banner => "Only list patch newer versions"
285
+ method_option "update-strict", :type => :boolean, :banner =>
286
+ "Strict conservative resolution, do not allow any gem to be updated past latest --patch/--minor/--major"
287
+ method_option "minor", :type => :boolean, :banner => "Prefer updating only to next minor version"
288
+ method_option "major", :type => :boolean, :banner => "Prefer updating to next major version (default)"
289
+ method_option "patch", :type => :boolean, :banner => "Prefer updating only to next patch version"
290
+ method_option "filter-major", :type => :boolean, :banner => "Only list major newer versions"
291
+ method_option "filter-minor", :type => :boolean, :banner => "Only list minor newer versions"
292
+ method_option "filter-patch", :type => :boolean, :banner => "Only list patch newer versions"
262
293
  method_option "parseable", :aliases => "--porcelain", :type => :boolean, :banner =>
263
294
  "Use minimal formatting for more parseable output"
264
295
  def outdated(*gems)
@@ -338,6 +369,7 @@ module Bundler
338
369
 
339
370
  desc "console [GROUP]", "Opens an IRB session with the bundle pre-loaded"
340
371
  def console(group = nil)
372
+ # TODO: Remove for 2.0
341
373
  require "bundler/cli/console"
342
374
  Console.new(options, group).run
343
375
  end
@@ -417,12 +449,13 @@ module Bundler
417
449
 
418
450
  desc "inject GEM VERSION ...", "Add the named gem(s), with version requirements, to the resolved Gemfile"
419
451
  def inject(name, version, *gems)
452
+ SharedHelpers.major_deprecation "The `inject` command has been replaced by the `add` command"
420
453
  require "bundler/cli/inject"
421
454
  Inject.new(options, name, version, gems).run
422
455
  end
423
456
 
424
457
  desc "lock", "Creates a lockfile without installing"
425
- method_option "update", :type => :array, :lazy_default => [], :banner =>
458
+ method_option "update", :type => :array, :lazy_default => true, :banner =>
426
459
  "ignore the existing lockfile, update all gems by default, or update list of given gems"
427
460
  method_option "local", :type => :boolean, :default => false, :banner =>
428
461
  "do not attempt to fetch remote gemspecs and use the local gem cache only"
@@ -434,6 +467,18 @@ module Bundler
434
467
  "Fall back to using the single-file index of all gems"
435
468
  method_option "add-platform", :type => :array, :default => [], :banner =>
436
469
  "add a new platform to the lockfile"
470
+ method_option "remove-platform", :type => :array, :default => [], :banner =>
471
+ "remove a platform from the lockfile"
472
+ method_option "patch", :type => :boolean, :banner =>
473
+ "If updating, prefer updating only to next patch version"
474
+ method_option "minor", :type => :boolean, :banner =>
475
+ "If updating, prefer updating only to next minor version"
476
+ method_option "major", :type => :boolean, :banner =>
477
+ "If updating, prefer updating to next major version (default)"
478
+ method_option "strict", :type => :boolean, :banner =>
479
+ "If updating, do not allow any gem to be updated past latest --patch | --minor | --major"
480
+ method_option "conservative", :type => :boolean, :banner =>
481
+ "If updating, use bundle install conservative update behavior and do not allowed shared dependencies to be updated."
437
482
  def lock
438
483
  require "bundler/cli/lock"
439
484
  Lock.new(options).run
@@ -444,7 +489,22 @@ module Bundler
444
489
  Env.new.write($stdout)
445
490
  end
446
491
 
447
- if Bundler.settings[:plugins]
492
+ desc "doctor [OPTIONS]", "Checks the bundle for common problems"
493
+ long_desc <<-D
494
+ Doctor scans the OS dependencies of each of the gems requested in the Gemfile. If
495
+ missing dependencies are detected, Bundler prints them and exits status 1.
496
+ Otherwise, Bundler prints a success message and exits with a status of 0.
497
+ D
498
+ method_option "gemfile", :type => :string, :banner =>
499
+ "Use the specified gemfile instead of Gemfile"
500
+ method_option "quiet", :type => :boolean, :banner =>
501
+ "Only output warnings and errors."
502
+ def doctor
503
+ require "bundler/cli/doctor"
504
+ Doctor.new(options).run
505
+ end
506
+
507
+ if Bundler.feature_flag.plugins?
448
508
  require "bundler/cli/plugin"
449
509
  desc "plugin SUBCOMMAND ...ARGS", "manage the bundler plugins"
450
510
  subcommand "plugin", Plugin
@@ -465,10 +525,12 @@ module Bundler
465
525
  else
466
526
  args
467
527
  end
468
- elsif command.nil?
469
- abort("Could not find command \"#{args.join(" ")}\".")
470
- else
528
+ elsif help_used
529
+ args = args.dup
530
+ args.delete_at(help_used)
471
531
  ["help", command || args].flatten.compact
532
+ else
533
+ args
472
534
  end
473
535
  end
474
536
 
@@ -493,5 +555,16 @@ module Bundler
493
555
  Bundler.reset!
494
556
  end
495
557
  end
558
+
559
+ def print_command
560
+ return unless ENV["BUNDLE_POSTIT_TRAMPOLINING_VERSION"] || Bundler.ui.debug?
561
+ _, _, config = @_initializer
562
+ current_command = config[:current_command].name
563
+ return if %w(exec version check platform show help).include?(current_command)
564
+ command = ["bundle", current_command] + args
565
+ command << Thor::Options.to_switches(options)
566
+ command.reject!(&:empty?)
567
+ Bundler.ui.info "Running `#{command * " "}` with bundler #{Bundler::VERSION}"
568
+ end
496
569
  end
497
570
  end
@@ -10,7 +10,7 @@ module Bundler
10
10
  end
11
11
 
12
12
  def run
13
- Bundler.definition.validate_ruby!
13
+ Bundler.definition.validate_runtime!
14
14
  Bundler.settings[:bin] = options["path"] if options["path"]
15
15
  Bundler.settings[:bin] = nil if options["path"] && options["path"].empty?
16
16
  installer = Installer.new(Bundler.root, Bundler.definition)
@@ -21,10 +21,11 @@ module Bundler
21
21
  end
22
22
 
23
23
  gems.each do |gem_name|
24
- spec = installer.specs.find {|s| s.name == gem_name }
24
+ spec = Bundler.definition.specs.find {|s| s.name == gem_name }
25
25
  unless spec
26
26
  raise GemNotFound, Bundler::CLI::Common.gem_not_found_message(
27
- gem_name, Bundler.definition.specs)
27
+ gem_name, Bundler.definition.specs
28
+ )
28
29
  end
29
30
 
30
31
  if spec.name == "bundler"
@@ -7,7 +7,7 @@ module Bundler
7
7
  end
8
8
 
9
9
  def run
10
- Bundler.definition.validate_ruby!
10
+ Bundler.definition.validate_runtime!
11
11
  Bundler.definition.resolve_with_cache!
12
12
  setup_cache_all
13
13
  Bundler.settings[:cache_all_platforms] = options["all-platforms"] if options.key?("all-platforms")
@@ -15,7 +15,7 @@ module Bundler
15
15
 
16
16
  begin
17
17
  definition = Bundler.definition
18
- definition.validate_ruby!
18
+ definition.validate_runtime!
19
19
  not_installed = definition.missing_specs
20
20
  rescue GemNotFound, VersionConflict
21
21
  Bundler.ui.error "Bundler can't satisfy your Gemfile's dependencies."
@@ -8,7 +8,7 @@ module Bundler
8
8
  end
9
9
 
10
10
  def run
11
- require_path_or_force
11
+ require_path_or_force unless options[:"dry-run"]
12
12
  Bundler.load.clean(options[:"dry-run"])
13
13
  end
14
14
 
@@ -52,5 +52,18 @@ module Bundler
52
52
  message += "\nDid you mean #{suggestions}?" if suggestions
53
53
  message
54
54
  end
55
+
56
+ def self.configure_gem_version_promoter(definition, options)
57
+ patch_level = patch_level_options(options)
58
+ raise InvalidOption, "Provide only one of the following options: #{patch_level.join(", ")}" unless patch_level.length <= 1
59
+ definition.gem_version_promoter.tap do |gvp|
60
+ gvp.level = patch_level.first || :major
61
+ gvp.strict = options[:strict] || options["update-strict"]
62
+ end
63
+ end
64
+
65
+ def self.patch_level_options(options)
66
+ [:major, :minor, :patch].select {|v| options.keys.include?(v.to_s) }
67
+ end
55
68
  end
56
69
  end
@@ -8,6 +8,9 @@ module Bundler
8
8
  end
9
9
 
10
10
  def run
11
+ Bundler::SharedHelpers.major_deprecation "bundle console will be replaced " \
12
+ "by `bin/console` generated by `bundle gem <name>`"
13
+
11
14
  group ? Bundler.require(:default, *(group.split.map!(&:to_sym))) : Bundler.require
12
15
  ARGV.clear
13
16
 
@@ -0,0 +1,93 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rbconfig"
4
+
5
+ module Bundler
6
+ class CLI::Doctor
7
+ DARWIN_REGEX = /\s+(.+) \(compatibility /
8
+ LDD_REGEX = /\t\S+ => (\S+) \(\S+\)/
9
+
10
+ attr_reader :options
11
+
12
+ def initialize(options)
13
+ @options = options
14
+ end
15
+
16
+ def otool_available?
17
+ Bundler.which("otool")
18
+ end
19
+
20
+ def ldd_available?
21
+ Bundler.which("ldd")
22
+ end
23
+
24
+ def dylibs_darwin(path)
25
+ output = `/usr/bin/otool -L "#{path}"`.chomp
26
+ dylibs = output.split("\n")[1..-1].map {|l| l.match(DARWIN_REGEX).captures[0] }.uniq
27
+ # ignore @rpath and friends
28
+ dylibs.reject {|dylib| dylib.start_with? "@" }
29
+ end
30
+
31
+ def dylibs_ldd(path)
32
+ output = `/usr/bin/ldd "#{path}"`.chomp
33
+ output.split("\n").map do |l|
34
+ match = l.match(LDD_REGEX)
35
+ next if match.nil?
36
+ match.captures[0]
37
+ end.compact
38
+ end
39
+
40
+ def dylibs(path)
41
+ case RbConfig::CONFIG["host_os"]
42
+ when /darwin/
43
+ return [] unless otool_available?
44
+ dylibs_darwin(path)
45
+ when /(linux|solaris|bsd)/
46
+ return [] unless ldd_available?
47
+ dylibs_ldd(path)
48
+ else # Windows, etc.
49
+ Bundler.ui.warn("Dynamic library check not supported on this platform.")
50
+ []
51
+ end
52
+ end
53
+
54
+ def bundles_for_gem(spec)
55
+ Dir.glob("#{spec.full_gem_path}/**/*.bundle")
56
+ end
57
+
58
+ def check!
59
+ require "bundler/cli/check"
60
+ Bundler::CLI::Check.new({}).run
61
+ end
62
+
63
+ def run
64
+ Bundler.ui.level = "error" if options[:quiet]
65
+ check!
66
+
67
+ definition = Bundler.definition
68
+ broken_links = {}
69
+
70
+ definition.specs.each do |spec|
71
+ bundles_for_gem(spec).each do |bundle|
72
+ bad_paths = dylibs(bundle).select {|f| !File.exist?(f) }
73
+ if bad_paths.any?
74
+ broken_links[spec] ||= []
75
+ broken_links[spec].concat(bad_paths)
76
+ end
77
+ end
78
+ end
79
+
80
+ if broken_links.any?
81
+ message = "The following gems are missing OS dependencies:"
82
+ broken_links.map do |spec, paths|
83
+ paths.uniq.map do |path|
84
+ "\n * #{spec.name}: #{path}"
85
+ end
86
+ end.flatten.sort.each {|m| message += m }
87
+ raise ProductionError, message
88
+ else
89
+ Bundler.ui.info "No issues found with the installed bundle"
90
+ end
91
+ end
92
+ end
93
+ end
@@ -5,6 +5,8 @@ module Bundler
5
5
  class CLI::Exec
6
6
  attr_reader :options, :args, :cmd
7
7
 
8
+ RESERVED_SIGNALS = %w(SEGV BUS ILL FPE VTALRM KILL STOP).freeze
9
+
8
10
  def initialize(options, args)
9
11
  @options = options
10
12
  @cmd = args.shift
@@ -21,9 +23,15 @@ module Bundler
21
23
  validate_cmd!
22
24
  SharedHelpers.set_bundle_environment
23
25
  if bin_path = Bundler.which(cmd)
24
- return kernel_load(bin_path, *args) if ruby_shebang?(bin_path)
26
+ if !Bundler.settings[:disable_exec_load] && ruby_shebang?(bin_path)
27
+ return kernel_load(bin_path, *args)
28
+ end
25
29
  # First, try to exec directly to something in PATH
26
- kernel_exec([bin_path, cmd], *args)
30
+ if Bundler.current_ruby.jruby_18?
31
+ kernel_exec(bin_path, *args)
32
+ else
33
+ kernel_exec([bin_path, cmd], *args)
34
+ end
27
35
  else
28
36
  # exec using the given command
29
37
  kernel_exec(cmd, *args)
@@ -57,9 +65,12 @@ module Bundler
57
65
  args.pop if args.last.is_a?(Hash)
58
66
  ARGV.replace(args)
59
67
  $0 = file
68
+ Process.setproctitle(process_title(file, args)) if Process.respond_to?(:setproctitle)
60
69
  ui = Bundler.ui
61
70
  Bundler.ui = nil
62
71
  require "bundler/setup"
72
+ signals = Signal.list.keys - RESERVED_SIGNALS
73
+ signals.each {|s| trap(s, "DEFAULT") }
63
74
  Kernel.load(file)
64
75
  rescue SystemExit
65
76
  raise
@@ -70,9 +81,14 @@ module Bundler
70
81
  abort "#{e.class}: #{e.message}\n #{backtrace.join("\n ")}"
71
82
  end
72
83
 
84
+ def process_title(file, args)
85
+ "#{file} #{args.join(" ")}".strip
86
+ end
87
+
73
88
  def ruby_shebang?(file)
74
89
  possibilities = [
75
90
  "#!/usr/bin/env ruby\n",
91
+ "#!/usr/bin/env jruby\n",
76
92
  "#!#{Gem.ruby}\n",
77
93
  ]
78
94
  first_line = File.open(file, "rb") {|f| f.read(possibilities.map(&:size).max) }