Class: Danger::CISource::Travis

Inherits:
CI
  • Object
show all
Defined in:
lib/danger/ci_source/travis.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) ⇒ Travis

Returns a new instance of Travis.



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

def initialize(env)
  self.repo_slug = env["TRAVIS_REPO_SLUG"]
  if env["TRAVIS_PULL_REQUEST"].to_i > 0
    self.pull_request_id = env["TRAVIS_PULL_REQUEST"]
  end
  self.repo_url = GitRepo.new.origins # Travis doesn't provide a repo url env variable :/
end

Class Method Details

.validates?(env) ⇒ Boolean

Returns:

  • (Boolean)


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

def self.validates?(env)
  return false unless env["HAS_JOSH_K_SEAL_OF_APPROVAL"]
  return false unless env["TRAVIS_REPO_SLUG"]
  return false unless env["TRAVIS_PULL_REQUEST"]

  return true
end

Instance Method Details

#supported_request_sourcesObject



16
17
18
# File 'lib/danger/ci_source/travis.rb', line 16

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