Sha256: d69372b042f7656ce643604c8fa0a657dc35d72317cd09737267f91bd46b9a85

Contents?: true

Size: 1.03 KB

Versions: 3

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

module Nanoc
  module Int
    class Compiler
      module Stages
        class Preprocess < Nanoc::Int::Compiler::Stage
          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
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nanoc-4.11.3 lib/nanoc/base/services/compiler/stages/preprocess.rb
nanoc-4.11.2 lib/nanoc/base/services/compiler/stages/preprocess.rb
nanoc-4.11.1 lib/nanoc/base/services/compiler/stages/preprocess.rb