Class: Danger::Cirrus

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

Overview

### CI Setup You need to edit your ‘.cirrus.yml` to include `bundler exec danger`.

Adding this to your ‘.cirrus.yml` allows Danger to fail your build, both on the Cirrus CI website and within your Pull Request. With that set up, you can edit your task to add `bundler exec danger` in any script instruction.

Instance Attribute Summary

Attributes inherited from CI

#pull_request_id, #repo_slug, #repo_url

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CI

available_ci_sources, inherited, #supports?

Constructor Details

#initialize(env) ⇒ Cirrus

Returns a new instance of Cirrus.



23
24
25
26
27
28
29
# File 'lib/danger/ci_source/cirrus.rb', line 23

def initialize(env)
  self.repo_slug = env["CIRRUS_REPO_FULL_NAME"]
  if env["CIRRUS_PR"].to_i > 0
    self.pull_request_id = env["CIRRUS_PR"]
  end
  self.repo_url = env["CIRRUS_GIT_CLONE_URL"]
end

Class Method Details

.validates_as_ci?(env) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/danger/ci_source/cirrus.rb', line 10

def self.validates_as_ci?(env)
  env.key? "CIRRUS_CI"
end

.validates_as_pr?(env) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
17
# File 'lib/danger/ci_source/cirrus.rb', line 14

def self.validates_as_pr?(env)
  exists = ["CIRRUS_PR", "CIRRUS_REPO_FULL_NAME"].all? { |x| env[x] && !env[x].empty? }
  exists && env["CIRRUS_PR"].to_i > 0
end

Instance Method Details

#supported_request_sourcesObject



19
20
21
# File 'lib/danger/ci_source/cirrus.rb', line 19

def supported_request_sources
  @supported_request_sources ||= [Danger::RequestSources::GitHub]
end