class Nanoc::Checking::Checks::Stale

@api private

Public Instance Methods

run() click to toggle source
# File lib/nanoc/checking/checks/stale.rb, line 10
def run
  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 Instance Methods

item_rep_paths() click to toggle source
# File lib/nanoc/checking/checks/stale.rb, line 24
def item_rep_paths
  @item_rep_paths ||=
    Set.new(
      @items
        .flat_map(&:reps)
        .map(&:_unwrap)
        .flat_map(&:raw_paths)
        .flat_map(&:values)
        .flatten,
    )
end
pruner() click to toggle source
# File lib/nanoc/checking/checks/stale.rb, line 36
def pruner
  exclude_config = @config.fetch(:prune, {}).fetch(:exclude, [])
  # FIXME: specifying reps this way is icky
  reps = Nanoc::Core::ItemRepRepo.new
  @pruner ||= Nanoc::Core::Pruner.new(@config._unwrap, reps, exclude: exclude_config)
end