Sha256: 5461e949ab67462f67297314ac25156012a6fd53c74f27c95ea659e3b5c74854
Contents?: true
Size: 1.27 KB
Versions: 2
Compression:
Stored size: 1.27 KB
Contents
module DeepThought module CIService class CIServiceNotFoundError < StandardError; end class CIServiceSetupFailedError < StandardError; end class CIBuildNotGreenError < StandardError; end class CIProjectAccessError < StandardError; end class << self attr_accessor :adapters, :ci_service end def self.adapters @adapters ||= {} end def self.register_adapter(name, service) self.adapters[name] = service end def self.setup(settings) if settings['CI_SERVICE'] if @adapters.keys.include?(settings['CI_SERVICE']) klass = adapters[settings['CI_SERVICE']] @ci_service = klass.new if !@ci_service.setup?(settings) raise CIServiceSetupFailedError, "CI service setup failed - check the CI service and project settings." end else raise CIServiceNotFoundError, "I don't have a CI service called \"#{settings['CI_SERVICE']}\"." end end end def self.is_branch_green?(app, branch, hash) begin @ci_service.is_branch_green?(app, branch, hash) rescue raise CIProjectAccessError, "Something went wrong asking #{ENV['CI_SERVICE']} about commit #{hash} in #{app} on the #{branch} branch." end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
deep_thought-0.2.1 | lib/deep_thought/ci_service.rb |
deep_thought-0.1.1 | lib/deep_thought/ci_service.rb |