Sha256: 81b060014cb554c3dff126140d48ef3ece13f12268d9c653be67f33e4e63667b

Contents?: true

Size: 870 Bytes

Versions: 4

Compression:

Stored size: 870 Bytes

Contents

# https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-JenkinsSetEnvironmentVariables
# https://wiki.jenkins-ci.org/display/JENKINS/GitHub+pull+request+builder+plugin

module Danger
  module CISource
    # https://jenkins-ci.org
    class Jenkins < CI
      def self.validates?(env)
        return false unless env["ghprbPullId"].to_i > 0
        return false unless env["GIT_URL"]

        return true
      end

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

      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
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
danger-2.0.1 lib/danger/ci_source/jenkins.rb
danger-2.0.0 lib/danger/ci_source/jenkins.rb
danger-0.10.1 lib/danger/ci_source/jenkins.rb
danger-0.10.0 lib/danger/ci_source/jenkins.rb