Class: GitCompound::Worker::ComponentReplacer

Inherits:
Worker
  • Object
show all
Defined in:
lib/git_compound/worker/component_replacer.rb

Overview

Worker that replaces components if necessary

Instance Method Summary collapse

Methods inherited from Worker

#visit_manifest, #visit_task

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