Class: Thrust::SchemeParser

Inherits:
Object
  • Object
show all
Defined in:
lib/thrust/scheme_parser.rb

Instance Method Summary collapse

Instance Method Details

#parse_environment_variables(scheme, xcodeproj_path = nil) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/thrust/scheme_parser.rb', line 5

def parse_environment_variables(scheme, xcodeproj_path = nil)
  config = load_scheme(scheme, xcodeproj_path)

  env = {}

  if config['Scheme']['LaunchAction']['EnvironmentVariables']
    environment_variables = config['Scheme']['LaunchAction']['EnvironmentVariables']['EnvironmentVariable']
    environment_variables = [environment_variables] unless environment_variables.is_a?(Array)

    environment_variables.each do |environment_variable|
      if environment_variable['@isEnabled'] == 'YES'
       env[environment_variable['@key']] = environment_variable['@value']
      end
    end
  end

  env
end