Class: Danger::CISource::Drone

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

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) ⇒ Drone

Returns a new instance of Drone.



18
19
20
21
22
# File 'lib/danger/ci_source/drone.rb', line 18

def initialize(env)
  self.repo_slug = env["DRONE_REPO"]
  self.pull_request_id = env["DRONE_PULL_REQUEST"]
  self.repo_url = GitRepo.new.origins # Drone doesn't provide a repo url env variable :/
end

Class Method Details

.validates?(env) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
9
10
11
12
# File 'lib/danger/ci_source/drone.rb', line 6

def self.validates?(env)
  return false unless env["DRONE"]
  return false unless env["DRONE_REPO"]
  return false unless env["DRONE_PULL_REQUEST"].to_i > 0

  return true
end

Instance Method Details

#supported_request_sourcesObject



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

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