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-additional-logging-0.0.23 lib/danger/ci_source/ci_source.rb
danger-additional-logging-0.0.22 lib/danger/ci_source/ci_source.rb
danger-additional-logging-0.0.21 lib/danger/ci_source/ci_source.rb
danger-additional-logging-0.0.20 lib/danger/ci_source/ci_source.rb
danger-additional-logging-0.0.19 lib/danger/ci_source/ci_source.rb
danger-additional-logging-0.0.18 lib/danger/ci_source/ci_source.rb
danger-additional-logging-0.0.17 lib/danger/ci_source/ci_source.rb
danger-additional-logging-0.0.16 lib/danger/ci_source/ci_source.rb
danger-additional-logging-0.0.15 lib/danger/ci_source/ci_source.rb
danger-additional-logging-0.0.14 lib/danger/ci_source/ci_source.rb
danger-additional-logging-0.0.13 lib/danger/ci_source/ci_source.rb
danger-additional-logging-0.0.12 lib/danger/ci_source/ci_source.rb
danger-additional-logging-0.0.11 lib/danger/ci_source/ci_source.rb
danger-additional-logging-0.0.10 lib/danger/ci_source/ci_source.rb
danger-additional-logging-0.0.9 lib/danger/ci_source/ci_source.rb
danger-additional-logging-0.0.8 lib/danger/ci_source/ci_source.rb
danger-additional-logging-0.0.7 lib/danger/ci_source/ci_source.rb
danger-additional-logging-0.0.6 lib/danger/ci_source/ci_source.rb
danger-additional-logging-0.0.5 lib/danger/ci_source/ci_source.rb
danger-additional-logging-0.0.4 lib/danger/ci_source/ci_source.rb