class Git::Revision

Public Class Methods

author() click to toggle source
# File lib/git-revision.rb, line 36
def author
  `git log -1 --pretty=format:"%an"`
end
branch() click to toggle source
# File lib/git-revision.rb, line 32
def branch
  `git rev-parse --abbrev-ref HEAD`.strip
end
commit() click to toggle source
# File lib/git-revision.rb, line 4
def commit
  `git log -1 --pretty="format:%H"`
end
commit_short() click to toggle source
# File lib/git-revision.rb, line 8
def commit_short
  `git log -1 --pretty="format:%h"`
end
date() click to toggle source
# File lib/git-revision.rb, line 16
def date
  `git log -1 --pretty="format:%ad"`
end
info() click to toggle source
# File lib/git-revision.rb, line 40
def info
  @info ||= {
    :author             => author,
    :branch             => branch,
    :commit_hash        => commit,
    :commit_hash_short  => commit_short,
    :commit_subject     => message,
    :authored_date      => date,
    :authored_timestamp => timestamp,
    :commit_tag         => tag,
    :repo_last_tag      => last_tag
  }
end
last_tag() click to toggle source
# File lib/git-revision.rb, line 28
def last_tag
  `git describe --tags --abbrev=0`.strip
end
message() click to toggle source
# File lib/git-revision.rb, line 12
def message
  `git log -1 --pretty="format:%s"`
end
tag() click to toggle source
# File lib/git-revision.rb, line 24
def tag
  `git describe --exact-match #{commit}`.strip
end
timestamp() click to toggle source
# File lib/git-revision.rb, line 20
def timestamp
  `git log -1 --pretty="format:%at"`
end