Class: GitCompound::Worker::ComponentReplacer
- Defined in:
- lib/git_compound/worker/component_replacer.rb
Overview
Worker that replaces components if necessary
Instance Method Summary collapse
-
#initialize(lock) ⇒ ComponentReplacer
constructor
A new instance of ComponentReplacer.
- #visit_component(component) ⇒ Object
Methods inherited from Worker
Constructor Details
#initialize(lock) ⇒ ComponentReplacer
Returns a new instance of ComponentReplacer.
6 7 8 9 |
# File 'lib/git_compound/worker/component_replacer.rb', line 6 def initialize(lock) @lock = lock @print = PrettyPrint.new end |
Instance Method Details
#visit_component(component) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/git_compound/worker/component_replacer.rb', line 11 def visit_component(component) raise "Component `#{component.name}` is not built !" unless component.exists? Logger.inline 'Replacing: ' @print.visit_component(component) component.remove! component.build! @lock.lock_component(component) end |