lib/nanoc/extra/checking/checks/stale.rb in nanoc-4.1.3 vs lib/nanoc/extra/checking/checks/stale.rb in nanoc-4.1.4
- old
+ new
@@ -2,18 +2,10 @@
# @api private
class Stale < ::Nanoc::Extra::Checking::Check
def run
require 'set'
- item_rep_paths =
- Set.new(
- @items
- .flat_map(&:reps)
- .map(&:unwrap)
- .flat_map(&:raw_paths)
- .flat_map(&:values))
-
output_filenames.each do |f|
next if pruner.filename_excluded?(f)
next if item_rep_paths.include?(f)
add_issue(
@@ -21,9 +13,19 @@
subject: f)
end
end
protected
+
+ def item_rep_paths
+ @item_rep_paths ||=
+ Set.new(
+ @items
+ .flat_map(&:reps)
+ .map(&:unwrap)
+ .flat_map(&:raw_paths)
+ .flat_map(&:values))
+ end
def pruner
exclude_config = @config.fetch(:prune, {}).fetch(:exclude, [])
@pruner ||= Nanoc::Extra::Pruner.new(@site, exclude: exclude_config)
end