Sha256: daac29359841861c4a09fb6d962732eb8fcb58032b30df1baf2fce6101736de6

Contents?: true

Size: 632 Bytes

Versions: 1

Compression:

Stored size: 632 Bytes

Contents

# coding: utf-8

module Status
  class Jenkins
    def initialize(branch)
      @branch = branch
    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

1 entries across 1 versions & 1 rubygems

Version Path
update_status-0.2.0 lib/status/jenkins.rb