Class: Danger::CISource::Jenkins

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

Overview

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

Returns a new instance of Jenkins.



19
20
21
22
23
24
25
# File 'lib/danger/ci_source/jenkins.rb', line 19

def initialize(env)
  self.repo_url = env["GIT_URL"]
  self.pull_request_id = env["ghprbPullId"]

  repo_matches = self.repo_url.match(%r{([\/:])([^\/]+\/[^\/.]+)(?:.git)?$})
  self.repo_slug = repo_matches[2] unless repo_matches.nil?
end

Class Method Details

.validates?(env) ⇒ Boolean

Returns:

  • (Boolean)


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

def self.validates?(env)
  return false unless env["ghprbPullId"].to_i > 0
  return false unless env["GIT_URL"]

  return true
end

Instance Method Details

#supported_request_sourcesObject



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

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