Sha256: a9b3f4bcaa4ec597051c98875375290b35687c9cb0f7771bbb4b83fb3ebd8b0a
Contents?: true
Size: 1.35 KB
Versions: 1
Compression:
Stored size: 1.35 KB
Contents
module Integrity class Commit include DataMapper::Resource property :id, Serial property :identifier, String, :nullable => false property :message, String, :length => 255 property :author, Author, :length => 255 property :committed_at, DateTime timestamps :at has 1, :build, :class_name => "Integrity::Build", :order => [:created_at.desc] belongs_to :project, :class_name => "Integrity::Project", :child_key => [:project_id] def message attribute_get(:message) || "<Commit message not loaded>" end def author attribute_get(:author) || Author.load('<Commit author not loaded> <<Commit author not loaded>>', :author) end def short_identifier identifier.to_s[0..6] end def status build.nil? ? :pending : build.status end def successful? status == :success end def failed? status == :failed end def pending? status == :pending end 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 def output build && build.output end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
integrity-0.1.11 | lib/integrity/commit.rb |