bundler 2.1.4 → 2.2.18

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 (227) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1790 -1430
  3. data/README.md +6 -8
  4. data/bundler.gemspec +5 -6
  5. data/exe/bundle +3 -0
  6. data/lib/bundler/build_metadata.rb +3 -11
  7. data/lib/bundler/cli/add.rb +1 -1
  8. data/lib/bundler/cli/binstubs.rb +6 -2
  9. data/lib/bundler/cli/cache.rb +2 -7
  10. data/lib/bundler/cli/clean.rb +1 -1
  11. data/lib/bundler/cli/common.rb +29 -2
  12. data/lib/bundler/cli/console.rb +1 -1
  13. data/lib/bundler/cli/doctor.rb +1 -1
  14. data/lib/bundler/cli/exec.rb +4 -4
  15. data/lib/bundler/cli/fund.rb +36 -0
  16. data/lib/bundler/cli/gem.rb +129 -28
  17. data/lib/bundler/cli/info.rb +15 -4
  18. data/lib/bundler/cli/init.rb +2 -2
  19. data/lib/bundler/cli/inject.rb +1 -1
  20. data/lib/bundler/cli/install.rb +13 -11
  21. data/lib/bundler/cli/issue.rb +2 -2
  22. data/lib/bundler/cli/list.rb +12 -10
  23. data/lib/bundler/cli/outdated.rb +94 -76
  24. data/lib/bundler/cli/plugin.rb +10 -0
  25. data/lib/bundler/cli/pristine.rb +5 -0
  26. data/lib/bundler/cli/show.rb +1 -1
  27. data/lib/bundler/cli/update.rb +3 -1
  28. data/lib/bundler/cli.rb +72 -56
  29. data/lib/bundler/compact_index_client/cache.rb +6 -14
  30. data/lib/bundler/compact_index_client/gem_parser.rb +28 -0
  31. data/lib/bundler/compact_index_client/updater.rb +13 -17
  32. data/lib/bundler/compact_index_client.rb +1 -1
  33. data/lib/bundler/current_ruby.rb +1 -0
  34. data/lib/bundler/definition.rb +117 -188
  35. data/lib/bundler/dep_proxy.rb +16 -9
  36. data/lib/bundler/dependency.rb +3 -10
  37. data/lib/bundler/dsl.rb +40 -33
  38. data/lib/bundler/endpoint_specification.rb +1 -1
  39. data/lib/bundler/env.rb +1 -1
  40. data/lib/bundler/environment_preserver.rb +26 -2
  41. data/lib/bundler/errors.rb +1 -0
  42. data/lib/bundler/feature_flag.rb +0 -6
  43. data/lib/bundler/fetcher/base.rb +1 -1
  44. data/lib/bundler/fetcher/compact_index.rb +1 -1
  45. data/lib/bundler/fetcher/downloader.rb +9 -5
  46. data/lib/bundler/fetcher/index.rb +3 -4
  47. data/lib/bundler/fetcher.rb +5 -4
  48. data/lib/bundler/friendly_errors.rb +22 -13
  49. data/lib/bundler/gem_helper.rb +51 -18
  50. data/lib/bundler/gem_helpers.rb +36 -25
  51. data/lib/bundler/gem_version_promoter.rb +4 -4
  52. data/lib/bundler/graph.rb +1 -1
  53. data/lib/bundler/index.rb +13 -9
  54. data/lib/bundler/injector.rb +23 -5
  55. data/lib/bundler/inline.rb +3 -2
  56. data/lib/bundler/installer/gem_installer.rb +3 -3
  57. data/lib/bundler/installer/parallel_installer.rb +46 -25
  58. data/lib/bundler/installer/standalone.rb +17 -2
  59. data/lib/bundler/installer.rb +37 -49
  60. data/lib/bundler/lazy_specification.rb +45 -25
  61. data/lib/bundler/lockfile_generator.rb +1 -1
  62. data/lib/bundler/lockfile_parser.rb +4 -14
  63. data/lib/bundler/man/.document +1 -0
  64. data/{man → lib/bundler/man}/bundle-add.1 +1 -1
  65. data/{man/bundle-add.ronn → lib/bundler/man/bundle-add.1.ronn} +0 -0
  66. data/{man → lib/bundler/man}/bundle-binstubs.1 +5 -3
  67. data/{man/bundle-binstubs.ronn → lib/bundler/man/bundle-binstubs.1.ronn} +2 -4
  68. data/{man → lib/bundler/man}/bundle-cache.1 +1 -1
  69. data/{man/bundle-cache.ronn → lib/bundler/man/bundle-cache.1.ronn} +0 -0
  70. data/{man → lib/bundler/man}/bundle-check.1 +1 -1
  71. data/{man/bundle-check.ronn → lib/bundler/man/bundle-check.1.ronn} +0 -0
  72. data/{man → lib/bundler/man}/bundle-clean.1 +1 -1
  73. data/{man/bundle-clean.ronn → lib/bundler/man/bundle-clean.1.ronn} +0 -0
  74. data/{man → lib/bundler/man}/bundle-config.1 +40 -38
  75. data/{man/bundle-config.ronn → lib/bundler/man/bundle-config.1.ronn} +50 -50
  76. data/{man → lib/bundler/man}/bundle-doctor.1 +1 -1
  77. data/{man/bundle-doctor.ronn → lib/bundler/man/bundle-doctor.1.ronn} +0 -0
  78. data/{man → lib/bundler/man}/bundle-exec.1 +1 -1
  79. data/{man/bundle-exec.ronn → lib/bundler/man/bundle-exec.1.ronn} +0 -0
  80. data/{man → lib/bundler/man}/bundle-gem.1 +25 -3
  81. data/{man/bundle-gem.ronn → lib/bundler/man/bundle-gem.1.ronn} +30 -7
  82. data/{man → lib/bundler/man}/bundle-info.1 +1 -1
  83. data/{man/bundle-info.ronn → lib/bundler/man/bundle-info.1.ronn} +0 -0
  84. data/{man → lib/bundler/man}/bundle-init.1 +1 -1
  85. data/{man/bundle-init.ronn → lib/bundler/man/bundle-init.1.ronn} +0 -0
  86. data/{man → lib/bundler/man}/bundle-inject.1 +1 -1
  87. data/{man/bundle-inject.ronn → lib/bundler/man/bundle-inject.1.ronn} +0 -0
  88. data/{man → lib/bundler/man}/bundle-install.1 +30 -3
  89. data/{man/bundle-install.ronn → lib/bundler/man/bundle-install.1.ronn} +25 -3
  90. data/{man → lib/bundler/man}/bundle-list.1 +7 -7
  91. data/{man/bundle-list.ronn → lib/bundler/man/bundle-list.1.ronn} +6 -6
  92. data/{man → lib/bundler/man}/bundle-lock.1 +1 -1
  93. data/{man/bundle-lock.ronn → lib/bundler/man/bundle-lock.1.ronn} +0 -0
  94. data/{man → lib/bundler/man}/bundle-open.1 +1 -1
  95. data/{man/bundle-open.ronn → lib/bundler/man/bundle-open.1.ronn} +0 -0
  96. data/{man → lib/bundler/man}/bundle-outdated.1 +1 -1
  97. data/{man/bundle-outdated.ronn → lib/bundler/man/bundle-outdated.1.ronn} +0 -0
  98. data/{man → lib/bundler/man}/bundle-platform.1 +1 -1
  99. data/{man/bundle-platform.ronn → lib/bundler/man/bundle-platform.1.ronn} +0 -0
  100. data/{man → lib/bundler/man}/bundle-pristine.1 +1 -1
  101. data/{man/bundle-pristine.ronn → lib/bundler/man/bundle-pristine.1.ronn} +0 -0
  102. data/{man → lib/bundler/man}/bundle-remove.1 +1 -1
  103. data/{man/bundle-remove.ronn → lib/bundler/man/bundle-remove.1.ronn} +0 -0
  104. data/{man → lib/bundler/man}/bundle-show.1 +1 -1
  105. data/{man/bundle-show.ronn → lib/bundler/man/bundle-show.1.ronn} +0 -0
  106. data/{man → lib/bundler/man}/bundle-update.1 +1 -1
  107. data/{man/bundle-update.ronn → lib/bundler/man/bundle-update.1.ronn} +0 -0
  108. data/{man → lib/bundler/man}/bundle-viz.1 +1 -1
  109. data/{man/bundle-viz.ronn → lib/bundler/man/bundle-viz.1.ronn} +0 -0
  110. data/{man → lib/bundler/man}/bundle.1 +1 -1
  111. data/{man/bundle.ronn → lib/bundler/man/bundle.1.ronn} +0 -0
  112. data/{man → lib/bundler/man}/gemfile.5 +4 -4
  113. data/{man → lib/bundler/man}/gemfile.5.ronn +4 -4
  114. data/{man → lib/bundler/man}/index.txt +0 -0
  115. data/lib/bundler/mirror.rb +2 -2
  116. data/lib/bundler/plugin/api/source.rb +22 -1
  117. data/lib/bundler/plugin/dsl.rb +1 -1
  118. data/lib/bundler/plugin/index.rb +10 -1
  119. data/lib/bundler/plugin/installer/rubygems.rb +1 -1
  120. data/lib/bundler/plugin/installer.rb +9 -11
  121. data/lib/bundler/plugin/source_list.rb +5 -1
  122. data/lib/bundler/plugin.rb +33 -7
  123. data/lib/bundler/psyched_yaml.rb +0 -15
  124. data/lib/bundler/remote_specification.rb +5 -2
  125. data/lib/bundler/resolver/spec_group.rb +56 -53
  126. data/lib/bundler/resolver.rb +88 -115
  127. data/lib/bundler/retry.rb +2 -2
  128. data/lib/bundler/ruby_version.rb +1 -1
  129. data/lib/bundler/rubygems_ext.rb +71 -11
  130. data/lib/bundler/rubygems_gem_installer.rb +50 -9
  131. data/lib/bundler/rubygems_integration.rb +25 -60
  132. data/lib/bundler/runtime.rb +4 -14
  133. data/lib/bundler/settings.rb +107 -55
  134. data/lib/bundler/shared_helpers.rb +3 -3
  135. data/lib/bundler/similarity_detector.rb +1 -1
  136. data/lib/bundler/source/git/git_proxy.rb +82 -80
  137. data/lib/bundler/source/git.rb +24 -22
  138. data/lib/bundler/source/metadata.rb +0 -4
  139. data/lib/bundler/source/path/installer.rb +10 -10
  140. data/lib/bundler/source/path.rb +10 -4
  141. data/lib/bundler/source/rubygems/remote.rb +1 -1
  142. data/lib/bundler/source/rubygems.rb +60 -28
  143. data/lib/bundler/source/rubygems_aggregate.rb +64 -0
  144. data/lib/bundler/source.rb +16 -1
  145. data/lib/bundler/source_list.rb +52 -28
  146. data/lib/bundler/source_map.rb +58 -0
  147. data/lib/bundler/spec_set.rb +29 -17
  148. data/lib/bundler/stub_specification.rb +25 -7
  149. data/lib/bundler/templates/Gemfile +1 -1
  150. data/lib/bundler/templates/gems.rb +1 -1
  151. data/lib/bundler/templates/newgem/CHANGELOG.md.tt +5 -0
  152. data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +57 -47
  153. data/lib/bundler/templates/newgem/Gemfile.tt +9 -1
  154. data/lib/bundler/templates/newgem/README.md.tt +6 -5
  155. data/lib/bundler/templates/newgem/Rakefile.tt +19 -5
  156. data/lib/bundler/templates/newgem/bin/console.tt +1 -0
  157. data/lib/bundler/templates/newgem/circleci/config.yml.tt +13 -0
  158. data/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +2 -0
  159. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +16 -0
  160. data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +9 -0
  161. data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +2 -0
  162. data/lib/bundler/templates/newgem/lib/newgem.rb.tt +4 -2
  163. data/lib/bundler/templates/newgem/newgem.gemspec.tt +15 -7
  164. data/lib/bundler/templates/newgem/rubocop.yml.tt +13 -0
  165. data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +2 -0
  166. data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -1
  167. data/lib/bundler/templates/newgem/test/{newgem_test.rb.tt → minitest/newgem_test.rb.tt} +2 -0
  168. data/lib/bundler/templates/newgem/test/{test_helper.rb.tt → minitest/test_helper.rb.tt} +2 -0
  169. data/lib/bundler/templates/newgem/test/test-unit/newgem_test.rb.tt +15 -0
  170. data/lib/bundler/templates/newgem/test/test-unit/test_helper.rb.tt +6 -0
  171. data/lib/bundler/ui/shell.rb +5 -5
  172. data/lib/bundler/uri_credentials_filter.rb +3 -1
  173. data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +7 -0
  174. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +2 -2
  175. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +11 -5
  176. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +34 -2
  177. data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +3 -3
  178. data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
  179. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +12 -1
  180. data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +49 -47
  181. data/lib/bundler/vendor/molinillo/lib/molinillo.rb +0 -1
  182. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +82 -189
  183. data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +2 -1
  184. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +4 -2
  185. data/lib/bundler/vendor/thor/lib/thor/actions.rb +1 -1
  186. data/lib/bundler/vendor/thor/lib/thor/base.rb +9 -0
  187. data/lib/bundler/vendor/thor/lib/thor/error.rb +1 -1
  188. data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +5 -1
  189. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +9 -8
  190. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +5 -2
  191. data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +5 -1
  192. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  193. data/lib/bundler/vendor/thor/lib/thor.rb +5 -13
  194. data/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +154 -0
  195. data/lib/bundler/vendored_persistent.rb +0 -7
  196. data/lib/bundler/vendored_tmpdir.rb +4 -0
  197. data/lib/bundler/version.rb +1 -1
  198. data/lib/bundler/worker.rb +1 -1
  199. data/lib/bundler/yaml_serializer.rb +1 -1
  200. data/lib/bundler.rb +34 -9
  201. metadata +77 -86
  202. data/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +0 -26
  203. data/man/bundle-add.1.txt +0 -58
  204. data/man/bundle-binstubs.1.txt +0 -48
  205. data/man/bundle-cache.1.txt +0 -78
  206. data/man/bundle-check.1.txt +0 -33
  207. data/man/bundle-clean.1.txt +0 -26
  208. data/man/bundle-config.1.txt +0 -528
  209. data/man/bundle-doctor.1.txt +0 -44
  210. data/man/bundle-exec.1.txt +0 -178
  211. data/man/bundle-gem.1.txt +0 -91
  212. data/man/bundle-info.1.txt +0 -21
  213. data/man/bundle-init.1.txt +0 -34
  214. data/man/bundle-inject.1.txt +0 -32
  215. data/man/bundle-install.1.txt +0 -401
  216. data/man/bundle-list.1.txt +0 -43
  217. data/man/bundle-lock.1.txt +0 -93
  218. data/man/bundle-open.1.txt +0 -29
  219. data/man/bundle-outdated.1.txt +0 -131
  220. data/man/bundle-platform.1.txt +0 -57
  221. data/man/bundle-pristine.1.txt +0 -44
  222. data/man/bundle-remove.1.txt +0 -34
  223. data/man/bundle-show.1.txt +0 -27
  224. data/man/bundle-update.1.txt +0 -390
  225. data/man/bundle-viz.1.txt +0 -39
  226. data/man/bundle.1.txt +0 -116
  227. data/man/gemfile.5.txt +0 -649
