Class: Apogee::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/apogee/builder.rb

Overview

Builds site for distribution using the specified processors

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(processors: [ ImageProcessor.new, CSSProcessor.new, JSProcessor.new, PageProcessor.new ]) ⇒ Builder

Returns a new instance of Builder.



10
11
12
13
14
15
16
17
18
19
# File 'lib/apogee/builder.rb', line 10

def initialize(
  processors: [
    ImageProcessor.new,
    CSSProcessor.new,
    JSProcessor.new,
    PageProcessor.new
  ]
)
  @processors = processors
end

Instance Attribute Details

#processorsObject (readonly)

Returns the value of attribute processors.



8
9
10
# File 'lib/apogee/builder.rb', line 8

def processors
  @processors
end

Instance Method Details

#buildObject



21
22
23
24
# File 'lib/apogee/builder.rb', line 21

def build
  prepare_dist_dir
  processors.each(&:process)
end

#prepare_dist_dirObject



26
27
28
29
# File 'lib/apogee/builder.rb', line 26

def prepare_dist_dir
  FileUtils.rm_rf('dist')
  FileUtils.mkdir('dist')
end