Sha256: 9e664124016cd99ca6fcaeec9074d41b8de4dad8fd9d534807c4124b51aca8e7
Contents?: true
Size: 1.65 KB
Versions: 1
Compression:
Stored size: 1.65 KB
Contents
module Perkins class BuildReport < ActiveRecord::Base belongs_to :repo after_create :enqueue serialize :commit def enqueue BuildWorker.perform_async(self.id, sha, branch ) end #def formatted_commit #self.repo.load_git # self.commit ||= $github_client.commits(repo.name, sha) # Perkins::Commit.new(self.commit) #end def retrieve_commit_info hsh = $github_client.commits(repo.name, sha).first.to_attrs self.commit = hsh self.save end def send_github_status(sha) self.repo.git self.build_status_report(sha) end def as_json(options = {}) data = {} unless fields = options[:only] fields = [:id, :sha, :commit, :branch, :build_time, :status, :duration, :build_time, :response, :build_status] end fields.each { |k| data[k] = send(k) } data end # Status report to GITHUB repo def build_status_report(sha) $github_client.create_status( self.repo.name, sha, github_state, { context: "Perkins CI", description: github_state_description , target_url: github_state_url } ) end def github_state self.status ? "success" : "failure" end def github_state_description d = "- The Perkins CI build" d = self.status ? "passed" : "fail" end def github_state_url "#{Perkins::Application.instance.sse_endpoint}/repos/#{repo.name}/builds/#{self.id}" end def start! update_attribute(:build_status, "started") end def stop! update_attribute(:build_status, "stopped") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
perkins-0.0.5 | lib/perkins/build_report.rb |