Class: Bob::SCM::Git

Inherits:
Abstract show all
Defined in:
lib/bob/scm/git.rb

Instance Attribute Summary

Attributes inherited from Abstract

#branch, #uri

Instance Method Summary collapse

Methods inherited from Abstract

#initialize, #with_commit, #working_dir

Constructor Details

This class inherits a constructor from Bob::SCM::Abstract

Instance Method Details

#info(commit_id) ⇒ Object



4
5
6
7
8
9
# File 'lib/bob/scm/git.rb', line 4

def info(commit_id)
  format  = %Q(---%n:author: %an <%ae>%n:message: >-%n  %s%n:committed_at: %ci%n)
  YAML.load(`cd #{working_dir} && git show -s --pretty=format:"#{format}" #{commit_id}`).tap do |info|
    info[:committed_at] = Time.parse(info[:committed_at])
  end
end