@@ -12,8 +12,6 @@ module Bundler
12
12
 
13
13
  warn_if_root
14
14
 
15
- normalize_groups
16
-
17
15
  Bundler::SharedHelpers.set_env "RB_USER_INSTALL", "1" if Bundler::FREEBSD
18
16
 
19
17
  # Disable color in deployment mode
@@ -55,7 +53,7 @@ module Bundler
55
53
 
56
54
  if options["binstubs"]
57
55
  Bundler::SharedHelpers.major_deprecation 2,
58
- "The --binstubs option will be removed in favor of `bundle binstubs`"
56
+ "The --binstubs option will be removed in favor of `bundle binstubs --all`"
59
57
  end
60
58
 
61
59
  Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.feature_flag.plugins?
@@ -84,6 +82,8 @@ module Bundler
84
82
  require_relative "clean"
85
83
  Bundler::CLI::Clean.new(options).run
86
84
  end
85
+
86
+ Bundler::CLI::Common.output_fund_metadata_summary
87
87
  rescue GemNotFound, VersionConflict => e
88
88
  if options[:local] && Bundler.app_cache.exist?
89
89
  Bundler.ui.warn "Some gems seem to be missing from your #{Bundler.settings.app_cache_path} directory."
@@ -102,7 +102,7 @@ module Bundler
102
102
  raise e
