Sha256: 3908be164da416711a34bbfea950b3b376b648e4902012460a023c36f657042c
Contents?: true
Size: 1 KB
Versions: 4
Compression:
Stored size: 1 KB
Contents
module SimCtl class Command module Reset # Kill, shutdown, delete and create a device # # @param name [String] name of the new device # @param device_type [SimCtl::DeviceType] device type of the new device # @param runtime [SimCtl::Runtime] runtime of the new device # @return [SimCtl::Device] the device that was created # @yield [exception] an exception that might happen during shutdown/delete of the old device def reset_device(name, device_type, runtime) begin list_devices.where(name: name, os: runtime.identifier).each do |device| device.kill device.shutdown if device.state != :shutdown device.wait { |d| d.state == :shutdown } device.delete end rescue Exception => exception yield exception if block_given? end device = create_device name, device_type, runtime device.wait { |d| d.state == :shutdown } device end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
simctl-1.6.10 | lib/simctl/command/reset.rb |
simctl-1.6.8 | lib/simctl/command/reset.rb |
simctl-1.6.7 | lib/simctl/command/reset.rb |
simctl-1.6.6 | lib/simctl/command/reset.rb |