Hey Jan,
That information is indeed (mostly) available. Here is an example check that bases itself off @items:
Nanoc::Check.define(:sample) do
all_item_reps = @items.flat_map { |i| i.reps.to_a }
all_item_reps.each do |rep|
path = rep.raw_path
next unless path # some reps have no paths (are not written)
add_issue(
"something is rotten",
subject: "#{path} --- #{rep.item.identifier}",
)
end
end
There is one limitation here: it only looks at the :default snapshot of item representations. That is fine if you 1) don’t have rules that have multiple `write` instructions, and 2) don’t have routing rules that apply to specific non-default snapshots.
There is currently no way to request the list of snapshot names of an item representation. I’ll look into making that possible. Then, the code would look like this:
all_item_reps.each do |rep|
# DOES NOT WORK YET:
rep.snapshot_names.each do |snapshot_name|
path = rep.raw_path(snapshot: snapshot_name)
next unless path # some reps have no paths (are not written)
Hope this helps,
Denis Defreyne
[dəˈni] • pronouns: he/him