Sha256: 5321124e1c572e87d6e1e9038a90fd7a3be33a0273dd53844daffb77b9a68ed1

Contents?: true

Size: 931 Bytes

Versions: 43

Compression:

Stored size: 931 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" if method(__method__).owner == Danger::CI
    end
  end
end

Version data entries

43 entries across 43 versions & 2 rubygems

Version Path
danger-9.5.1 lib/danger/ci_source/ci_source.rb
danger-9.5.0 lib/danger/ci_source/ci_source.rb
danger-9.4.3 lib/danger/ci_source/ci_source.rb
danger-9.4.2 lib/danger/ci_source/ci_source.rb
danger-9.4.1 lib/danger/ci_source/ci_source.rb
danger-9.4.0 lib/danger/ci_source/ci_source.rb
danger-9.3.2 lib/danger/ci_source/ci_source.rb
danger-additional-logging-0.0.36 lib/danger/ci_source/ci_source.rb
danger-additional-logging-0.0.35 lib/danger/ci_source/ci_source.rb
danger-additional-logging-0.0.34 lib/danger/ci_source/ci_source.rb
danger-additional-logging-0.0.33 lib/danger/ci_source/ci_source.rb
danger-additional-logging-0.0.32 lib/danger/ci_source/ci_source.rb
danger-additional-logging-0.0.31 lib/danger/ci_source/ci_source.rb
danger-additional-logging-0.0.30 lib/danger/ci_source/ci_source.rb
danger-additional-logging-0.0.29 lib/danger/ci_source/ci_source.rb
danger-additional-logging-0.0.28 lib/danger/ci_source/ci_source.rb
danger-additional-logging-0.0.27 lib/danger/ci_source/ci_source.rb
danger-additional-logging-0.0.26 lib/danger/ci_source/ci_source.rb
danger-additional-logging-0.0.25 lib/danger/ci_source/ci_source.rb
danger-additional-logging-0.0.24 lib/danger/ci_source/ci_source.rb