Sha256: 711ce9eb675f3f63910fc92eee68bf8680f92f70aacc609c00a1999ac5a49f4f

Contents?: true

Size: 648 Bytes

Versions: 2

Compression:

Stored size: 648 Bytes

Contents

# coding: utf-8

module Status
  class Jenkins
    def initialize(branch)
      @branch = branch.gsub(/\//, "_")
    end

    def state
      return "success" if pass?
      @status
    end

    def pass?
      @status ||= get_ci_status
      return false unless @status == "success"
      true
    end

    def get_ci_status
      response = Request.new(:ci).get(path)
      return "pending" if response == "not found"
      return "pending" if response["building"] == true
      return "failure" unless response["result"].downcase == "success"
       "success"
    end

    def path
      "/job/#{@branch}/lastBuild/api/json"
    end
  end
end


Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
update_status-0.2.2 lib/status/jenkins.rb
update_status-0.2.1 lib/status/jenkins.rb