Class: Integrity::Build
- Includes:
- DataMapper::Resource
- Defined in:
- lib/integrity/build.rb
Instance Method Summary collapse
- #commit_author ⇒ Object
- #commit_message ⇒ Object
- #commit_metadata ⇒ Object
- #commited_at ⇒ Object
- #failed? ⇒ Boolean
- #human_readable_status ⇒ Object
- #short_commit_identifier ⇒ Object
- #status ⇒ Object
Instance Method Details
#commit_author ⇒ Object
38 39 40 41 42 43 |
# File 'lib/integrity/build.rb', line 38 def @author ||= begin [:author] =~ /^(.*) <(.*)>$/ OpenStruct.new(:name => $1.strip, :email => $2.strip, :full => [:author]) end end |
#commit_message ⇒ Object
45 46 47 |
# File 'lib/integrity/build.rb', line 45 def [:message] end |
#commit_metadata ⇒ Object
31 32 33 34 35 36 |
# File 'lib/integrity/build.rb', line 31 def case data = attribute_get(:commit_metadata) when String; YAML.load(data) else data end end |
#commited_at ⇒ Object
49 50 51 52 53 54 |
# File 'lib/integrity/build.rb', line 49 def commited_at case [:date] when String then Time.parse([:date]) else [:date] end end |
#failed? ⇒ Boolean
15 16 17 |
# File 'lib/integrity/build.rb', line 15 def failed? !successful? end |
#human_readable_status ⇒ Object
23 24 25 |
# File 'lib/integrity/build.rb', line 23 def human_readable_status successful? ? "Build Successful" : "Build Failed" end |
#short_commit_identifier ⇒ Object
27 28 29 |
# File 'lib/integrity/build.rb', line 27 def short_commit_identifier sha1?(commit_identifier) ? commit_identifier[0..6] : commit_identifier end |
#status ⇒ Object
19 20 21 |
# File 'lib/integrity/build.rb', line 19 def status successful? ? :success : :failed end |