Class: Danger::CI

Inherits:
Object
  • Object
show all
Defined in:
lib/danger/ci_source/ci_source.rb

Overview

“abstract” CI class

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_env) ⇒ CI

Returns a new instance of CI.



33
34
35
# File 'lib/danger/ci_source/ci_source.rb', line 33

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

Instance Attribute Details

#pull_request_idObject

Returns the value of attribute pull_request_id.



6
7
8
# File 'lib/danger/ci_source/ci_source.rb', line 6

def pull_request_id
  @pull_request_id
end

#repo_slugObject

Returns the value of attribute repo_slug.



6
7
8
# File 'lib/danger/ci_source/ci_source.rb', line 6

def repo_slug
  @repo_slug
end

#repo_urlObject

Returns the value of attribute repo_url.



6
7
8
# File 'lib/danger/ci_source/ci_source.rb', line 6

def repo_url
  @repo_url
end

#supported_request_sourcesObject

Returns the value of attribute supported_request_sources.



6
7
8
# File 'lib/danger/ci_source/ci_source.rb', line 6

def supported_request_sources
  @supported_request_sources
end

Class Method Details

.available_ci_sourcesObject



13
14
15
# File 'lib/danger/ci_source/ci_source.rb', line 13

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

.inherited(child_class) ⇒ Object



8
9
10
11
# File 'lib/danger/ci_source/ci_source.rb', line 8

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

.validates_as_ci?(_env) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/danger/ci_source/ci_source.rb', line 25

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

.validates_as_pr?(_env) ⇒ Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/danger/ci_source/ci_source.rb', line 29

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

Instance Method Details

#supports?(request_source) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/danger/ci_source/ci_source.rb', line 21

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