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



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

def run
  require 'set'

  item_rep_paths = Set.new(@site.items.map { |i| i.reps }.flatten.map { |r| r.raw_path })

  output_filenames.each do |f|
    next if pruner.filename_excluded?(f)
    if !item_rep_paths.include?(f)
      add_issue(
        'file without matching item',
        :subject  => f)
    end
  end
end