Class: RunLoop::CLI::Instruments

Inherits:
Thor
  • Object
show all
Defined in:
lib/run_loop/cli/instruments.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#signalObject

Returns the value of attribute signal.



9
10
11
# File 'lib/run_loop/cli/instruments.rb', line 9

def signal
  @signal
end

Instance Method Details

#launchObject



96
97
98
99
100
101
102
103
104
# File 'lib/run_loop/cli/instruments.rb', line 96

def launch
  launch_options = {
        :args => parse_app_launch_args(options),
        :udid => detect_device_udid_from_options(options),
        :bundle_dir_or_bundle_id => detect_bundle_id_or_bundle_path(options)
  }
  run_loop = RunLoop.run(launch_options)
  puts JSON.generate(run_loop)
end

#quitObject



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/run_loop/cli/instruments.rb', line 28

def quit
  signal = options[:signal]
  ENV['DEBUG'] = '1' if options[:debug]
  instruments = RunLoop::Instruments.new
  instruments.instruments_pids.each do |pid|
    terminator = RunLoop::ProcessTerminator.new(pid, signal, 'instruments')
    unless terminator.kill_process
      terminator = RunLoop::ProcessTerminator.new(pid, 'KILL', 'instruments')
      terminator.kill_process
    end
  end
end