Class: Danger::XcodeServer
- Defined in:
- lib/danger/ci_source/xcode_server.rb
Overview
### CI Setup
If you’re bold enough to use Xcode Bots. You will need to use [Buildasaur](github.com/czechboy0/Buildasaur) in order to work with Danger. This will set up your build environment for you, as the name of the bot contains all of the environment variables that Danger needs to work.
With Buildasaur set up, you can edit your job to add ‘bundle exec danger` as a post-action build script.
### Token Setup
As this is self-hosted, you will need to add the ‘DANGER_GITHUB_API_TOKEN` to your build user’s ENV. The alternative is to pass in the token as a prefix to the command ‘DANGER_GITHUB_API_TOKEN=“123” bundle exec danger`.`.
Instance Attribute Summary
Attributes inherited from CI
#pull_request_id, #repo_slug, #repo_url
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(env) ⇒ XcodeServer
constructor
A new instance of XcodeServer.
- #supported_request_sources ⇒ Object
Methods inherited from CI
available_ci_sources, inherited, #supports?
Constructor Details
#initialize(env) ⇒ XcodeServer
Returns a new instance of XcodeServer.
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/danger/ci_source/xcode_server.rb', line 32 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_as_ci?(env) ⇒ Boolean
19 20 21 |
# File 'lib/danger/ci_source/xcode_server.rb', line 19 def self.validates_as_ci?(env) env.key? "XCS_BOT_NAME" end |
.validates_as_pr?(env) ⇒ Boolean
23 24 25 26 |
# File 'lib/danger/ci_source/xcode_server.rb', line 23 def self.validates_as_pr?(env) value = env["XCS_BOT_NAME"] !value.nil? && value.include?("BuildaBot") end |
Instance Method Details
#supported_request_sources ⇒ Object
28 29 30 |
# File 'lib/danger/ci_source/xcode_server.rb', line 28 def supported_request_sources @supported_request_sources ||= [Danger::RequestSources::GitHub] end |