Method: RunLoop::Core.default_tracetemplate

Defined in:
lib/run_loop/core.rb

.default_tracetemplate(instruments = RunLoop::Instruments.new) ⇒ Object



721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
# File 'lib/run_loop/core.rb', line 721

def self.default_tracetemplate(instruments=RunLoop::Instruments.new)

  templates = instruments.templates

  # xcrun instruments -s templates
  # Xcode >= 6 will return known, Apple defined tracetemplates as names
  #  e.g.  Automation, Zombies, Allocations
  #
  # Xcode < 6 will return known, Apple defined tracetemplates as paths.
  #
  # Xcode 6 Beta versions also return paths, but revert to 'normal'
  # behavior when GM is released.
  #
  # Xcode 7 Beta versions appear to behavior like Xcode 6 Beta versions.
  template = templates.find { |name| name == 'Automation' }
  return template if template

  candidate = templates.find do |path|
    path =~ /\/Automation.tracetemplate/ and path =~ /Xcode/
  end

  if !candidate.nil?
    return candidate.tr("\"", '').strip
  end

  message = ['Expected instruments to report an Automation tracetemplate.',
          'Please report this as bug:  https://github.com/calabash/run_loop/issues',
          "In the bug report, include the output of:\n",
          '$ xcrun xcodebuild -version',
          "$ xcrun instruments -s templates\n"]
  raise message.join("\n")
end