class Giblish::GitSummaryIndexBuilder
Builds an index page with a summary of what branches have been generated
Public Class Methods
new(repo, branches, tags)
click to toggle source
# File lib/giblish/buildindex.rb, line 374 def initialize(repo, branches, tags) @branches = branches @tags = tags @git_repo = repo @repo_url = repo.remote.url end
Public Instance Methods
source()
click to toggle source
# File lib/giblish/buildindex.rb, line 381 def source <<~ADOC_SRC #{generate_header} #{generate_branch_info} #{generate_tag_info} #{generate_footer} ADOC_SRC end
Private Instance Methods
generate_branch_info()
click to toggle source
# File lib/giblish/buildindex.rb, line 408 def generate_branch_info return "" if @branches.empty? # get the branch-unique dst-dir str = <<~BRANCH_INFO == Branches BRANCH_INFO @branches.each do |b| dirname = b.name.tr "/", "_" str << " * link:#{dirname}/index.html[#{b.name}]\n" end str end
generate_header()
click to toggle source
# File lib/giblish/buildindex.rb, line 392 def generate_header t = Time.now <<~DOC_HEADER = Document repository From #{@repo_url} Generated by Giblish at:: #{t.strftime('%Y-%m-%d %H:%M')} DOC_HEADER end
generate_tag_info()
click to toggle source
# File lib/giblish/buildindex.rb, line 424 def generate_tag_info return "" if @tags.empty? # get the branch-unique dst-dir str = <<~TAG_INFO == Tags |=== |Tag |Tag comment |Creator |Tagged commit TAG_INFO str << @tags.collect do |t| dirname = t.name.tr "/", "_" c = @git_repo.gcommit(t.sha) <<~A_ROW |link:#{dirname}/index.html[#{t.name}] |#{t.annotated? ? t.message : '-'} |#{t.annotated? ? t.tagger.name : '-'} |#{t.sha[0, 8]}... committed at #{c.author.date} A_ROW end.join("\n") str << "|===\n" # @tags.each do |t| # dirname = t.name.tr "/", "_" # str << " * link:#{dirname}/index.html[#{t.name}]" # if t.annotated? # str << "created at #{t.tagger.date} by #{t.tagger.name} with message: #{t.message}" # end # end str end