Class: RunLoop::CLI::Simctl
- Inherits:
-
Thor
- Object
- Thor
- RunLoop::CLI::Simctl
- Defined in:
- lib/run_loop/cli/simctl.rb
Instance Attribute Summary collapse
-
#simctl ⇒ Object
readonly
Returns the value of attribute simctl.
Instance Method Summary collapse
Instance Attribute Details
#simctl ⇒ Object (readonly)
Returns the value of attribute simctl.
9 10 11 |
# File 'lib/run_loop/cli/simctl.rb', line 9 def simctl @simctl end |
Instance Method Details
#booted ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/run_loop/cli/simctl.rb', line 30 def booted device = booted_device if device.nil? version = xcode.version puts "No simulator for active Xcode (version #{version}) is booted." else puts device end end |
#doctor ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/run_loop/cli/simctl.rb', line 55 def doctor debug = [:debug] device = [:device] manage_processes if device RunLoop::Environment.with_debugging(debug) do RunLoop::CoreSimulator.erase(device) launch_simulator(device, xcode) end else RunLoop::Environment.with_debugging(debug) do erase_and_launch_each_simulator end end end |
#install ⇒ Object
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
# File 'lib/run_loop/cli/simctl.rb', line 170 def install debug = [:debug] device = expect_device() app = expect_app(, device) core_sim = RunLoop::CoreSimulator.new(device, app) RunLoop::Environment.with_debugging(debug) do if ['reset-app-sandbox'] if core_sim.app_is_installed? RunLoop.log_debug('Resetting the app sandbox') core_sim.uninstall_app_and_sandbox else RunLoop.log_debug('App is not installed; skipping sandbox reset') end end core_sim.install end end |
#manage_processes ⇒ Object
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/run_loop/cli/simctl.rb', line 98 def manage_processes debug = [:debug] original_value = ENV['DEBUG'] ENV['DEBUG'] = '1' if debug begin RunLoop::CoreSimulator.terminate_core_simulator_processes process_name = "com.apple.CoreSimulator.CoreSimulatorService" RunLoop::ProcessWaiter.new(process_name).pids.each do |pid| = { :timeout => 0.5 } RunLoop::ProcessTerminator.new(pid, 'KILL', process_name, ) end ensure ENV['DEBUG'] = original_value if debug end end |
#tail ⇒ Object
12 13 14 |
# File 'lib/run_loop/cli/simctl.rb', line 12 def tail tail_booted end |