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
@@ -44,7 +44,8 @@ module Bundler
44
44
  :test => options[:test],
45
45
  :ext => options[:ext],
46
46
  :exe => options[:exe],
47
- :bundler_version => bundler_dependency_version
47
+ :bundler_version => bundler_dependency_version,
48
+ :git_user_name => git_user_name.empty? ? "[USERNAME]" : git_user_name
48
49
  }
49
50
  ensure_safe_gem_name(name, constant_array)
50
51
 
@@ -126,7 +127,7 @@ module Bundler
126
127
 
127
128
  executables.each do |file|
128
129
  path = target.join(file)
129
- executable = (path.stat.mode | 0111)
130
+ executable = (path.stat.mode | 0o111)
130
131
  path.chmod(executable)
131
132
  end
132
133
 
@@ -1,33 +1,51 @@
1
1
  # frozen_string_literal: true
2
2
  module Bundler
3
3
  class CLI::Inject
4
- attr_reader :options, :name, :version, :gems
4
+ attr_reader :options, :name, :version, :group, :source, :gems
5
5
  def initialize(options, name, version, gems)
6
6
  @options = options
7
7
  @name = name
8
- @version = version
8
+ @version = version || last_version_number
9
+ @group = options[:group]
10
+ @source = options[:source]
9
11
  @gems = gems
10
12
  end
11
13
 
12
14
  def run
13
15
  # The required arguments allow Thor to give useful feedback when the arguments
14
16
  # are incorrect. This adds those first two arguments onto the list as a whole.
15
- gems.unshift(version).unshift(name)
17
+ gems.unshift(source).unshift(group).unshift(version).unshift(name)
16
18
 
17
19
  # Build an array of Dependency objects out of the arguments
18
20
  deps = []
19
- gems.each_slice(2) do |gem_name, gem_version|
20
- deps << Bundler::Dependency.new(gem_name, gem_version)
21
+ gems.each_slice(4) do |gem_name, gem_version, gem_group, gem_source|
22
+ ops = Gem::Requirement::OPS.map {|key, _val| key }
23
+ has_op = ops.any? {|op| gem_version.start_with? op }
24
+ gem_version = "~> #{gem_version}" unless has_op
25
+ deps << Bundler::Dependency.new(gem_name, gem_version, "group" => gem_group, "source" => gem_source)
21
26
  end
22
27
 
23
- added = Injector.inject(deps)
28
+ added = Injector.inject(deps, options)
24
29
 
25
30
  if added.any?
26
31
  Bundler.ui.confirm "Added to Gemfile:"
27
32
  Bundler.ui.confirm added.map {|g| " #{g}" }.join("\n")
28
33
  else
29
- Bundler.ui.confirm "All injected gems were already present in the Gemfile"
34
+ Bundler.ui.confirm "All gems were already present in the Gemfile"
30
35
  end
31
36
  end
37
+
38
+ private
39
+
40
+ def last_version_number
41
+ definition = Bundler.definition(true)
42
+ definition.resolve_remotely!
43
+ specs = definition.index[name].sort_by(&:version)
44
+ unless options[:pre]
45
+ specs.delete_if {|b| b.respond_to?(:version) && b.version.prerelease? }
46
+ end
47
+ spec = specs.last
48
+ spec.version.to_s
49
+ end
32
50
  end
33
51
  end
@@ -11,6 +11,8 @@ module Bundler
11
11
 
12
12
  warn_if_root
13
13
 
14
+ warn_if_outdated
15
+
14
16
  [:with, :without].each do |option|
15
17
  if options[option]
16
18
  options[option] = options[option].join(":").tr(" ", ":").split(":")
@@ -53,15 +55,17 @@ module Bundler
53
55
 
54
56
  Bundler::Fetcher.disable_endpoint = options["full-index"]
55
57
 
56
- # rubygems plugins sometimes hook into the gem install process
57
- Gem.load_env_plugins if Gem.respond_to?(:load_env_plugins)
58
+ if options["binstubs"]
59
+ Bundler::SharedHelpers.major_deprecation \
60
+ "the --binstubs option will be removed in favor of `bundle binstubs`"
61
+ end
58
62
 
59
- Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.settings[:plugins]
63
+ Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.feature_flag.plugins?
60
64
 
61
65
  definition = Bundler.definition
62
- definition.validate_ruby!
66
+ definition.validate_runtime!
63
67
 
