Class: BundleUpdateInteractive::Updater

Inherits:
Object
  • Object
show all
Defined in:
lib/bundle_update_interactive/updater.rb

Direct Known Subclasses

Latest::Updater

Instance Method Summary collapse

Constructor Details

#initialize(groups: []) ⇒ Updater

Returns a new instance of Updater.



5
6
7
8
9
# File 'lib/bundle_update_interactive/updater.rb', line 5

def initialize(groups: [])
  @gemfile = Gemfile.parse
  @current_lockfile = Lockfile.parse
  @candidate_gems = current_lockfile.gems_exclusively_installed_by(gemfile: gemfile, groups: groups) if groups.any?
end

Instance Method Details

#apply_updates(*gem_names) ⇒ Object



18
19
20
21
# File 'lib/bundle_update_interactive/updater.rb', line 18

def apply_updates(*gem_names)
  expanded_names = expand_gems_with_exact_dependencies(*gem_names)
  BundlerCommands.update_gems_conservatively(*expanded_names)
end

#generate_reportObject



11
12
13
14
15
16
# File 'lib/bundle_update_interactive/updater.rb', line 11

def generate_report
  updatable_gems = find_updatable_gems
  withheld_gems = find_withheld_gems(exclude: updatable_gems.keys)

  Report.new(current_lockfile: current_lockfile, updatable_gems: updatable_gems, withheld_gems: withheld_gems)
end

#modified_gemfile?Boolean

Overridden by Latest::Updater subclass

Returns:

  • (Boolean)


24
25
26
# File 'lib/bundle_update_interactive/updater.rb', line 24

def modified_gemfile?
  false
end