Sha256: 04b8f7c495b6cb926f95e5ab32a8e3daeb841b16993cfb664a2ffb9f8507f345

Contents?: true

Size: 922 Bytes

Versions: 4

Compression:

Stored size: 922 Bytes

Contents

module Snapshot
  class LatestIosVersion
    @version = nil
    def self.version
      return ENV["SNAPSHOT_IOS_VERSION"] if ENV["SNAPSHOT_IOS_VERSION"]
      return @version if @version

      # We do all this, because we would get all kind of crap output generated by xcodebuild
      # so we need to ignore stderror
      output = ''
      Open3.popen3('xcodebuild -version -sdk') do |stdin, stdout, stderr, wait_thr|
        output = stdout.read
      end

      matched = output.match(/iOS ([\d\.]+) \(.*/)
      if matched.nil?
        UI.user_error!("Could not determine installed iOS SDK version. Try running the _xcodebuild_ command manually to ensure it works.")
      elsif matched.length > 1
        return @version ||= matched[1]
      else
        UI.user_error!("Could not determine installed iOS SDK version. Please pass it via the environment variable 'SNAPSHOT_IOS_VERSION'")
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
snapshot-1.13.1 lib/snapshot/latest_ios_version.rb
snapshot-1.13.0 lib/snapshot/latest_ios_version.rb
snapshot-1.12.3 lib/snapshot/latest_ios_version.rb
snapshot-1.12.2 lib/snapshot/latest_ios_version.rb