10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/fastlane_core/simulator.rb', line 10
def all
Helper.log.info "Fetching available devices" if $verbose
@devices = []
os_type = 'unknown'
os_version = 'unknown'
output = ''
Open3.popen3('xcrun simctl list devices') do |stdin, stdout, stderr, wait_thr|
output = stdout.read
end
unless output.include?("== Devices ==")
Helper.log.error "xcrun simctl CLI broken, run `xcrun simctl list devices` and make sure it works".red
raise "xcrun simctl not working.".red
end
output.split(/\n/).each do |line|
next if line.match(/^== /)
if line.match(/^-- /)
(os_type, os_version) = line.gsub(/-- (.*) --/, '\1').split
else
match = line.match(/\s+([^\(]+) \(([-0-9A-F]+)\) \((?:[^\(]+)\)(.*unavailable.*)?/)
if match && !match[3] && os_type == requested_os_type
@devices << Device.new(name: match[1], ios_version: os_version, udid: match[2])
end
end
end
return @devices
end
|