Class: Envirobly::Git::Commit
- Inherits:
-
Object
- Object
- Envirobly::Git::Commit
- Defined in:
- lib/envirobly/git/commit.rb
Instance Method Summary collapse
- #exists? ⇒ Boolean
-
#initialize(ref) ⇒ Commit
constructor
A new instance of Commit.
- #message ⇒ Object
- #ref ⇒ Object
- #time ⇒ Object
Constructor Details
#initialize(ref) ⇒ Commit
Returns a new instance of Commit.
4 5 6 |
# File 'lib/envirobly/git/commit.rb', line 4 def initialize(ref) @ref = ref end |
Instance Method Details
#exists? ⇒ Boolean
8 9 10 |
# File 'lib/envirobly/git/commit.rb', line 8 def exists? `git cat-file -t #{@ref}`.strip == "commit" end |
#message ⇒ Object
16 17 18 |
# File 'lib/envirobly/git/commit.rb', line 16 def `git log #{@ref} -n1 --pretty=%B`.strip end |
#ref ⇒ Object
12 13 14 |
# File 'lib/envirobly/git/commit.rb', line 12 def ref @normalized_ref ||= `git rev-parse #{@ref}`.strip end |
#time ⇒ Object
20 21 22 |
# File 'lib/envirobly/git/commit.rb', line 20 def time Time.parse `git log #{@ref} -n1 --date=iso --pretty=format:"%ad"` end |