Class: Giblish::SubtreeIndexGit

Inherits:
SubtreeIndexBase show all
Defined in:
lib/giblish/indexbuilders/subtree_indices.rb

Overview

Generates a directory index with history info for all files under the given subdir node.

Constant Summary collapse

HISTORY_TABLE_HEADING =

The fixed heading of the table used to display file history

"File history::\n\n[cols=\"2,3,8,3\",options=\"header\"]\n|===\n|Date |Author |Message |Sha1\n"
HISTORY_TABLE_FOOTING =
"\n|===\\n\\n\n"

Instance Attribute Summary

Attributes inherited from SubtreeIndexBase

#src_location

Instance Method Summary collapse

Methods inherited from SubtreeIndexBase

#adoc_source, #document_details, #initialize, #tree_summary

Methods inherited from SubtreeSrcItf

#adoc_source, #initialize

Constructor Details

This class inherits a constructor from Giblish::SubtreeIndexBase

Instance Method Details

#document_detail(node_data) ⇒ Object



119
120
121
# File 'lib/giblish/indexbuilders/subtree_indices.rb', line 119

def document_detail(node_data)
  super + generate_history_info(node_data)
end

#document_detail_fail(node_data) ⇒ Object



115
116
117
# File 'lib/giblish/indexbuilders/subtree_indices.rb', line 115

def document_detail_fail(node_data)
  super + generate_history_info(node_data)
end

#generate_history_info(node_data) ⇒ Object



123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/giblish/indexbuilders/subtree_indices.rb', line 123

def generate_history_info(node_data)
  return "Could not find history information\n\n" unless node_data.respond_to?(:history)

  # Generate table rows of history information
  rows = node_data.history.collect do |h|
    "      |\#{h.date.strftime(\"%Y-%m-%d\")}\n      |\#{h.author}\n      |\#{h.message}\n      |\#{h.sha1[0..7]} ...\n    HISTORY_ROW\n  end.join(\"\\n\\n\")\n  HISTORY_TABLE_HEADING + rows + HISTORY_TABLE_FOOTING\nend\n"

#subtitle(dst_node) ⇒ Object



111
112
113
# File 'lib/giblish/indexbuilders/subtree_indices.rb', line 111

def subtitle(dst_node)
  "from #{dst_node.data.branch}"
end