Class: GitCompound::Worker::ComponentBuilder

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

Overview

Worker that builds components

Instance Method Summary collapse

Methods inherited from Worker

#visit_manifest, #visit_task

Constructor Details

#initialize(lock = nil) ⇒ ComponentBuilder

Returns a new instance of ComponentBuilder.



6
7
8
9
# File 'lib/git_compound/worker/component_builder.rb', line 6

def initialize(lock = nil)
  @lock  = lock
  @print = PrettyPrint.new
end

Instance Method Details

#visit_component(component) ⇒ Object

Raises:



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/git_compound/worker/component_builder.rb', line 11

def visit_component(component)
  raise GitCompoundError,
        "Destination directory `#{component.path}` " \
        'already exists !' if component.exists?

  Logger.inline 'Building:  '
  @print.visit_component(component)

  component.build!

  raise GitCompoundError,
        "Destination  `#{component.path}` " \
        'verification failed !' unless component.exists?

  return unless @lock
  @lock.lock_component(component) unless @lock.find(component)
end