module XCTestRunner::BuildEnvironment

Public Instance Methods

current_environment(build_command) click to toggle source
# File lib/xctest-runner/build-environment.rb, line 8
def current_environment(build_command)
  env = {}
  settings = execute_command("#{build_command} -showBuildSettings test")
  settings.each_line do |line|
    if line.strip.start_with?('Build settings')
      break if env.include?('EXECUTABLE_FOLDER_PATH') && env['EXECUTABLE_FOLDER_PATH'].end_with?('.xctest')
    elsif line =~ /^\s(.*)=(.*)/
      variable, value = line.split('=')
      env[variable.strip] = value.strip
    end
  end
  env
end
default_scheme(build_command) click to toggle source
# File lib/xctest-runner/build-environment.rb, line 26
def default_scheme(build_command)
  unless @default_scheme
    scheme = nil
    is_scheme = false

    output = xcodebuild_list(build_command)
    output.each_line do |line|
      line = line.strip
      if line =~ /\w+:/
        is_scheme = ('Schemes:' == line)
      elsif is_scheme
        scheme = line if scheme.nil? || line.end_with?('Tests')
      end
    end
    @default_scheme = scheme
  end
  @default_scheme
end
xcodebuild_list(build_command) click to toggle source
# File lib/xctest-runner/build-environment.rb, line 22
def xcodebuild_list(build_command)
  execute_command("#{build_command} -list")
end