Class: BundleUpdateInteractive::Updater
- Inherits:
-
Object
- Object
- BundleUpdateInteractive::Updater
- Defined in:
- lib/bundle_update_interactive/updater.rb
Direct Known Subclasses
Instance Method Summary collapse
- #apply_updates(*gem_names) ⇒ Object
- #generate_report ⇒ Object
-
#initialize(groups: []) ⇒ Updater
constructor
A new instance of Updater.
-
#modified_gemfile? ⇒ Boolean
Overridden by Latest::Updater subclass.
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 22 23 24 25 26 |
# File 'lib/bundle_update_interactive/updater.rb', line 18 def apply_updates(*gem_names) = (*gem_names) BundlerCommands.update_gems_conservatively(*) # Return the gems that were actually updated based on observed changes to the lock file updated_gems = build_outdated_gems(File.read("Gemfile.lock")) @current_lockfile = Lockfile.parse updated_gems end |
#generate_report ⇒ Object
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
29 30 31 |
# File 'lib/bundle_update_interactive/updater.rb', line 29 def modified_gemfile? false end |