103
103
  end
104
104
 
105
- private
105
+ private
106
106
 
107
107
  def warn_if_root
108
108
  return if Bundler.settings[:silence_root_warning] || Bundler::WINDOWS || !Process.uid.zero?
@@ -165,6 +165,14 @@ module Bundler
165
165
 
166
166
  options[:with] = with
167
167
  options[:without] = without
168
+
169
+ unless Bundler.settings[:without] == options[:without] && Bundler.settings[:with] == options[:with]
170
+ # need to nil them out first to get around validation for backwards compatibility
171
+ Bundler.settings.set_command_option :without, nil
172
+ Bundler.settings.set_command_option :with, nil
173
+ Bundler.settings.set_command_option :without, options[:without] - options[:with]
174
+ Bundler.settings.set_command_option :with, options[:with]
175
+ end
168
176
  end
169
177
 
170
178
  def normalize_settings
@@ -191,13 +199,7 @@ module Bundler
191
199
 
192
200
  Bundler.settings.set_command_option_if_given :clean, options["clean"]
193
201
 
194
- unless Bundler.settings[:without] == options[:without] && Bundler.settings[:with] == options[:with]
195
- # need to nil them out first to get around validation for backwards compatibility
196
- Bundler.settings.set_command_option :without, nil
197
- Bundler.settings.set_command_option :with, nil
198
- Bundler.settings.set_command_option :without, options[:without] - options[:with]
199
- Bundler.settings.set_command_option :with, options[:with]
200
- end
202
+ normalize_groups
201
203
 
