Sha256: d58672fa8520f43bcc7a0098dad9c56d11a46e18bf2d955cdd4528e31016b8c0

Contents?: true

Size: 763 Bytes

Versions: 1

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

1 entries across 1 versions & 1 rubygems

Version Path
danger-0.8.5 lib/danger/ci_source/ci_source.rb