Class: Nanoc::Int::Compiler::Stages::BuildReps

Inherits:
Object
  • Object
show all
Defined in:
lib/nanoc/base/services/compiler/stages/build_reps.rb

Instance Method Summary collapse

Constructor Details

#initialize(site:, action_provider:, reps:) ⇒ BuildReps

Returns a new instance of BuildReps



5
6
7
8
9
# File 'lib/nanoc/base/services/compiler/stages/build_reps.rb', line 5

def initialize(site:, action_provider:, reps:)
  @site = site
  @action_provider = action_provider
  @reps = reps
end

Instance Method Details

#runObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/nanoc/base/services/compiler/stages/build_reps.rb', line 11

def run
  # FIXME: This also, as a side effect, generates the action sequences. :(
  # Better: let this stage return a mapping of reps onto (raw) paths *and* a mapping of objects
  # onto action sequences.

  builder = Nanoc::Int::ItemRepBuilder.new(
    @site, @action_provider, @reps
  )

  action_sequences = builder.run

  @site.layouts.each do |layout|
    action_sequences[layout] = @action_provider.action_sequence_for(layout)
  end

  action_sequences
end