202
204
  options[:force] = options[:redownload]
203
205
  end
@@ -10,7 +10,7 @@ module Bundler
10
10
  be sure to check out these resources:
11
11
 
12
12
  1. Check out our troubleshooting guide for quick fixes to common issues:
13
- https://github.com/bundler/bundler/blob/master/doc/TROUBLESHOOTING.md
13
+ https://github.com/rubygems/rubygems/blob/master/bundler/doc/TROUBLESHOOTING.md
14
14
 
15
15
  2. Instructions for common Bundler uses can be found on the documentation
16
16
  site: https://bundler.io/
@@ -22,7 +22,7 @@ module Bundler
22
22
  still aren't working the way you expect them to, please let us know so
23
23
  that we can diagnose and help fix the problem you're having. Please
24
24
  view the Filing Issues guide for more information:
25
- https://github.com/bundler/bundler/blob/master/doc/contributing/ISSUES.md
25
+ https://github.com/rubygems/rubygems/blob/master/bundler/doc/contributing/ISSUES.md
26
26
 
27
27
  EOS
28
28
 
@@ -4,14 +4,16 @@ module Bundler
4
4
  class CLI::List
5
5
  def initialize(options)
6
6
  @options = options
7
+ @without_group = options["without-group"].map(&:to_sym)
8
+ @only_group = options["only-group"].map(&:to_sym)
7
9
  end
