Class: Integrity::Commit
- Includes:
- DataMapper::Resource
- Defined in:
- lib/integrity/commit.rb
Instance Method Summary collapse
- #author ⇒ Object
- #committed_at=(time_with_timezone) ⇒ Object
- #failed? ⇒ Boolean
- #human_readable_status ⇒ Object
- #message ⇒ Object
- #output ⇒ Object
- #pending? ⇒ Boolean
- #short_identifier ⇒ Object
- #status ⇒ Object
- #successful? ⇒ Boolean
Instance Method Details
#author ⇒ Object
24 25 26 27 |
# File 'lib/integrity/commit.rb', line 24 def attribute_get(:author) || Author.load('<Commit author not loaded> <<Commit author not loaded>>', :author) end |
#committed_at=(time_with_timezone) ⇒ Object
61 62 63 64 65 66 |
# File 'lib/integrity/commit.rb', line 61 def committed_at=(time_with_timezone) unless time_with_timezone.respond_to?(:utc) time_with_timezone = Time.parse(time_with_timezone) end attribute_set(:committed_at, time_with_timezone.utc) end |
#failed? ⇒ Boolean
41 42 43 |
# File 'lib/integrity/commit.rb', line 41 def failed? status == :failed end |
#human_readable_status ⇒ Object
49 50 51 52 53 54 55 |
# File 'lib/integrity/commit.rb', line 49 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
20 21 22 |
# File 'lib/integrity/commit.rb', line 20 def attribute_get(:message) || "<Commit message not loaded>" end |
#output ⇒ Object
57 58 59 |
# File 'lib/integrity/commit.rb', line 57 def output build && build.output end |
#pending? ⇒ Boolean
45 46 47 |
# File 'lib/integrity/commit.rb', line 45 def pending? status == :pending end |
#short_identifier ⇒ Object
29 30 31 |
# File 'lib/integrity/commit.rb', line 29 def short_identifier identifier.to_s[0..6] end |
#status ⇒ Object
33 34 35 |
# File 'lib/integrity/commit.rb', line 33 def status build.nil? ? :pending : build.status end |
#successful? ⇒ Boolean
37 38 39 |
# File 'lib/integrity/commit.rb', line 37 def successful? status == :success end |