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
- #booted ⇒ Object
- #doctor ⇒ Object
- #erase(simulator = nil) ⇒ Object
- #install ⇒ Object
- #launch(simulator = nil) ⇒ Object
- #manage_processes ⇒ Object
- #tail ⇒ Object
Instance Attribute Details
#simctl ⇒ Object (readonly)
Returns the value of attribute simctl.
11 12 13 |
# File 'lib/run_loop/cli/simctl.rb', line 11 def simctl @simctl end |
Instance Method Details
#booted ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/run_loop/cli/simctl.rb', line 35 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
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/run_loop/cli/simctl.rb', line 60 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 |
#erase(simulator = nil) ⇒ Object
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
# File 'lib/run_loop/cli/simctl.rb', line 201 def erase(simulator=nil) debug = [:debug] RunLoop::Environment.with_debugging(debug) do if !simulator identifier = RunLoop::Core.default_simulator(xcode) else identifier = simulator end = {simctl: simctl, xcode: xcode} device = RunLoop::Device.device_with_identifier(identifier, ) RunLoop::CoreSimulator.erase(device, ) 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 |
#launch(simulator = nil) ⇒ Object
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
# File 'lib/run_loop/cli/simctl.rb', line 228 def launch(simulator=nil) debug = [:debug] RunLoop::Environment.with_debugging(debug) do if !simulator identifier = RunLoop::Core.default_simulator(xcode) else identifier = simulator end = {simctl: simctl, xcode: xcode} device = RunLoop::Device.device_with_identifier(identifier, ) core_sim = RunLoop::CoreSimulator.new(device, nil) core_sim.launch_simulator end end |
#manage_processes ⇒ Object
103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/run_loop/cli/simctl.rb', line 103 def manage_processes debug = [:debug] original_value = ENV['DEBUG'] ENV['DEBUG'] = '1' if debug begin RunLoop::CoreSimulator.terminate_core_simulator_processes ensure ENV['DEBUG'] = original_value if debug end end |
#tail ⇒ Object
14 15 16 |
# File 'lib/run_loop/cli/simctl.rb', line 14 def tail tail_simulator_logs end |