Sha256: 7911d72ec87d89dcb842c28fa7447a2f6d97ce1a7807e860058c32e08f030a63

Contents?: true

Size: 640 Bytes

Versions: 2

Compression:

Stored size: 640 Bytes

Contents

# encoding: utf-8

module Nanoc::Extra::Checking::Checks
  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

2 entries across 2 versions & 1 rubygems

Version Path
nanoc-3.8.0 lib/nanoc/extra/checking/checks/stale.rb
nanoc-3.7.5 lib/nanoc/extra/checking/checks/stale.rb