8
10
 
9
11
  def run
10
- raise InvalidOption, "The `--only-group` and `--without-group` options cannot be used together" if @options["only-group"] && @options["without-group"]
12
+ raise InvalidOption, "The `--only-group` and `--without-group` options cannot be used together" if @only_group.any? && @without_group.any?
11
13
 
12
14
  raise InvalidOption, "The `--name-only` and `--paths` options cannot be used together" if @options["name-only"] && @options[:paths]
13
15
 
14
- specs = if @options["only-group"] || @options["without-group"]
16
+ specs = if @only_group.any? || @without_group.any?
15
17
  filtered_specs_by_groups
16
18
  else
17
19
  Bundler.load.specs
@@ -29,12 +31,12 @@ module Bundler
29
31
  Bundler.ui.info "Use `bundle info` to print more detailed information about a gem"
30
32
  end
31
33
 
32
- private
34
+ private
33
35
 
34
36
  def verify_group_exists(groups)
35
- raise InvalidOption, "`#{@options["without-group"]}` group could not be found." if @options["without-group"] && !groups.include?(@options["without-group"].to_sym)
36
-
37
- raise InvalidOption, "`#{@options["only-group"]}` group could not be found." if @options["only-group"] && !groups.include?(@options["only-group"].to_sym)
37
+ (@without_group + @only_group).each do |group|
38
+ raise InvalidOption, "`#{group}` group could not be found." unless groups.include?(group)
39
+ end
38
40
  end
39
41
 
40
42
  def filtered_specs_by_groups
@@ -44,10 +46,10 @@ module Bundler
44
46
  verify_group_exists(groups)
45
47
 
46
48
  show_groups =
47
- if @options["without-group"]
48
- groups.reject {|g| g == @options["without-group"].to_sym }
49
- elsif @options["only-group"]
50
- groups.select {|g| g == @options["only-group"].to_sym }
49
+ if @without_group.any?
50
+ groups.reject {|g| @without_group.include?(g) }
51
+ elsif @only_group.any?
52
+ groups.select {|g| @only_group.include?(g) }
51
53
  else
52
54
  groups
53
55
  end.map(&:to_sym)
