lib/snapshot/latest_ios_version.rb in snapshot-0.4.13 vs lib/snapshot/latest_ios_version.rb in snapshot-0.5.0
- old
+ new
@@ -1,5 +1,15 @@
module Snapshot
class LatestIosVersion
- VERSION = '8.1'
+ def self.version
+ return ENV["SNAPSHOT_IOS_VERSION"] if ENV["SNAPSHOT_IOS_VERSION"]
+
+ output = `xcodebuild -version -sdk`.split("Mac").last # don't care about the Mac Part
+ matched = output.match(/SDKVersion: ([\d\.]+)/)
+ if matched.length > 1
+ return matched[1]
+ else
+ raise "Could not determine installed iOS SDK version. Please pass it via the environment variable 'SNAPSHOT_IOS_VERSION'".red
+ end
+ end
end
end
\ No newline at end of file