Sha256: 5f2b8aedabcf5ff63f50d9a02cdb9999cf5bcc8fb88562d192b67c56c978f5a0

Contents?: true

Size: 763 Bytes

Versions: 6

Compression:

Stored size: 763 Bytes

Contents

require "set"

module Danger
  module CISource
    # "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?(_env)
        false
      end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
danger-2.0.1 lib/danger/ci_source/ci_source.rb
danger-2.0.0 lib/danger/ci_source/ci_source.rb
danger-0.10.1 lib/danger/ci_source/ci_source.rb
danger-0.10.0 lib/danger/ci_source/ci_source.rb
danger-0.9.1 lib/danger/ci_source/ci_source.rb
danger-0.9.0 lib/danger/ci_source/ci_source.rb