Sha256: c63d963481b92acd126c41eaf01135ac53f6a8d17e5756c8b15703e3364f0a5b
Contents?: true
Size: 643 Bytes
Versions: 1
Compression:
Stored size: 643 Bytes
Contents
require "git" class LastCommit def initialize(git_repository_path, branch) self.git_repository_path = git_repository_path self.branch = branch end def author last_commit.author.name end def message last_commit.message end def sha last_commit.sha end private attr_accessor :git_repository_path, :branch def git_repository @git_repository ||= Git.open(git_repository_path) end def requested_branch @requested_branch ||= git_repository.branches[branch] or raise ArgumentError, "branch does not exist" end def last_commit requested_branch.gcommit end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
last_commit-0.1.0 | lib/last_commit.rb |