Sha256: 574e29d2edd5dde6fee0525afcf57f713b500a4da396e15777342e56d783eb0a

Contents?: true

Size: 891 Bytes

Versions: 3

Compression:

Stored size: 891 Bytes

Contents

module SimCtl
  class Command
    module Warmup
      # Warms up a device and waits for it to be ready
      #
      # @param devicetype [String] device type string
      # @param runtime [String] runtime string
      # @param timeout [Integer] timeout in seconds to wait until device is ready
      # @return [SimCtl::Device]
      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(devicetype: devicetype, runtime: runtime)
        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
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
simctl-1.6.8 lib/simctl/command/warmup.rb
simctl-1.6.7 lib/simctl/command/warmup.rb
simctl-1.6.6 lib/simctl/command/warmup.rb