class Omnibus::GitRepository

Attributes

repo_path[R]

Public Class Methods

new(path = "./") click to toggle source
# File lib/omnibus/git_repository.rb, line 7
def initialize(path = "./")
  @repo_path = path
end

Public Instance Methods

authors(start_ref, end_ref) click to toggle source
# File lib/omnibus/git_repository.rb, line 11
def authors(start_ref, end_ref)
  formatted_log_between(start_ref, end_ref, "%aN").lines.map(&:chomp).uniq
end
commit_messages(start_ref, end_ref) click to toggle source
# File lib/omnibus/git_repository.rb, line 15
def commit_messages(start_ref, end_ref)
  formatted_log_between(start_ref, end_ref, "%B").lines.to_a
end
file_at_revision(path, revision) click to toggle source
# File lib/omnibus/git_repository.rb, line 27
def file_at_revision(path, revision)
  git("show #{revision}:#{path}")
end
latest_tag() click to toggle source
# File lib/omnibus/git_repository.rb, line 23
def latest_tag
  git("describe --abbrev=0").chomp
end
revision() click to toggle source
# File lib/omnibus/git_repository.rb, line 19
def revision
  git("rev-parse HEAD").strip
end

Private Instance Methods

formatted_log_between(start_ref, end_ref, format) click to toggle source
# File lib/omnibus/git_repository.rb, line 35
def formatted_log_between(start_ref, end_ref, format)
  git("log #{start_ref}..#{end_ref} --pretty=\"format:#{format}\"")
end
git(cmd) click to toggle source
# File lib/omnibus/git_repository.rb, line 39
def git(cmd)
  shellout!("git #{cmd}", cwd: repo_path).stdout
end