Class: Nanoc::Extra::Checking::Checks::Stale

Inherits:
Nanoc::Extra::Checking::Check show all
Defined in:
lib/nanoc/extra/checking/checks/stale.rb

Instance Attribute Summary

Attributes inherited from Nanoc::Extra::Checking::Check

#issues, #site

Instance Method Summary (collapse)

Methods inherited from Nanoc::Extra::Checking::Check

#add_issue, #initialize, #output_filenames

Methods included from PluginRegistry::PluginMethods

#all, #identifier, #identifiers, #named, #register

Constructor Details

This class inherits a constructor from Nanoc::Extra::Checking::Check

Instance Method Details

- (Object) run



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/nanoc/extra/checking/checks/stale.rb', line 5

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