Class: BPCI::Commit
- Inherits:
-
Struct
- Object
- Struct
- BPCI::Commit
- Defined in:
- lib/bpci/commit.rb
Instance Attribute Summary collapse
-
#project ⇒ Object
Returns the value of attribute project.
-
#project_path ⇒ Object
Returns the value of attribute project_path.
-
#sha ⇒ Object
Returns the value of attribute sha.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
- #author ⇒ Object
- #committed_at ⇒ Object
- #message ⇒ Object
- #raw_commit ⇒ Object
- #raw_commit_lines ⇒ Object
- #url ⇒ Object
Instance Attribute Details
#project ⇒ Object
Returns the value of attribute project
2 3 4 |
# File 'lib/bpci/commit.rb', line 2 def project @project end |
#project_path ⇒ Object
Returns the value of attribute project_path
2 3 4 |
# File 'lib/bpci/commit.rb', line 2 def project_path @project_path end |
#sha ⇒ Object
Returns the value of attribute sha
2 3 4 |
# File 'lib/bpci/commit.rb', line 2 def sha @sha end |
#user ⇒ Object
Returns the value of attribute user
2 3 4 |
# File 'lib/bpci/commit.rb', line 2 def user @user end |
Instance Method Details
#author ⇒ Object
7 8 9 |
# File 'lib/bpci/commit.rb', line 7 def raw_commit_lines.grep(/Author:/).first.split(':', 2)[-1] end |
#committed_at ⇒ Object
11 12 13 |
# File 'lib/bpci/commit.rb', line 11 def committed_at raw_commit_lines.grep(/Date:/).first.split(':', 2)[-1] end |
#message ⇒ Object
15 16 17 |
# File 'lib/bpci/commit.rb', line 15 def raw_commit.split("\n\n", 3)[1].to_s.strip end |
#raw_commit ⇒ Object
19 20 21 |
# File 'lib/bpci/commit.rb', line 19 def raw_commit @raw_commit ||= `cd #{project_path} && git show #{sha}`.chomp end |
#raw_commit_lines ⇒ Object
23 24 25 |
# File 'lib/bpci/commit.rb', line 23 def raw_commit_lines @raw_commit_lines ||= raw_commit.split("\n") end |
#url ⇒ Object
3 4 5 |
# File 'lib/bpci/commit.rb', line 3 def url "http://github.com/#{user}/#{project}/commit/#{sha}" end |