lib/simctl/command/create.rb in simctl-0.2.0 vs lib/simctl/command/create.rb in simctl-1.0.0

- old
+ new

@@ -22,12 +22,13 @@ # @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 - device = device(name: name, os: runtime.name) - device.shutdown! if device.state != 'Shutdown' - device.delete! + SimCtl.list_devices.where(name: name, os: runtime.name).each do |device| + device.shutdown! if device.state != 'Shutdown' + device.delete! + end rescue Exception => exception yield exception if block_given? end create_device name, device_type, runtime end