lib/simctl/command/list.rb in simctl-1.5.1 vs lib/simctl/command/list.rb in simctl-1.5.2

- old
+ new

@@ -1,12 +1,10 @@ module SimCtl class DeviceTypeNotFound < StandardError; end class RuntimeNotFound < StandardError; end class Command module List - COMMAND = %w[xcrun simctl list -j] - # Find a device # # @param filter [Hash] the filter # @return [SimCtl::Device, nil] the device matching the given filter def device(filter) @@ -24,28 +22,28 @@ # List all devices # # @return [SimCtl::List] a list of SimCtl::Device objects def list_devices - Executor.execute([COMMAND, 'devices']) do |json| + Executor.execute(command_for('list', '-j', 'devices')) do |json| SimCtl::List.new(json['devices'].map {|os, devices| devices.map {|device| Device.new(device.merge(os: os))}}.flatten) end end # List all device types # # @return [SimCtl::List] a list of SimCtl::DeviceType objects def list_devicetypes - Executor.execute([COMMAND, 'devicetypes']) do |json| + Executor.execute(command_for('list', '-j', 'devicetypes')) do |json| SimCtl::List.new(json['devicetypes'].map {|devicetype| DeviceType.new(devicetype)}) end end # List all runtimes # # @return [SimCtl::List] a list of SimCtl::Runtime objects def list_runtimes - Executor.execute([COMMAND, 'runtimes']) do |json| + Executor.execute(command_for('list', '-j', 'runtimes')) do |json| SimCtl::List.new(json['runtimes'].map {|runtime| Runtime.new(runtime)}) end end # Find a runtime