64
- Installer.install(Bundler.root, definition, options)
68
+ installer = Installer.install(Bundler.root, definition, options)
65
69
  Bundler.load.cache if Bundler.app_cache.exist? && !options["no-cache"] && !Bundler.settings[:frozen]
66
70
 
67
71
  Bundler.ui.confirm "Bundle complete! #{dependencies_count_for(definition)}, #{gems_installed_for(definition)}."
@@ -69,14 +73,14 @@ module Bundler
69
73
 
70
74
  if Bundler.settings[:path]
71
75
  absolute_path = File.expand_path(Bundler.settings[:path])
72
- relative_path = absolute_path.sub(File.expand_path("."), ".")
76
+ relative_path = absolute_path.sub(File.expand_path(".") + File::SEPARATOR, "." + File::SEPARATOR)
73
77
  Bundler.ui.confirm "Bundled gems are installed into #{relative_path}."
74
78
  else
75
79
  Bundler.ui.confirm "Use `bundle show [gemname]` to see where a bundled gem is installed."
76
80
  end
77
81
 
78
82
  unless Bundler.settings["ignore_messages"]
79
- Installer.post_install_messages.to_a.each do |name, msg|
83
+ installer.post_install_messages.to_a.each do |name, msg|
80
84
  print_post_install_message(name, msg) unless Bundler.settings["ignore_messages.#{name}"]
81
85
  end
82
86
  end
@@ -114,6 +118,20 @@ module Bundler
114
118
  "application for all non-root users on this machine.", :wrap => true
115
119
  end
116
120
 
121
+ def warn_if_outdated
122
+ return if ENV["BUNDLE_POSTIT_TRAMPOLINING_VERSION"].nil?
123
+ installed_version = Gem::Version.new(ENV["BUNDLE_POSTIT_TRAMPOLINING_VERSION"].dup)
124
+ running_version = Gem::Version.new(Bundler::VERSION)
125
+ return if Gem::Requirement.new(installed_version).satisfied_by?(running_version)
126
+ if Bundler.settings[:warned_version].nil? || running_version > Gem::Version.new(Bundler.settings[:warned_version])
127
+ Bundler.settings[:warned_version] = running_version
128
+ Bundler.ui.warn "You're running Bundler #{installed_version} but this " \
129
+ "project uses #{running_version}. To update, run `bundle update " \
130
+ "--bundler`. You won't see this message again unless you upgrade " \
131
+ "to a newer version of Bundler.", :wrap => true
132
+ end
133
+ end
134
+
117
135
  def confirm_without_groups
118
136
  return unless Bundler.settings.without.any?
119
137
  require "bundler/cli/common"
@@ -1,4 +1,6 @@
1
1
  # frozen_string_literal: true
2
+ require "bundler/cli/common"
3
+
2
4
  module Bundler
3
5
  class CLI::Lock
4
6
  attr_reader :options
@@ -17,20 +19,31 @@ module Bundler
17
19
  ui = Bundler.ui
18
20
  Bundler.ui = UI::Silent.new if print
19
21
 
20
- gems = options[:update]
21
22
  Bundler::Fetcher.disable_endpoint = options["full-index"]
22
23
 
23
- if gems && !gems.empty?
24
- definition = Bundler.definition(:gems => gems)
25
- else
26
- definition = Bundler.definition(true)
24
+ update = options[:update]
25
+ update = { :gems => update, :lock_shared_dependencies => options[:conservative] } if update.is_a?(Array)
26
+ definition = Bundler.definition(update)
27
+
28
+ Bundler::CLI::Common.configure_gem_version_promoter(Bundler.definition, options) if options[:update]
29
+
30
+ options["remove-platform"].each do |platform|
31
+ definition.remove_platform(platform)
27
32
  end
28
33
 
29
- options["add-platform"].each do |platform|
30
- platform = Gem::Platform.new(platform)
34
+ options["add-platform"].each do |platform_string|
35
+ platform = Gem::Platform.new(platform_string)
36
+ if platform.to_a.compact == %w(unknown)
37
+ Bundler.ui.warn "The platform `#{platform_string}` is unknown to RubyGems " \
38
+ "and adding it will likely lead to resolution errors"
39
+ end
31
40
  definition.add_platform(platform)
32
41
  end
33
42
 