@@ -3,18 +3,16 @@
3
3
  module Bundler
4
4
  class CLI::Outdated
5
5
  attr_reader :options, :gems, :options_include_groups, :filter_options_patch, :sources, :strict
6
- attr_accessor :outdated_gems_by_groups, :outdated_gems_list
6
+ attr_accessor :outdated_gems
7
7
 
8
8
  def initialize(options, gems)
9
9
  @options = options
10
10
  @gems = gems
11
11
  @sources = Array(options[:source])
12
12
 
13
- @filter_options_patch = options.keys &
14
- %w[filter-major filter-minor filter-patch]
13
+ @filter_options_patch = options.keys & %w[filter-major filter-minor filter-patch]
15
14
 
16
- @outdated_gems_by_groups = {}
17
- @outdated_gems_list = []
15
+ @outdated_gems = []
18
16
 
19
17
  @options_include_groups = [:group, :groups].any? do |v|
20
18
  options.keys.include?(v.to_s)
@@ -22,8 +20,7 @@ module Bundler
22
20
 
23
21
  # the patch level options imply strict is also true. It wouldn't make
24
22
  # sense otherwise.
25
- @strict = options["filter-strict"] ||
26
- Bundler::CLI::Common.patch_level_options(options).any?
23
+ @strict = options["filter-strict"] || Bundler::CLI::Common.patch_level_options(options).any?
27
24
  end
28
25
 
29
26
  def run
@@ -75,87 +72,67 @@ module Bundler
75
72
  gemfile_specs + dependency_specs
76
73
  end
77
74
 
78
- specs.sort_by(&:name).each do |current_spec|
79
- next if !gems.empty? && !gems.include?(current_spec.name)
75
+ specs.sort_by(&:name).uniq(&:name).each do |current_spec|
76
+ next unless gems.empty? || gems.include?(current_spec.name)
80
77
 
81
- dependency = current_dependencies[current_spec.name]
82
78
  active_spec = retrieve_active_spec(definition, current_spec)
79
+ next unless active_spec
83
80
 
84
- next if active_spec.nil?
85
- next if filter_options_patch.any? &&
86
- !update_present_via_semver_portions(current_spec, active_spec, options)
81
+ next unless filter_options_patch.empty? || update_present_via_semver_portions(current_spec, active_spec, options)
87
82
 
88
83
  gem_outdated = Gem::Version.new(active_spec.version) > Gem::Version.new(current_spec.version)
89
84
  next unless gem_outdated || (current_spec.git_version != active_spec.git_version)
90
- groups = nil
85
+
86
+ dependency = current_dependencies[current_spec.name]
87
+ groups = ""
91
88
  if dependency && !options[:parseable]
92
89
  groups = dependency.groups.join(", ")
93
90
  end
94
91
 
95
- outdated_gems_list << { :active_spec => active_spec,
96
- :current_spec => current_spec,
97
- :dependency => dependency,
98
- :groups => groups }
99
-
100
- outdated_gems_by_groups[groups] ||= []
101
- outdated_gems_by_groups[groups] << outdated_gems_list[-1]
92
+ outdated_gems << {
93
+ :active_spec => active_spec,
94
+ :current_spec => current_spec,
95
+ :dependency => dependency,
96
+ :groups => groups,
97
+ }
102
98
  end
103
99
 
104
- if outdated_gems_list.empty?
105
- display_nothing_outdated_message
106
- else
100
+ if outdated_gems.empty?
107
101
  unless options[:parseable]
108
- Bundler.ui.info(header_outdated_message)
102
+ Bundler.ui.info(nothing_outdated_message)
109
103
  end
110
-
104
+ else
111
105
  if options_include_groups
112
- ordered_groups = outdated_gems_by_groups.keys.compact.sort
113
- ordered_groups.insert(0, nil).each do |groups|
114
- gems = outdated_gems_by_groups[groups]
115
- contains_group = if groups
116
- groups.split(", ").include?(options[:group])
117
- else
118
- options[:group] == "group"
119
- end
106
+ relevant_outdated_gems = outdated_gems.group_by {|g| g[:groups] }.sort.flat_map do |groups, gems|
107
+ contains_group = groups.split(", ").include?(options[:group])
108
+ next unless options[:groups] || contains_group
120
109
 
121
- next if (!options[:groups] && !contains_group) || gems.nil?
110
+ gems
111
+ end.compact
122
112
 
