# File lib/nanoc/cli/commands/show-rules.rb, line 13 def run self.require_site @c = Nanoc::CLI::ANSIStringColorizer @calc = self.site.compiler.rule_memory_calculator # TODO explain /foo/ # TODO explain content/foo.html # TODO explain output/foo/index.html self.site.items.each { |i| self.explain_item(i) } self.site.layouts.each { |l| self.explain_layout(l) } end
# File lib/nanoc/cli/commands/show-rules.rb, line 29 def explain_item(item) puts "#{@c.c('Item ' + item.identifier, :bold, :yellow)}:" puts " (from #{item[:filename]})" if item[:filename] item.reps.each do |rep| puts " Rep #{rep.name}:" if @calc[rep].empty? && rep.raw_path.nil? puts " (nothing)" else @calc[rep].each do |mem| puts ' %s %s' % [ @c.c(format('%-10s', mem[0].to_s), :blue), mem[1..-1].map { |m| m.inspect }.join(', ') ] end if rep.raw_path puts ' %s %s' % [ @c.c(format('%-10s', 'write to'), :blue), rep.raw_path ] end end end puts end
# File lib/nanoc/cli/commands/show-rules.rb, line 54 def explain_layout(layout) puts "#{@c.c('Layout ' + layout.identifier, :bold, :yellow)}:" puts " (from #{layout[:filename]})" if layout[:filename] puts " %s %s" % [ @c.c(format('%-10s', 'filter'), :blue), @calc[layout].map { |m| m.inspect }.join(', ') ] puts end
Generated with the Darkfish Rdoc Generator 2.