Class: RunLoop::CLI::Simctl
- Inherits:
-
Thor
- Object
- Thor
- RunLoop::CLI::Simctl
- Defined in:
- lib/run_loop/cli/simctl.rb
Instance Attribute Summary collapse
-
#sim_control ⇒ Object
readonly
Returns the value of attribute sim_control.
Instance Method Summary collapse
Instance Attribute Details
#sim_control ⇒ Object (readonly)
Returns the value of attribute sim_control.
9 10 11 |
# File 'lib/run_loop/cli/simctl.rb', line 9 def sim_control @sim_control 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.new.version puts "No simulator for active Xcode (version #{version}) is booted." else puts device end end |
#install ⇒ Object
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/run_loop/cli/simctl.rb', line 111 def install debug = [:debug] if debug ENV['DEBUG'] = '1' end debug_logging = RunLoop::Environment.debug? device = expect_device() app = expect_app(, device) bridge = RunLoop::Simctl::Bridge.new(device, app.path) force_reinstall = [:force] before = Time.now if bridge.app_is_installed? if debug_logging puts "App with bundle id '#{app.bundle_identifier}' is already installed." end if force_reinstall if debug_logging puts 'Will force a re-install.' end bridge.uninstall bridge.install else new_digest = RunLoop::Directory.directory_digest(app.path) if debug_logging puts " New app has SHA: '#{new_digest}'." end installed_app_bundle = bridge.fetch_app_dir old_digest = RunLoop::Directory.directory_digest(installed_app_bundle) if debug_logging puts "Installed app has SHA: '#{old_digest}'." end if new_digest != old_digest if debug_logging puts "Will re-install '#{app.bundle_identifier}' because the SHAs don't match." end bridge.uninstall bridge.install else if debug_logging puts "Will not re-install '#{app.bundle_identifier}' because the SHAs match." end end end else bridge.install end if debug_logging "Launching took #{Time.now-before} seconds" puts "Installed '#{app.bundle_identifier}' on #{device} in #{Time.now-before} seconds." end end |
#refresh ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/run_loop/cli/simctl.rb', line 49 def refresh debug = [:debug] original_value = ENV['DEBUG'] ENV['DEBUG'] = '1' if debug RunLoop::SimControl.terminate_all_sims begin process_name = 'com.apple.CoreSimulator.CoreSimulatorService' pids = RunLoop::ProcessWaiter.new(process_name, {:timeout => 0.2}).pids if debug && pids.empty? puts 'There are no CoreSimulatorServices processes running' end pids.each do |pid| RunLoop::ProcessTerminator.new(pid, 'KILL', process_name).kill_process 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 |