Class: Danger::CISource::XcodeServer

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

Returns a new instance of XcodeServer.



17
18
19
20
21
22
23
24
25
26
# File 'lib/danger/ci_source/xcode_server.rb', line 17

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

Class Method Details

.validates?(env) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
10
11
# File 'lib/danger/ci_source/xcode_server.rb', line 7

def self.validates?(env)
  return false unless env["XCS_BOT_NAME"]

  return true
end

Instance Method Details

#supported_request_sourcesObject



13
14
15
# File 'lib/danger/ci_source/xcode_server.rb', line 13

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