Class: Nanoc3::CLI::Commands::Debug
- Inherits:
-
Cri::Command
- Object
- Cri::Command
- Nanoc3::CLI::Commands::Debug
- Defined in:
- lib/nanoc3/cli/commands/debug.rb
Instance Method Summary (collapse)
- - (Object) aliases
- - (Object) long_desc
- - (Object) name
- - (Object) option_definitions
- - (Object) run(options, arguments)
- - (Object) short_desc
- - (Object) usage
Instance Method Details
- (Object) aliases
11 12 13 |
# File 'lib/nanoc3/cli/commands/debug.rb', line 11 def aliases [] end |
- (Object) long_desc
19 20 21 22 |
# File 'lib/nanoc3/cli/commands/debug.rb', line 19 def long_desc 'Show information about all items, item representations and layouts ' \ 'in the current site.' end |
- (Object) name
7 8 9 |
# File 'lib/nanoc3/cli/commands/debug.rb', line 7 def name 'debug' end |
- (Object) option_definitions
28 29 30 |
# File 'lib/nanoc3/cli/commands/debug.rb', line 28 def option_definitions [] end |
- (Object) run(options, arguments)
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/nanoc3/cli/commands/debug.rb', line 32 def run(, arguments) # Make sure we are in a nanoc site directory print "Loading site data... " @base.require_site @base.site.load_data puts "done" puts # Get data items = @base.site.items reps = items.map { |i| i.reps }.flatten layouts = @base.site.layouts # Get dependency tracker # FIXME clean this up dependency_tracker = @base.site.compiler.send(:dependency_tracker) dependency_tracker.load_graph # Print item dependencies puts '=== Item dependencies =======================================================' puts items.sort_by { |i| i.identifier }.each do |item| puts "item #{item.identifier} depends on:" predecessors = dependency_tracker.direct_predecessors_of(item).sort_by { |i| i.identifier } predecessors.each do |pred| puts " #{pred.identifier}" end puts " (nothing)" if predecessors.empty? puts end # Print representation paths puts '=== Representation paths ====================================================' puts items.sort_by { |i| i.identifier }.each do |item| item.reps.sort_by { |r| r.name.to_s }.each do |rep| puts "item #{item.identifier}, rep #{rep.name}:" puts " #{rep.raw_path || '(not written)'}" end puts end # Print representation outdatedness puts '=== Representation outdatedness =============================================' puts items.sort_by { |i| i.identifier }.each do |item| item.reps.sort_by { |r| r.name.to_s }.each do |rep| puts "item #{item.identifier}, rep #{rep.name}:" outdatedness_reason = rep.outdatedness_reason if outdatedness_reason puts " is outdated: #{outdatedness_reason[:type]} (#{outdatedness_reason[:description]})" else puts " is not outdated" end end puts end # Print layouts puts '=== Layouts' puts layouts.each do |layout| puts "layout #{layout.identifier}" end end |
- (Object) short_desc
15 16 17 |
# File 'lib/nanoc3/cli/commands/debug.rb', line 15 def short_desc 'show debug information for this site' end |
- (Object) usage
24 25 26 |
# File 'lib/nanoc3/cli/commands/debug.rb', line 24 def usage "nanoc3 debug" end |