# File lib/nanoc/cli/commands/show-data.rb, line 14 def run self.load_site # Get data items = self.site.items item_reps = items.map { |i| i.reps }.flatten layouts = self.site.layouts # Get dependency tracker compiler = self.site.compiler compiler.load dependency_tracker = compiler.dependency_tracker # Print data self.print_item_dependencies(items, dependency_tracker) self.print_item_rep_paths(items) self.print_item_rep_outdatedness(items, compiler) self.print_layouts(layouts, compiler) end
# File lib/nanoc/cli/commands/show-data.rb, line 54 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 63 def print_item_dependencies(items, dependency_tracker) self.print_header('Item dependencies') self.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 97 def print_item_rep_outdatedness(items, compiler) self.print_header('Item representation outdatedness') self.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 81 def print_item_rep_paths(items) self.print_header('Item representation paths') self.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 112 def print_layouts(layouts, compiler) self.print_header('Layouts') self.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.