Sha256: b5a0a1ecca8879d890c2b674008aa7b48b021967face045504e41b1eefa8797a

Contents?: true

Size: 657 Bytes

Versions: 4

Compression:

Stored size: 657 Bytes

Contents

# encoding: utf-8

module Nanoc::Extra::Checking::Checks
  # @api private
  class Stale < ::Nanoc::Extra::Checking::Check
    def run
      require 'set'

      item_rep_paths = Set.new(@site.items.map(&:reps).flatten.map(&:raw_path))

      output_filenames.each do |f|
        next if pruner.filename_excluded?(f)
        next if item_rep_paths.include?(f)

        add_issue(
          'file without matching item',
          subject: f)
      end
    end

    protected

    def pruner
      exclude_config = @site.config.fetch(:prune, {}).fetch(:exclude, [])
      @pruner ||= Nanoc::Extra::Pruner.new(@site, exclude: exclude_config)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
nanoc-4.0.0b2 lib/nanoc/extra/checking/checks/stale.rb
nanoc-4.0.0b1 lib/nanoc/extra/checking/checks/stale.rb
nanoc-4.0.0a2 lib/nanoc/extra/checking/checks/stale.rb
nanoc-4.0.0a1 lib/nanoc/extra/checking/checks/stale.rb