class CurrentCommitRails::CommitBuilder

Public Class Methods

branch() click to toggle source
# File lib/current_commit_rails/commit_builder.rb, line 39
def branch
  @repo.head.name.sub(/^refs\/heads\//, '')
end
build(path) click to toggle source
# File lib/current_commit_rails/commit_builder.rb, line 7
def build(path)
  get_repo(path)
  build_hash
end
build_hash() click to toggle source
# File lib/current_commit_rails/commit_builder.rb, line 16
def build_hash
  CurrentCommitRails.commit_hash = CommitHash.new(
    last_commit.oid,
    last_commit.message,
    last_commit.author[:name],
    last_commit.author[:email],
    last_commit.author[:time],
    last_commit.committer[:name],
    last_commit.committer[:email],
    last_commit.committer[:time],
    last_commit.time,
    branch
  ) 
end
commit_hash() click to toggle source
# File lib/current_commit_rails/commit_builder.rb, line 35
def commit_hash
  @commit_hash
end
get_repo(path) click to toggle source
# File lib/current_commit_rails/commit_builder.rb, line 12
def get_repo path
  @repo ||= Rugged::Repository.new(path)
end
last_commit() click to toggle source
# File lib/current_commit_rails/commit_builder.rb, line 31
def last_commit
  @repo.last_commit
end