Class: Omnibus::GitRepository

Inherits:
Object
  • Object
show all
Includes:
Util
Defined in:
lib/omnibus/git_repository.rb

Constant Summary

Constants included from Util

Util::SHELLOUT_OPTIONS

Instance Method Summary collapse

Methods included from Util

#copy_file, #create_directory, #create_file, #create_link, included, #remove_directory, #remove_file, #shellout, #shellout!, #windows_safe_path

Constructor Details

#initialize(path = './') ⇒ GitRepository

Returns a new instance of GitRepository



7
8
9
# File 'lib/omnibus/git_repository.rb', line 7

def initialize(path='./')
  @repo_path = path
end

Instance Method Details

#authors(start_ref, end_ref) ⇒ Object



11
12
13
# 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) ⇒ Object



15
16
17
# 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) ⇒ Object



27
28
29
# File 'lib/omnibus/git_repository.rb', line 27

def file_at_revision(path, revision)
  git("show #{revision}:#{path}")
end

#latest_tagObject



23
24
25
# File 'lib/omnibus/git_repository.rb', line 23

def latest_tag
  git('describe --abbrev=0').chomp
end

#revisionObject



19
20
21
# File 'lib/omnibus/git_repository.rb', line 19

def revision
  git("rev-parse HEAD").strip
end