Class: Push
Instance Attribute Summary collapse
-
#parsed_payload ⇒ Object
Returns the value of attribute parsed_payload.
Class Method Summary collapse
Instance Method Summary collapse
- #[](property) ⇒ Object
- #branch ⇒ Object
- #find_repository ⇒ Object
- #master? ⇒ Boolean
- #repo_name ⇒ Object
- #repo_url ⇒ Object
- #short_commit_hash ⇒ Object
- #tracked? ⇒ Boolean
Instance Attribute Details
#parsed_payload ⇒ Object
Returns the value of attribute parsed_payload.
34 35 36 |
# File 'app/models.rb', line 34 def parsed_payload @parsed_payload end |
Class Method Details
.deployed ⇒ Object
92 93 94 |
# File 'app/models.rb', line 92 def self.deployed Push.all(:status=>:deployed) end |
Instance Method Details
#[](property) ⇒ Object
68 69 70 |
# File 'app/models.rb', line 68 def [](property) parse_payload[property] end |
#branch ⇒ Object
80 81 82 |
# File 'app/models.rb', line 80 def branch self['ref'].split('/').last end |
#find_repository ⇒ Object
96 97 98 |
# File 'app/models.rb', line 96 def find_repository Repository.first(:name=>repo_name, :branch=>branch) end |
#master? ⇒ Boolean
84 85 86 |
# File 'app/models.rb', line 84 def master? branch == 'master' end |
#repo_name ⇒ Object
76 77 78 |
# File 'app/models.rb', line 76 def repo_name self['repository']['name'] end |
#repo_url ⇒ Object
72 73 74 |
# File 'app/models.rb', line 72 def repo_url self['repository']['url'] end |
#short_commit_hash ⇒ Object
88 89 90 |
# File 'app/models.rb', line 88 def short_commit_hash self['after'][0..6] end |
#tracked? ⇒ Boolean
64 65 66 |
# File 'app/models.rb', line 64 def tracked? Repository.ordered.any? { |r| r.name == repo_name && r.branch == branch } end |