Class: CurrentCommitRails::CommitBuilder
- Inherits:
-
Object
- Object
- CurrentCommitRails::CommitBuilder
- Defined in:
- lib/current_commit_rails/commit_builder.rb
Class Method Summary collapse
- .branch ⇒ Object
- .build(path) ⇒ Object
- .build_hash ⇒ Object
- .commit_hash ⇒ Object
- .get_repo(path) ⇒ Object
- .last_commit ⇒ Object
Class Method Details
.branch ⇒ Object
39 40 41 |
# File 'lib/current_commit_rails/commit_builder.rb', line 39 def branch @repo.head.name.sub(/^refs\/heads\//, '') end |
.build(path) ⇒ Object
7 8 9 10 |
# File 'lib/current_commit_rails/commit_builder.rb', line 7 def build(path) get_repo(path) build_hash end |
.build_hash ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/current_commit_rails/commit_builder.rb', line 16 def build_hash CurrentCommitRails.commit_hash = CommitHash.new( last_commit.oid, last_commit., last_commit.[:name], last_commit.[:email], last_commit.[:time], last_commit.committer[:name], last_commit.committer[:email], last_commit.committer[:time], last_commit.time, branch ) end |
.commit_hash ⇒ Object
35 36 37 |
# File 'lib/current_commit_rails/commit_builder.rb', line 35 def commit_hash @commit_hash end |
.get_repo(path) ⇒ Object
12 13 14 |
# File 'lib/current_commit_rails/commit_builder.rb', line 12 def get_repo path @repo ||= Rugged::Repository.new(path) end |
.last_commit ⇒ Object
31 32 33 |
# File 'lib/current_commit_rails/commit_builder.rb', line 31 def last_commit @repo.last_commit end |