Sha256: 6ef2d755d032218866364a37c517f7d4406228d39d403efa9ff61d2159f7e26b

Contents?: true

Size: 543 Bytes

Versions: 3

Compression:

Stored size: 543 Bytes

Contents

# coding: utf-8

module Status
  module Jenkins
    extend self

    def state
      return "Green" if pass?
      "building"
    end

    def pass?
      @status ||= get_ci_status
      return false if @status == "building" || @status == "not found"
      true
    end

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
update_status-0.1.2 lib/status/jenkins.rb
update_status-0.1.1 lib/status/jenkins.rb
update_status-0.1.0 lib/status/jenkins.rb