Sha256: edf4b03327a8eea4d012da1ce2269fd71a474a18ee02fba6ad958488ce0bb7e3

Contents?: true

Size: 862 Bytes

Versions: 4

Compression:

Stored size: 862 Bytes

Contents

# http://docs.travis-ci.com/user/osx-ci-environment/
# http://docs.travis-ci.com/user/environment-variables/

module Danger
  module CISource
    # https://travis-ci.com
    class Travis < CI
      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

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

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