lib/scan/detect_values.rb in scan-0.1.2 vs lib/scan/detect_values.rb in scan-0.2.0
- old
+ new
@@ -24,25 +24,30 @@
def self.default_device
config = Scan.config
if config[:device] # make sure it actually exists
- found = FastlaneCore::Simulator.all.find { |d| d.name == config[:device].to_s.strip }
+
+ device = config[:device].to_s.strip.tr('()', '') # Remove parenthesis
+
+ found = FastlaneCore::Simulator.all.find { |d| (d.name + " " + d.ios_version).include? device }
+
if found
- config[:device] = found
+ Scan.device = found
return
else
Helper.log.error "Couldn't find simulator '#{config[:device]}' - falling back to default simulator".red
end
end
# An iPhone 5s is reasonable small and useful for tests
found = FastlaneCore::Simulator.all.find { |d| d.name == "iPhone 5s" }
found ||= FastlaneCore::Simulator.all.first # anything is better than nothing
- config[:device] = found
- raise "No simulators found".red unless config[:device]
+ Scan.device = found
+
+ raise "No simulators found".red unless Scan.device
end
# Is it an iOS device or a Mac?
def self.detect_destination
if Scan.config[:destination]
@@ -53,10 +58,10 @@
return
end
# building up the destination now
if Scan.project.ios?
- Scan.config[:destination] = "platform=iOS Simulator,id=#{Scan.config[:device].udid}"
+ Scan.config[:destination] = "platform=iOS Simulator,id=#{Scan.device.udid}"
else
Scan.config[:destination] = "platform=OS X"
end
end
end