Module: XCKnife::XcschemeAnalyzer

Extended by:
XcschemeAnalyzer
Included in:
XcschemeAnalyzer
Defined in:
lib/xcknife/xcscheme_analyzer.rb

Instance Method Summary collapse

Instance Method Details

#extract_environment_variables(xscheme_data) ⇒ Object


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/xcknife/xcscheme_analyzer.rb', line 9

def extract_environment_variables(xscheme_data)
  ret = {}
  xml_root = REXML::Document.new(xscheme_data).root

  action = xml_root.elements['//TestAction']
  return ret if action.nil?

  action = xml_root.elements['//LaunchAction'] if action.attributes['shouldUseLaunchSchemeArgsEnv'] == 'YES'
  return ret if action.nil?

  env_elements = action.elements['.//EnvironmentVariables']
  return ret if env_elements.nil?

  env_elements.elements.each do |e|
    attrs = e.attributes
    ret[attrs['key']] = attrs['value'] if attrs['isEnabled'] == 'YES'
  end
  ret
end