Sha256: bb19545c6768cebcf5ec2170c7b4ec7a2ad36b4ee0582c64b0e2ff0fa68670db

Contents?: true

Size: 888 Bytes

Versions: 20

Compression:

Stored size: 888 Bytes

Contents

require "set"

module Danger
  # "abstract" CI class
  class CI
    attr_accessor :repo_slug, :pull_request_id, :repo_url, :supported_request_sources

    def self.inherited(child_class)
      available_ci_sources.add child_class
      super
    end

    def self.available_ci_sources
      @available_ci_sources ||= Set.new
    end

    def supported_request_sources
      raise "CISource subclass must specify the supported request sources"
    end

    def supports?(request_source)
      supported_request_sources.include? request_source
    end

    def self.validates_as_ci?(_env)
      abort "You need to include a function for #{self} for validates_as_ci?"
    end

    def self.validates_as_pr?(_env)
      abort "You need to include a function for #{self} for validates_as_pr?"
    end

    def initialize(_env)
      raise "Subclass and overwrite initialize"
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
danger-3.4.0 lib/danger/ci_source/ci_source.rb
danger-3.3.2 lib/danger/ci_source/ci_source.rb
danger-3.3.1 lib/danger/ci_source/ci_source.rb
danger-3.3.0 lib/danger/ci_source/ci_source.rb
danger-3.2.2 lib/danger/ci_source/ci_source.rb
danger-3.2.1 lib/danger/ci_source/ci_source.rb
danger-3.2.0 lib/danger/ci_source/ci_source.rb
danger-3.1.1 lib/danger/ci_source/ci_source.rb
danger-3.1.0 lib/danger/ci_source/ci_source.rb
danger-3.0.3 lib/danger/ci_source/ci_source.rb
danger-3.0.2 lib/danger/ci_source/ci_source.rb
danger-3.0.1 lib/danger/ci_source/ci_source.rb
danger-3.0.0 lib/danger/ci_source/ci_source.rb
danger-2.1.6 lib/danger/ci_source/ci_source.rb
danger-2.1.5 lib/danger/ci_source/ci_source.rb
danger-2.1.4 lib/danger/ci_source/ci_source.rb
danger-2.1.3 lib/danger/ci_source/ci_source.rb
danger-2.1.2 lib/danger/ci_source/ci_source.rb
danger-2.1.1 lib/danger/ci_source/ci_source.rb
danger-2.1.0 lib/danger/ci_source/ci_source.rb