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: [], only_explicit: false) ⇒ Updater
constructor
A new instance of Updater.
-
#modified_gemfile? ⇒ Boolean
Overridden by Latest::Updater subclass.
Constructor Details
#initialize(groups: [], only_explicit: false) ⇒ Updater
Returns a new instance of Updater.
5 6 7 8 9 10 |
# File 'lib/bundle_update_interactive/updater.rb', line 5 def initialize(groups: [], only_explicit: false) @only_explicit = only_explicit @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
19 20 21 22 23 24 25 26 27 |
# File 'lib/bundle_update_interactive/updater.rb', line 19 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
12 13 14 15 16 17 |
# File 'lib/bundle_update_interactive/updater.rb', line 12 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
30 31 32 |
# File 'lib/bundle_update_interactive/updater.rb', line 30 def modified_gemfile? false end |