Sha256: 5f15eafb5c8f325b2ba488916ad7182c5c58bb12c1f83eeb4e3f0463c6dced5a
Contents?: true
Size: 949 Bytes
Versions: 1
Compression:
Stored size: 949 Bytes
Contents
class Status < ActiveRecord::Base STATES = %w(pending success failure error).freeze enum state: STATES.zip(STATES).to_h belongs_to :commit, touch: true validates :state, inclusion: {in: STATES, allow_blank: true}, presence: true after_create :enable_ci_on_stack after_commit :schedule_continuous_delivery, :broadcast_update, on: :create after_commit :touch_commit delegate :broadcast_update, to: :commit def self.replicate_from_github!(github_status) find_or_create_by!( state: github_status.state, description: github_status.description, target_url: github_status.rels.try(:[], :target).try(:href), context: github_status.context, created_at: github_status.created_at.to_s(:db), ) end private def enable_ci_on_stack commit.stack.enable_ci! end def touch_commit commit.touch end def schedule_continuous_delivery commit.schedule_continuous_delivery end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
shipit-engine-0.0.1.pre | app/models/status.rb |