Class: Bundler::Interactive::UpdateInteractive
- Inherits:
-
Plugin::API
- Object
- Plugin::API
- Bundler::Interactive::UpdateInteractive
- Defined in:
- lib/bundler/interactive/update_interactive.rb
Overview
The bundle update-interactive command.
Renders a navigable table of outdated gems: up/down move between gems, left/right cycle a gem's target version (current / in-range latest / absolute latest), space skips or restores a row, enter applies the selection, and q (or Ctrl-C) cancels.
Defined Under Namespace
Classes: ResolvedSpecs
Constant Summary collapse
- KEY_UP =
["\e[A", "\eOA"].freeze
- KEY_DOWN =
["\e[B", "\eOB"].freeze
- KEY_RIGHT =
["\e[C", "\eOC"].freeze
- KEY_LEFT =
["\e[D", "\eOD"].freeze
- KEY_RETURN =
["\r", "\n"].freeze
- KEY_SPACE =
[' '].freeze
- KEY_QUIT =
['q', "\e"].freeze
- ROLE_ORDER =
Fixed version columns, mirroring
yarn upgrade-interactive. %i[current in_range latest].freeze
- COLUMN_LABELS =
{ current: 'Current', in_range: 'Range', latest: 'Latest' }.freeze
- LEVEL_COLOR =
Semver bump levels, coloured like
yarn upgrade-interactive. { major: '31', minor: '33', patch: '32' }.freeze
Instance Method Summary collapse
-
#exec(_command, _args) ⇒ Object
red / yellow / green.
- #outdated_gems ⇒ Object
Instance Method Details
#exec(_command, _args) ⇒ Object
red / yellow / green
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/bundler/interactive/update_interactive.rb', line 37 def exec(_command, _args) if outdated_gems.empty? Bundler.ui.info('Bundle up to date!') return end selection = interactive_select return Bundler.ui.info('Canceling...') if selection.nil? chosen = selection.reject(&:skip?) return Bundler.ui.info('No gems selected.') if chosen.empty? Update.new(chosen).update! rescue TTY::Reader::InputInterrupt show_cursor Bundler.ui.info("\nCanceling...") end |
#outdated_gems ⇒ Object
55 56 57 58 59 60 61 62 |
# File 'lib/bundler/interactive/update_interactive.rb', line 55 def outdated_gems @outdated_gems ||= VersionResolver.new( current_specs: current_gems, resolved_definition: definition, dependencies: dependencies, cooldown_days: cooldown_days ).outdated_gems end |