1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[bundler/bundler] Move any? logic to the attribute

It's the only usage of the `options_include_groups` attribute and its
name suggests a boolean, so it fits better now.

Co-authored-by: Guillermo Guerrero <wolf.fox1985@gmail.com>
Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>

https://github.com/bundler/bundler/commit/53c0fae760
This commit is contained in:
David Rodríguez 2019-07-24 13:34:52 +02:00 committed by Hiroshi SHIBATA
parent 4e76aef280
commit a42478502c
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2

View file

@ -8,7 +8,7 @@ module Bundler
@options = options @options = options
@gems = gems @gems = gems
@options_include_groups = [:group, :groups].select do |v| @options_include_groups = [:group, :groups].any? do |v|
options.keys.include?(v.to_s) options.keys.include?(v.to_s)
end end
end end
@ -119,7 +119,7 @@ module Bundler
end end
end end
if options_include_groups.any? if options_include_groups
ordered_groups = outdated_gems_by_groups.keys.compact.sort ordered_groups = outdated_gems_by_groups.keys.compact.sort
[nil, ordered_groups].flatten.each do |groups| [nil, ordered_groups].flatten.each do |groups|
gems = outdated_gems_by_groups[groups] gems = outdated_gems_by_groups[groups]
@ -145,7 +145,6 @@ module Bundler
gem[:active_spec], gem[:active_spec],
gem[:dependency], gem[:dependency],
groups, groups,
options_include_groups.any?
) )
end end
end end
@ -156,7 +155,6 @@ module Bundler
gem[:active_spec], gem[:active_spec],
gem[:dependency], gem[:dependency],
gem[:groups], gem[:groups],
options_include_groups.any?
) )
end end
end end
@ -201,7 +199,7 @@ module Bundler
end end
end end
def print_gem(current_spec, active_spec, dependency, groups, options_include_groups) def print_gem(current_spec, active_spec, dependency, groups)
spec_version = "#{active_spec.version}#{active_spec.git_version}" spec_version = "#{active_spec.version}#{active_spec.git_version}"
spec_version += " (from #{active_spec.loaded_from})" if Bundler.ui.debug? && active_spec.loaded_from spec_version += " (from #{active_spec.loaded_from})" if Bundler.ui.debug? && active_spec.loaded_from
current_version = "#{current_spec.version}#{current_spec.git_version}" current_version = "#{current_spec.version}#{current_spec.git_version}"