123
- unless options[:parseable]
124
- Bundler.ui.info(header_group_message(groups))
113
+ if options[:parseable]
114
+ relevant_outdated_gems.each do |gems|
115
+ print_gems(gems)
125
116
  end
126
-
127
- print_gems(gems)
117
+ else
118
+ print_gems_table(relevant_outdated_gems)
128
119
  end
120
+ elsif options[:parseable]
121
+ print_gems(outdated_gems)
129
122
  else
130
- print_gems(outdated_gems_list)
123
+ print_gems_table(outdated_gems)
131
124
  end
132
125
 
133
126
  exit 1
134
127
  end
135
128
  end
136
129
 
137
- private
130
+ private
138
131
 
139
132
  def groups_text(group_text, groups)
140
133
  "#{group_text}#{groups.split(",").size > 1 ? "s" : ""} \"#{groups}\""
141
134
  end
142
135
 
143
- def header_outdated_message
144
- if options[:pre]
145
- "Outdated gems included in the bundle (including pre-releases):"
146
- else
147
- "Outdated gems included in the bundle:"
148
- end
149
- end
150
-
151
- def header_group_message(groups)
152
- if groups
153
- "===== #{groups_text("Group", groups)} ====="
154
- else
155
- "===== Without group ====="
156
- end
157
- end
158
-
159
136
  def nothing_outdated_message
160
137
  if filter_options_patch.any?
161
138
  display = filter_options_patch.map do |o|
@@ -169,23 +146,14 @@ module Bundler
169
146
  end
170
147
 
171
148
  def retrieve_active_spec(definition, current_spec)
172
- if strict
173
- active_spec = definition.find_resolved_spec(current_spec)
174
- else
175
- active_specs = definition.find_indexed_specs(current_spec)
176
- if !current_spec.version.prerelease? && !options[:pre] && active_specs.size > 1
177
- active_specs.delete_if {|b| b.respond_to?(:version) && b.version.prerelease? }
178
- end
179
- active_spec = active_specs.last
180
- end
181
-
182
- active_spec
183
- end
149
+ active_spec = definition.resolve.find_by_name_and_platform(current_spec.name, current_spec.platform)
150
+ return active_spec if strict
184
151
 
185
- def display_nothing_outdated_message
186
- unless options[:parseable]
187
- Bundler.ui.info(nothing_outdated_message)
152
+ active_specs = active_spec.source.specs.search(current_spec.name).select {|spec| spec.match_platform(current_spec.platform) }.sort_by(&:version)
153
+ if !current_spec.version.prerelease? && !options[:pre] && active_specs.size > 1
154
+ active_specs.delete_if {|b| b.respond_to?(:version) && b.version.prerelease? }
188
155
  end
156
+ active_specs.last
189
157
  end
190
158
 
191
159
  def print_gems(gems_list)
@@ -199,6 +167,19 @@ module Bundler
199
167
  end
200
168
  end
201
169
 
170
+ def print_gems_table(gems_list)
171
+ data = gems_list.map do |gem|
172
+ gem_column_for(
173
+ gem[:current_spec],
174
+ gem[:active_spec],
175
+ gem[:dependency],
176
+ gem[:groups],
177
+ )
178
+ end
179
+
180
+ print_indented([table_header] + data)
181
+ end
182
+
202
183
  def print_gem(current_spec, active_spec, dependency, groups)
203
184
  spec_version = "#{active_spec.version}#{active_spec.git_version}"
204
185
  spec_version += " (from #{active_spec.loaded_from})" if Bundler.ui.debug? && active_spec.loaded_from
@@ -213,7 +194,7 @@ module Bundler
213
194
 
214
195
  output_message = if options[:parseable]
215
196
  spec_outdated_info.to_s
216
- elsif options_include_groups || !groups
197
+ elsif options_include_groups || groups.empty?
217
198
  " * #{spec_outdated_info}"
218
199
  else
219
200
  " * #{spec_outdated_info} in #{groups_text("group", groups)}"
@@ -222,14 +203,22 @@ module Bundler
222
203
  Bundler.ui.info output_message.rstrip
223
204
  end
224
205
 
206
+ def gem_column_for(current_spec, active_spec, dependency, groups)
207
+ current_version = "#{current_spec.version}#{current_spec.git_version}"
208
+ spec_version = "#{active_spec.version}#{active_spec.git_version}"
209
+ dependency = dependency.requirement if dependency
210
+
211
+ ret_val = [active_spec.name, current_version, spec_version, dependency.to_s, groups.to_s]
212
+ ret_val << active_spec.loaded_from.to_s if Bundler.ui.debug?
213
+ ret_val
214
+ end
215
+
225
216
  def check_for_deployment_mode!
