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"

Constants inherited from SubtreeIndexBase

Giblish::SubtreeIndexBase::DEFAULT_INDEX_ERB

Instance Attribute Summary

Attributes inherited from SubtreeIndexBase

#src_location

Attributes inherited from SubtreeSrcItf

#adoc_source

Instance Method Summary collapse

Methods inherited from SubtreeIndexBase

#adoc_source, #document_details, #initialize, #tree_summary

Methods inherited from SubtreeSrcItf

#initialize

Constructor Details

This class inherits a constructor from Giblish::SubtreeIndexBase

Instance Method Details

#document_detail(node_data) ⇒ Object



113
114
115
# File 'lib/giblish/indexbuilders/subtree_indices.rb', line 113

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

#document_detail_fail(node_data) ⇒ Object



109
110
111
# File 'lib/giblish/indexbuilders/subtree_indices.rb', line 109

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

#generate_history_info(node_data) ⇒ Object



117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/giblish/indexbuilders/subtree_indices.rb', line 117

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



105
106
107
# File 'lib/giblish/indexbuilders/subtree_indices.rb', line 105

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