Method: RunLoop::Core.default_tracetemplate

Defined in:
lib/run_loop/core.rb

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



488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
# File 'lib/run_loop/core.rb', line 488

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