226
217
  return unless Bundler.frozen_bundle?
227
- suggested_command = if Bundler.settings.locations("frozen")[:global]
218
+ suggested_command = if Bundler.settings.locations("frozen").keys.&([:global, :local]).any?
228
219
  "bundle config unset frozen"
229
220
  elsif Bundler.settings.locations("deployment").keys.&([:global, :local]).any?
230
221
  "bundle config unset deployment"
231
- else
232
- "bundle install --no-deployment"
233
222
  end
234
223
  raise ProductionError, "You are trying to check outdated gems in " \
235
224
  "deployment mode. Run `bundle outdated` elsewhere.\n" \
@@ -266,5 +255,34 @@ module Bundler
266
255
  version_section = spec.version.segments[version_portion_index, 1]
267
256
  version_section.to_a[0].to_i
268
257
  end
258
+
259
+ def print_indented(matrix)
260
+ header = matrix[0]
261
+ data = matrix[1..-1]
262
+
263
+ column_sizes = Array.new(header.size) do |index|
264
+ matrix.max_by {|row| row[index].length }[index].length
265
+ end
266
+
267
+ Bundler.ui.info justify(header, column_sizes)
268
+
269
+ data.sort_by! {|row| row[0] }
270
+
271
+ data.each do |row|
272
+ Bundler.ui.info justify(row, column_sizes)
273
+ end
274
+ end
275
+
276
+ def table_header
277
+ header = ["Gem", "Current", "Latest", "Requested", "Groups"]
278
+ header << "Path" if Bundler.ui.debug?
279
+ header
280
+ end
281
+
282
+ def justify(row, sizes)
283
+ row.each_with_index.map do |element, index|
284
+ element.ljust(sizes[index])
285
+ end.join(" ").strip + "\n"
286
+ end
269
287
  end
270
288
  end
@@ -23,6 +23,16 @@ module Bundler
23
23
  Bundler::Plugin.install(plugins, options)
24
24
  end
25
25
 
26
+ desc "uninstall PLUGINS", "Uninstall the plugins"
27
+ long_desc <<-D
28
+ Uninstall given list of plugins. To uninstall all the plugins, use -all option.
29
+ D
30
+ method_option "all", :type => :boolean, :default => nil, :banner =>
31
+ "Uninstall all the installed plugins. If no plugin is installed, then it does nothing."
32
+ def uninstall(*plugins)
33
+ Bundler::Plugin.uninstall(plugins, options)
34
+ end
35
+
26
36
  desc "list", "List the installed plugins and available commands"
27
37
  def list
28
38
  Bundler::Plugin.list
@@ -29,6 +29,11 @@ module Bundler
29
29
 
30
30
  FileUtils.rm_rf spec.full_gem_path
31
31
  when Source::Git
32
+ if source.local?
33
+ Bundler.ui.warn("Cannot pristine #{gem_name}. Gem is locally overridden.")
34
+ next
35
+ end
36
+
32
37
  source.remote!
33
38
  if extension_cache_path = source.extension_cache_path(spec)
34
39
  FileUtils.rm_rf extension_cache_path
@@ -53,7 +53,7 @@ module Bundler
53
53
  end
54
54
  end
55
55
 
56
- private
56
+ private
57
57
 
58
58
  def fetch_latest_specs
59
59
  definition = Bundler.definition(true)
@@ -82,7 +82,7 @@ module Bundler
82
82
  locked_spec = locked_info[:spec]
83
83
  new_spec = Bundler.definition.specs[name].first
84
84
  unless new_spec
85
- if Bundler.rubygems.platforms.none? {|p| locked_spec.match_platform(p) }
85
+ unless locked_spec.match_platform(Bundler.local_platform)
86
86
  Bundler.ui.warn "Bundler attempted to update #{name} but it was not considered because it is for a different platform from the current one"
87
87
  end
88
88
 
@@ -106,6 +106,8 @@ module Bundler
106
106
  Bundler.ui.confirm "Bundle updated!"
107
107
  Bundler::CLI::Common.output_without_groups_message(:update)
108
108
  Bundler::CLI::Common.output_post_install_messages installer.post_install_messages
109
+
110
+ Bundler::CLI::Common.output_fund_metadata_summary
109
111
  end
110
112
  end
111
113
  end