Sha256: f01f183c16b95f167b687002dd863cc6196c58b6995d9b3482909412388b9149

Contents?: true

Size: 701 Bytes

Versions: 8

Compression:

Stored size: 701 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.collect { |i| i.reps }.flatten.collect { |r| r.raw_path })

      self.output_filenames.each do |f|
        next if self.pruner.filename_excluded?(f)
        if !item_rep_paths.include?(f)
          self.add_issue(
            "file without matching item",
            :subject  => f)
        end
      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

8 entries across 8 versions & 1 rubygems

Version Path
nanoc-3.6.7 lib/nanoc/extra/checking/checks/stale.rb
nanoc-3.6.6 lib/nanoc/extra/checking/checks/stale.rb
nanoc-3.6.5 lib/nanoc/extra/checking/checks/stale.rb
nanoc-3.6.4 lib/nanoc/extra/checking/checks/stale.rb
nanoc-3.6.3 lib/nanoc/extra/checking/checks/stale.rb
nanoc-3.6.2 lib/nanoc/extra/checking/checks/stale.rb
nanoc-3.6.1 lib/nanoc/extra/checking/checks/stale.rb
nanoc-3.6.0 lib/nanoc/extra/checking/checks/stale.rb