43
+ if definition.platforms.empty?
44
+ raise InvalidOption, "Removing all platforms from the bundle is not allowed"
45
+ end
46
+
34
47
  definition.resolve_remotely! unless options[:local]
35
48
 
36
49
  if print
@@ -4,6 +4,7 @@ require "bundler/cli/common"
4
4
  module Bundler
5
5
  class CLI::Outdated
6
6
  attr_reader :options, :gems
7
+
7
8
  def initialize(options, gems)
8
9
  @options = options
9
10
  @gems = gems
@@ -18,7 +19,7 @@ module Bundler
18
19
  Bundler::CLI::Common.select_spec(gem_name)
19
20
  end
20
21
 
21
- Bundler.definition.validate_ruby!
22
+ Bundler.definition.validate_runtime!
22
23
  current_specs = Bundler.ui.silence { Bundler.load.specs }
23
24
  current_dependencies = {}
24
25
  Bundler.ui.silence { Bundler.load.dependencies.each {|dep| current_dependencies[dep.name] = dep } }
@@ -30,7 +31,11 @@ module Bundler
30
31
  Bundler.definition(:gems => gems, :sources => sources)
31
32
  end
32
33
 
33
- definition_resolution = proc { options["local"] ? definition.resolve_with_cache! : definition.resolve_remotely! }
34
+ Bundler::CLI::Common.configure_gem_version_promoter(Bundler.definition, options)
35
+ # the patch level options don't work without strict also being true
36
+ strict = options[:strict] || Bundler::CLI::Common.patch_level_options(options).any?
37
+
38
+ definition_resolution = proc { options[:local] ? definition.resolve_with_cache! : definition.resolve_remotely! }
34
39
  if options[:parseable]
35
40
  Bundler.ui.silence(&definition_resolution)
36
41
  else
@@ -38,8 +43,9 @@ module Bundler
38
43
  end
39
44
 
40
45
  Bundler.ui.info ""
46
+ outdated_gems_by_groups = {}
47
+ outdated_gems_list = []
41
48
 
42
- out_count = 0
43
49
  # Loop through the current specs
44
50
  gemfile_specs, dependency_specs = current_specs.partition {|spec| current_dependencies.key? spec.name }
45
51
  [gemfile_specs.sort_by(&:name), dependency_specs.sort_by(&:name)].flatten.each do |current_spec|
@@ -47,7 +53,7 @@ module Bundler
47
53
 
48
54
  dependency = current_dependencies[current_spec.name]
49
55
 
50
- if options["strict"]
56
+ if strict
51
57
  active_spec = definition.specs.detect {|spec| spec.name == current_spec.name && spec.platform == current_spec.platform }
52
58
  else
53
59
  active_specs = definition.index[current_spec.name].select {|spec| spec.platform == current_spec.platform }.sort_by(&:version)
@@ -55,11 +61,11 @@ module Bundler
55
61
  active_spec = active_specs.delete_if {|b| b.respond_to?(:version) && b.version.prerelease? }
56
62
  end
57
63
  active_spec = active_specs.last
64
+ end
58
65
 
59
- if options[:major] || options[:minor] || options[:patch]
60
- update_present = update_present_via_semver_portions(current_spec, active_spec, options)
61
- active_spec = nil unless update_present
62
- end
66
+ if options["filter-major"] || options["filter-minor"] || options["filter-patch"]
67
+ update_present = update_present_via_semver_portions(current_spec, active_spec, options)
68
+ active_spec = nil unless update_present
63
69
  end
64
70
 
65
71
  next if active_spec.nil?
@@ -67,47 +73,101 @@ module Bundler
67
73
  gem_outdated = Gem::Version.new(active_spec.version) > Gem::Version.new(current_spec.version)
68
74
  git_outdated = current_spec.git_version != active_spec.git_version
69
75
  if gem_outdated || git_outdated
