Sha256: 33ca882f7c01be2d9408464ec8a8bac85ce1d21adf8d700174f9a4578408fd66

Contents?: true

Size: 758 Bytes

Versions: 6

Compression:

Stored size: 758 Bytes

Contents

require 'rexml/document'

module XCKnife
  module XcschemeAnalyzer
    extend self

    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?
      if action.attributes['shouldUseLaunchSchemeArgsEnv'] == "YES"
        action = xml_root.elements["//LaunchAction"]
      end
      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
        if attrs["isEnabled"] == "YES"
          ret[attrs["key"]] = attrs["value"]
        end
      end
      ret
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
xcknife-0.11.1 lib/xcknife/xcscheme_analyzer.rb
xcknife-0.11.0 lib/xcknife/xcscheme_analyzer.rb
xcknife-0.10.0 lib/xcknife/xcscheme_analyzer.rb
xcknife-0.6.6 lib/xcknife/xcscheme_analyzer.rb
xcknife-0.6.5 lib/xcknife/xcscheme_analyzer.rb
xcknife-0.6.4 lib/xcknife/xcscheme_analyzer.rb