Class: Integrity::Commit
- Includes:
- DataMapper::Resource
- Defined in:
- lib/integrity/commit.rb
Instance Method Summary collapse
- #author ⇒ Object (also: #commit_author)
- #failed? ⇒ Boolean
- #human_readable_status ⇒ Object
- #message ⇒ Object (also: #commit_message)
- #output ⇒ Object
- #pending? ⇒ Boolean
- #queue_build ⇒ Object
- #short_identifier ⇒ Object (also: #short_commit_identifier)
- #status ⇒ Object
- #successful? ⇒ Boolean
Instance Method Details
#author ⇒ Object Also known as:
20 21 22 |
# File 'lib/integrity/commit.rb', line 20 def attribute_get(:author) || Author.load('<Commit author not loaded> <<Commit author not loaded>>', :author) end |
#failed? ⇒ Boolean
36 37 38 |
# File 'lib/integrity/commit.rb', line 36 def failed? status == :failed end |
#human_readable_status ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/integrity/commit.rb', line 44 def human_readable_status case status when :success; "Built #{short_identifier} successfully" when :failed; "Built #{short_identifier} and failed" when :pending; "#{short_identifier} hasn't been built yet" end end |
#message ⇒ Object Also known as: commit_message
16 17 18 |
# File 'lib/integrity/commit.rb', line 16 def attribute_get(:message) || "<Commit message not loaded>" end |
#output ⇒ Object
52 53 54 |
# File 'lib/integrity/commit.rb', line 52 def output build && build.output end |
#pending? ⇒ Boolean
40 41 42 |
# File 'lib/integrity/commit.rb', line 40 def pending? status == :pending end |
#queue_build ⇒ Object
56 57 58 59 60 61 62 |
# File 'lib/integrity/commit.rb', line 56 def queue_build self.build = Build.create(:commit_id => id) self.save # Build on foreground (this will move away, I promise) ProjectBuilder.new(project).build(self) end |
#short_identifier ⇒ Object Also known as: short_commit_identifier
24 25 26 |
# File 'lib/integrity/commit.rb', line 24 def short_identifier identifier.to_s[0..6] end |
#status ⇒ Object
28 29 30 |
# File 'lib/integrity/commit.rb', line 28 def status build.nil? ? :pending : build.status end |
#successful? ⇒ Boolean
32 33 34 |
# File 'lib/integrity/commit.rb', line 32 def successful? status == :success end |