Sha256: cfbea8c475cf2830b860db80ee0b0899138d798d9561f457e82994771c7ee7cc
Contents?: true
Size: 1.17 KB
Versions: 1
Compression:
Stored size: 1.17 KB
Contents
module Perkins class BuildReport < ActiveRecord::Base belongs_to :repo def commit self.repo.load_git @commit ||= Perkins::Commit.new(self.sha, self.repo) 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] 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 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
perkins-0.0.3 | lib/perkins/build_report.rb |