Module: SimCtl::Command::Warmup

Included in:
SimCtl::Command
Defined in:
lib/simctl/command/warmup.rb

Instance Method Summary collapse

Instance Method Details

#warmup(devicetype, runtime, timeout = 120) ⇒ SimCtl::Device

Warms up a device and waits for it to be ready

Parameters:

  • devicetype (String)

    device type string

  • runtime (String)

    runtime string

  • timeout (Integer) (defaults to: 120)

    timeout in seconds to wait until device is ready

Returns:

Raises:



10
11
12
13
14
15
16
17
18
# File 'lib/simctl/command/warmup.rb', line 10

def warmup(devicetype, runtime, timeout = 120)
  devicetype = devicetype(name: devicetype) unless devicetype.is_a?(DeviceType)
  runtime = runtime(name: runtime) unless runtime.is_a?(Runtime)
  device = device(runtime: runtime, devicetype: devicetype)
  raise DeviceNotFound, "Could not find device with type '#{devicetype.name}' and runtime '#{runtime.name}'" if device.nil?
  device.boot if device.state != :booted
  device.wait(timeout) { |d| d.state == :booted && d.ready? }
  device
end