Sha256: c265e9d1343adfe653078a717091ec308280470b7c0b5c02a76fc7129eb3d711

Contents?: true

Size: 870 Bytes

Versions: 1

Compression:

Stored size: 870 Bytes

Contents

# Following the advice from @czechboy0 https://github.com/danger/danger/issues/171

module Danger
  module CISource
    class XcodeServer < CI
      def self.validates?(env)
        return false unless env['XCS_BOT_NAME']

        return true
      end

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

      def initialize(env)
        bot_name = env['XCS_BOT_NAME']
        return if bot_name.nil?

        repo_matches = bot_name.match(/\[(.+)\]/)
        self.repo_slug = repo_matches[1] unless repo_matches.nil?
        pull_request_id_matches = bot_name.match(/#(\d+)/)
        self.pull_request_id = pull_request_id_matches[1] unless pull_request_id_matches.nil?
        self.repo_url = GitRepo.new.origins # Xcode Server doesn't provide a repo url env variable :/
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
danger-0.8.5 lib/danger/ci_source/xcode_server.rb