70
- unless options[:parseable]
71
- if out_count == 0
72
- if options["pre"]
73
- Bundler.ui.info "Outdated gems included in the bundle (including pre-releases):"
74
- else
75
- Bundler.ui.info "Outdated gems included in the bundle:"
76
- end
77
- end
78
- end
79
-
80
- spec_version = "#{active_spec.version}#{active_spec.git_version}"
81
- current_version = "#{current_spec.version}#{current_spec.git_version}"
82
- dependency_version = %(, requested #{dependency.requirement}) if dependency && dependency.specific?
83
-
76
+ groups = nil
84
77
  if dependency && !options[:parseable]
85
78
  groups = dependency.groups.join(", ")
86
- pl = (dependency.groups.length > 1) ? "s" : ""
87
- groups = " in group#{pl} \"#{groups}\""
88
79
  end
89
80
 
90
- spec_outdated_info = "#{active_spec.name} (newest #{spec_version}, installed #{current_version}#{dependency_version})"
91
- if options[:parseable]
92
- Bundler.ui.info spec_outdated_info.to_s.rstrip
93
- else
94
- Bundler.ui.info " * #{spec_outdated_info}#{groups}".rstrip
95
- end
81
+ outdated_gems_list << { :active_spec => active_spec,
82
+ :current_spec => current_spec,
83
+ :dependency => dependency,
84
+ :groups => groups }
96
85
 
97
- out_count += 1
86
+ outdated_gems_by_groups[groups] ||= []
87
+ outdated_gems_by_groups[groups] << { :active_spec => active_spec,
88
+ :current_spec => current_spec,
89
+ :dependency => dependency,
90
+ :groups => groups }
98
91
  end
92
+
99
93
  Bundler.ui.debug "from #{active_spec.loaded_from}"
100
94
  end
101
95
 
102
- if out_count.zero?
103
- Bundler.ui.info "Bundle up to date!\n" unless options[:parseable]
96
+ if outdated_gems_list.empty?
97
+ display_nothing_outdated_message
104
98
  else
99
+ unless options[:parseable]
100
+ if options[:pre]
101
+ Bundler.ui.info "Outdated gems included in the bundle (including pre-releases):"
102
+ else
103
+ Bundler.ui.info "Outdated gems included in the bundle:"
104
+ end
105
+ end
106
+
107
+ options_include_groups = [:group, :groups].select {|v| options.keys.include?(v.to_s) }
108
+ if options_include_groups.any?
109
+ ordered_groups = outdated_gems_by_groups.keys.compact.sort
110
+ [nil, ordered_groups].flatten.each do |groups|
111
+ gems = outdated_gems_by_groups[groups]
112
+ contains_group = if groups
113
+ groups.split(",").include?(options[:group])
114
+ else
115
+ options[:group] == "group"
116
+ end
117
+
118
+ next if (!options[:groups] && !contains_group) || gems.nil?
119
+
120
+ unless options[:parseable]
121
+ if groups
122
+ Bundler.ui.info "===== Group #{groups} ====="
123
+ else
124
+ Bundler.ui.info "===== Without group ====="
125
+ end
126
+ end
127
+
128
+ gems.each do |gem|
129
+ print_gem(gem[:current_spec], gem[:active_spec], gem[:dependency], groups, options_include_groups.any?)
130
+ end
131
+ end
132
+ else
133
+ outdated_gems_list.each do |gem|
134
+ print_gem(gem[:current_spec], gem[:active_spec], gem[:dependency], gem[:groups], options_include_groups.any?)
135
+ end
136
+ end
137
+
105
138
  exit 1
106
139
  end
107
140
  end
108
141
 
109
142
  private
110
143
 
144
+ def display_nothing_outdated_message
145
+ unless options[:parseable]
146
+ filter_options = options.keys & %w(filter-major filter-minor filter-patch)
147
+ if filter_options.any?
148
+ display = filter_options.map {|o| o.sub("filter-", "") }.join(" or ")
149
+ Bundler.ui.info "No #{display} updates to display.\n"
150
+ else
151
+ Bundler.ui.info "Bundle up to date!\n"
152
+ end
153
+ end
154
+ end
155
+
156
+ def print_gem(current_spec, active_spec, dependency, groups, options_include_groups)
157
+ spec_version = "#{active_spec.version}#{active_spec.git_version}"
158
+ current_version = "#{current_spec.version}#{current_spec.git_version}"
159
+ dependency_version = %(, requested #{dependency.requirement}) if dependency && dependency.specific?
160
+
161
+ spec_outdated_info = "#{active_spec.name} (newest #{spec_version}, installed #{current_version}#{dependency_version})"
162
+ if options[:parseable]
163
+ Bundler.ui.info spec_outdated_info.to_s.rstrip
164
+ elsif options_include_groups || !groups
165
+ Bundler.ui.info " * #{spec_outdated_info}".rstrip
166
+ else
167
+ Bundler.ui.info " * #{spec_outdated_info} in groups \"#{groups}\"".rstrip
168
+ end
169
+ end
170
+
111
171
  def check_for_deployment_mode
112
172
  if Bundler.settings[:frozen]
113
173
  error_message = "You are trying to check outdated gems in deployment mode. " \
@@ -123,16 +183,15 @@ module Bundler
123
183
  active_major = active_spec.version.segments.first
124
184
 
125
185
  update_present = false
186
+ update_present = active_major > current_major if options["filter-major"]
126
187
 
127
- update_present = active_major > current_major if options[:major]
128
-
129
- if !update_present && (options[:minor] || options[:patch]) && current_major == active_major
188
+ if !update_present && (options["filter-minor"] || options["filter-patch"]) && current_major == active_major
130
189
  current_minor = get_version_semver_portion_value(current_spec, 1)
131
190
  active_minor = get_version_semver_portion_value(active_spec, 1)
132
191
 
133
- update_present = active_minor > current_minor if options[:minor]
192
+ update_present = active_minor > current_minor if options["filter-minor"]
134
193
 
135
- if !update_present && options[:patch] && current_minor == active_minor
194
+ if !update_present && options["filter-patch"] && current_minor == active_minor
136
195
  current_patch = get_version_semver_portion_value(current_spec, 2)
137
196
  active_patch = get_version_semver_portion_value(active_spec, 2)
138
197
 
@@ -29,7 +29,7 @@ module Bundler
29
29
  output << "Your Gemfile specifies a Ruby version requirement:\n* #{ruby_version}"
30
30
 
31
31
  begin
32
- Bundler.definition.validate_ruby!
32
+ Bundler.definition.validate_runtime!
33
33
  output << "Your current platform satisfies the Ruby version requirement."
34
34
  rescue RubyVersionMismatch => e
35
35
  output << e.message
@@ -13,7 +13,7 @@ module Bundler
13
13
 
14
14
  def run
15
15
  Bundler.ui.silence do
16
- Bundler.definition.validate_ruby!
16
+ Bundler.definition.validate_runtime!
17
17
  Bundler.load.lock
18
18
  end
19
19
 
@@ -1,4 +1,6 @@
1
1
  # frozen_string_literal: true
2
+ require "bundler/cli/common"
3
+
2
4
  module Bundler
3
5
  class CLI::Update
4
6
  attr_reader :options, :gems
@@ -10,6 +12,8 @@ module Bundler
10
12
  def run
11
13
  Bundler.ui.level = "error" if options[:quiet]
12
14
 
15
+ Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.feature_flag.plugins?
16
+
13
17
  sources = Array(options[:source])
14
18
  groups = Array(options[:group]).map(&:to_sym)
15
19
 
@@ -25,7 +29,6 @@ module Bundler
25
29
  names = Bundler.locked_gems.specs.map(&:name)
26
30
  gems.each do |g|
27
31
  next if names.include?(g)
28
- require "bundler/cli/common"
29
32
  raise GemNotFound, Bundler::CLI::Common.gem_not_found_message(g, names)
30
33
  end
31
34
 
@@ -34,9 +37,12 @@ module Bundler
34
37
  gems.concat(specs.map(&:name))
35
38
  end
36
39
 
37
- Bundler.definition(:gems => gems, :sources => sources, :ruby => options[:ruby])
40
+ Bundler.definition(:gems => gems, :sources => sources, :ruby => options[:ruby],
41
+ :lock_shared_dependencies => options[:conservative])
38
42
  end
39
43
 
44
+ Bundler::CLI::Common.configure_gem_version_promoter(Bundler.definition, options)
45
+
40
46
  Bundler::Fetcher.disable_endpoint = options["full-index"]
41
47
 
42
48
  opts = options.dup
@@ -45,10 +51,7 @@ module Bundler
45
51
 
46
52
  Bundler.settings[:jobs] = opts["jobs"] if opts["jobs"]
47
53
 
48
- # rubygems plugins sometimes hook into the gem install process
49
- Gem.load_env_plugins if Gem.respond_to?(:load_env_plugins)
50
-
51
- Bundler.definition.validate_ruby!
54
+ Bundler.definition.validate_runtime!
52
55
  Installer.install Bundler.root, Bundler.definition, opts
53
56
  Bundler.load.cache if Bundler.app_cache.exist?
54
57