Sha256: 6a77962a58d68315e1d882c329ad03ae2515b68547f1632c50a7ebb587ba0b6c

Contents?: true

Size: 851 Bytes

Versions: 7

Compression:

Stored size: 851 Bytes

Contents

# frozen_string_literal: true

module Nanoc::Int::Compiler::Stages
  class Preprocess
    def initialize(action_provider:, site:, dependency_store:, checksum_store:)
      @action_provider = action_provider
      @site = site
      @dependency_store = dependency_store
      @checksum_store = checksum_store
    end

    def run
      return if @site.preprocessed?

      if @action_provider.need_preprocessing?
        @site.data_source = Nanoc::Int::InMemDataSource.new(@site.items, @site.layouts, @site.data_source)
        @action_provider.preprocess(@site)

        @dependency_store.items = @site.items
        @dependency_store.layouts = @site.layouts
        @checksum_store.objects = @site.items.to_a + @site.layouts.to_a + @site.code_snippets + [@site.config]
      end

      @site.mark_as_preprocessed
      @site.freeze
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
nanoc-4.8.17 lib/nanoc/base/services/compiler/stages/preprocess.rb
nanoc-4.8.16 lib/nanoc/base/services/compiler/stages/preprocess.rb
nanoc-4.8.15 lib/nanoc/base/services/compiler/stages/preprocess.rb
nanoc-4.8.14 lib/nanoc/base/services/compiler/stages/preprocess.rb
nanoc-4.8.13 lib/nanoc/base/services/compiler/stages/preprocess.rb
nanoc-4.8.12 lib/nanoc/base/services/compiler/stages/preprocess.rb
nanoc-4.8.11 lib/nanoc/base/services/compiler/stages/preprocess.rb