# File lib/nanoc/cli/commands/show-data.rb, line 14 def run load_site # Get data items = site.items layouts = site.layouts # Get dependency tracker compiler = site.compiler compiler.load dependency_tracker = compiler.dependency_tracker # Print data print_item_dependencies(items, dependency_tracker) print_item_rep_paths(items) print_item_rep_outdatedness(items, compiler) print_layouts(layouts, compiler) end
# File lib/nanoc/cli/commands/show-data.rb, line 53 def print_header(title) header = '=' * 78 header[3..(title.length + 5)] = " #{title} " puts puts header puts end
# File lib/nanoc/cli/commands/show-data.rb, line 62 def print_item_dependencies(items, dependency_tracker) print_header('Item dependencies') sorted_with_prev(items) do |item, prev| puts if prev puts "item #{item.identifier} depends on:" predecessors = dependency_tracker.objects_causing_outdatedness_of(item).sort_by { |i| i ? i.identifier : '' } predecessors.each do |pred| if pred puts " [ #{format '%6s', pred.type} ] #{pred.identifier}" else puts ' ( removed item )' end end puts ' (nothing)' if predecessors.empty? end end
# File lib/nanoc/cli/commands/show-data.rb, line 96 def print_item_rep_outdatedness(items, compiler) print_header('Item representation outdatedness') sorted_reps_with_prev(items) do |rep, prev| puts if prev puts "item #{rep.item.identifier}, rep #{rep.name}:" outdatedness_reason = compiler.outdatedness_checker.outdatedness_reason_for(rep) if outdatedness_reason puts " is outdated: #{outdatedness_reason.message}" else puts ' is not outdated' end end end
# File lib/nanoc/cli/commands/show-data.rb, line 80 def print_item_rep_paths(items) print_header('Item representation paths') sorted_reps_with_prev(items) do |rep, prev| puts if prev puts "item #{rep.item.identifier}, rep #{rep.name}:" if rep.raw_paths.empty? puts ' (not written)' end length = rep.raw_paths.keys.map { |s| s.to_s.length }.max rep.raw_paths.each do |snapshot_name, raw_path| puts " [ %-#{length}s ] %s" % [ snapshot_name, raw_path ] end end end
# File lib/nanoc/cli/commands/show-data.rb, line 111 def print_layouts(layouts, compiler) print_header('Layouts') sorted_with_prev(layouts) do |layout, prev| puts if prev puts "layout #{layout.identifier}:" outdatedness_reason = compiler.outdatedness_checker.outdatedness_reason_for(layout) if outdatedness_reason puts " is outdated: #{outdatedness_reason.message}" else puts ' is not outdated' end puts end end
Generated with the Darkfish Rdoc Generator 2.