class Danger::DotCi

### CI Setup DotCi is a layer on top of jenkins. So, if you’re using DotCi, you’re hosting your own environment.

### Token Setup

#### GitHub As you own the machine, it’s up to you to add the environment variable for the ‘DANGER_GITHUB_API_TOKEN`.

Public Class Methods

new(env) click to toggle source
# File lib/danger/ci_source/dotci.rb, line 29
def initialize(env)
  self.repo_url = self.class.repo_url(env)
  self.pull_request_id = self.class.pull_request_id(env)
  repo_matches = self.repo_url.match(%r{([/:])([^/]+/[^/]+)$})
  self.repo_slug = repo_matches[2].gsub(/\.git$/, "") unless repo_matches.nil?
end
pull_request_id(env) click to toggle source
# File lib/danger/ci_source/dotci.rb, line 36
def self.pull_request_id(env)
  env["DOTCI_PULL_REQUEST"]
end
repo_url(env) click to toggle source
# File lib/danger/ci_source/dotci.rb, line 40
def self.repo_url(env)
  if env["DOTCI_INSTALL_PACKAGES_GIT_CLONE_URL"]
    env["DOTCI_INSTALL_PACKAGES_GIT_CLONE_URL"]
  elsif env["DOTCI_DOCKER_COMPOSE_GIT_CLONE_URL"]
    env["DOTCI_DOCKER_COMPOSE_GIT_CLONE_URL"]
  else
    env["GIT_URL"]
  end
end
validates_as_ci?(env) click to toggle source
# File lib/danger/ci_source/dotci.rb, line 15
def self.validates_as_ci?(env)
  env.key? "DOTCI"
end
validates_as_pr?(env) click to toggle source
# File lib/danger/ci_source/dotci.rb, line 19
def self.validates_as_pr?(env)
  !env["DOTCI_PULL_REQUEST"].nil? && !env["DOTCI_PULL_REQUEST"].match(/^[0-9]+$/).nil?
end

Public Instance Methods

supported_request_sources() click to toggle source
# File lib/danger/ci_source/dotci.rb, line 23
def supported_request_sources
  @supported_request_sources ||= [
    Danger::RequestSources::GitHub
  ]
end