Method: RunLoop::Core.default_tracetemplate

Defined in:
lib/run_loop/core.rb

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

Raises:

  • (RuntimeError)


524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
# File 'lib/run_loop/core.rb', line 524

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

  templates = instruments.templates

  if instruments.xcode.version_gte_8?
    raise(RuntimeError, %Q[

There is no Automation template for this #{instruments.xcode} version.

])
  end

  # 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

  raise(RuntimeError, %Q[
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:

$ xcrun xcodebuild -version
$ xcrun instruments -s templates
])
end