Class: BundleUpdateInteractive::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/bundle_update_interactive/cli.rb,
lib/bundle_update_interactive/cli/row.rb,
lib/bundle_update_interactive/cli/table.rb,
lib/bundle_update_interactive/cli/multi_select.rb

Defined Under Namespace

Classes: MultiSelect, Options, Row, Table

Instance Method Summary collapse

Instance Method Details

#run(argv: ARGV) ⇒ Object

rubocop:disable Metrics/AbcSize



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/bundle_update_interactive/cli.rb', line 12

def run(argv: ARGV) # rubocop:disable Metrics/AbcSize
  options = Options.parse(argv)
  report = generate_report(options)

  puts_legend_and_withheld_gems(report) unless report.empty?
  puts("No gems to update.").then { return } if report.updatable_gems.empty?

  selected_gems = MultiSelect.prompt_for_gems_to_update(report.updatable_gems)
  puts("No gems to update.").then { return } if selected_gems.empty?

  puts "Updating the following gems."
  puts Table.updatable(selected_gems).render
  puts
  report.bundle_update!(*selected_gems.keys)
rescue Exception => e # rubocop:disable Lint/RescueException
  handle_exception(e)
end