Class: GemUpdater::Updater
- Inherits:
-
Object
- Object
- GemUpdater::Updater
- Defined in:
- lib/gem_updater.rb
Overview
Updater’s main responsability is to fill changes happened before and after update of ‘Gemfile`, and then format them.
Instance Attribute Summary collapse
-
#gemfile ⇒ Object
Returns the value of attribute gemfile.
Instance Method Summary collapse
-
#format_diff ⇒ Object
Format the diff to get human readable information on the gems that were updated.
-
#initialize ⇒ Updater
constructor
A new instance of Updater.
-
#output_diff ⇒ Object
Print formatted diff.
-
#update!(gems) ⇒ Object
Update process.
Constructor Details
#initialize ⇒ Updater
Returns a new instance of Updater.
12 13 14 |
# File 'lib/gem_updater.rb', line 12 def initialize @gemfile = GemUpdater::GemFile.new end |
Instance Attribute Details
#gemfile ⇒ Object
Returns the value of attribute gemfile.
10 11 12 |
# File 'lib/gem_updater.rb', line 10 def gemfile @gemfile end |
Instance Method Details
#format_diff ⇒ Object
Format the diff to get human readable information on the gems that were updated.
36 37 38 39 40 |
# File 'lib/gem_updater.rb', line 36 def format_diff gemfile.changes.map do |gem, details| ERB.new(template, nil, '<>').result(binding) end end |
#output_diff ⇒ Object
Print formatted diff
30 31 32 |
# File 'lib/gem_updater.rb', line 30 def output_diff Bundler.ui.info format_diff.join end |
#update!(gems) ⇒ Object
Update process. This will:
1. update gemfile
2. find changelogs for updated gems
22 23 24 25 26 27 |
# File 'lib/gem_updater.rb', line 22 def update!(gems) gemfile.update!(gems) gemfile.compute_changes fill_changelogs end |