class Giblish::GitRepoIndexBuilder
Builds an index of the generated documents and includes some git metadata from the repository
Public Class Methods
new(processed_docs, converter, path_manager, deployment_info, manage_docid, git_repo_root)
click to toggle source
Calls superclass method
Giblish::BasicIndexBuilder::new
# File lib/giblish/buildindex.rb, line 312 def initialize(processed_docs, converter, path_manager, deployment_info, manage_docid, git_repo_root) super processed_docs, converter, path_manager, deployment_info, manage_docid # no repo root given... return unless git_repo_root begin # Make sure that we can "talk" to git if user feeds us # a git repo root @git_repo = Git.open(git_repo_root) @git_repo_root = git_repo_root rescue StandardError => e Giblog.logger.error { "No git repo! exception: #{e.message}" } end end
Protected Instance Methods
display_source_file(doc_info)
click to toggle source
override basic version and use the relative path to the git repo root instead
# File lib/giblish/buildindex.rb, line 332 def display_source_file(doc_info) # Use the path relative to the git repo root as display src_file = Pathname .new(doc_info.src_file) .relative_path_from(@git_repo_root).to_s <<~SRC_FILE_TXT Source file:: #{src_file} SRC_FILE_TXT end
generate_history_info(doc_info)
click to toggle source
# File lib/giblish/buildindex.rb, line 347 def generate_history_info(doc_info) str = String.new( <<~HISTORY_HEADER File history:: [cols=\"2,3,8\",options=\"header\"] |=== |Date |Author |Message HISTORY_HEADER ) # Generate table rows of history information doc_info.history.each do |h| str << <<~HISTORY_ROW |#{h.date.strftime('%Y-%m-%d')} |#{h.author} |#{h.message} HISTORY_ROW end str << "|===\n\n" end
source_root()
click to toggle source
# File lib/giblish/buildindex.rb, line 343 def source_root @git_repo.current_branch end