diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2019-07-24 16:09:35 +0200 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2019-08-03 09:29:59 +0900 |
commit | 1069139a339a6a7d0d6169c634e572659f749ea9 (patch) | |
tree | 117ad79e54069906efef25ef366fa5317030c592 | |
parent | ee7ec87007862118cdf13815808999e73b9b98d3 (diff) | |
download | ruby-1069139a339a6a7d0d6169c634e572659f749ea9.tar.gz |
[bundler/bundler] Extract some methods
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/027aba0cff
-rw-r--r-- | lib/bundler/cli/outdated.rb | 50 |
1 files changed, 31 insertions, 19 deletions
diff --git a/lib/bundler/cli/outdated.rb b/lib/bundler/cli/outdated.rb index 804e8072d4..ad58be0b9f 100644 --- a/lib/bundler/cli/outdated.rb +++ b/lib/bundler/cli/outdated.rb @@ -105,11 +105,7 @@ module Bundler display_nothing_outdated_message else unless options[:parseable] - if options[:pre] - Bundler.ui.info "Outdated gems included in the bundle (including pre-releases):" - else - Bundler.ui.info "Outdated gems included in the bundle:" - end + Bundler.ui.info(header_outdated_message) end if options_include_groups @@ -125,11 +121,7 @@ module Bundler next if (!options[:groups] && !contains_group) || gems.nil? unless options[:parseable] - if groups - Bundler.ui.info "===== #{groups_text("Group", groups)} =====" - else - Bundler.ui.info "===== Without group =====" - end + Bundler.ui.info(header_group_message(groups)) end print_gems(gems) @@ -148,6 +140,34 @@ module Bundler "#{group_text}#{groups.split(",").size > 1 ? "s" : ""} \"#{groups}\"" end + def header_outdated_message + if options[:pre] + "Outdated gems included in the bundle (including pre-releases):" + else + "Outdated gems included in the bundle:" + end + end + + def header_group_message(groups) + if groups + "===== #{groups_text("Group", groups)} =====" + else + "===== Without group =====" + end + end + + def nothing_outdated_message + if filter_options_patch.any? + display = filter_options_patch.map do |o| + o.sub("filter-", "") + end.join(" or ") + + "No #{display} updates to display.\n" + else + "Bundle up to date!\n" + end + end + def retrieve_active_spec(strict, definition, current_spec) return unless current_spec.match_platform(Bundler.local_platform) @@ -166,15 +186,7 @@ module Bundler def display_nothing_outdated_message unless options[:parseable] - if filter_options_patch.any? - display = filter_options_patch.map do |o| - o.sub("filter-", "") - end.join(" or ") - - Bundler.ui.info "No #{display} updates to display.\n" - else - Bundler.ui.info "Bundle up to date!\n" - end + Bundler.ui.info(nothing_outdated_message) end end |