Sha256: 5b48e5570168e4d46c275d97cfb48cbb786a86d16720e1f67e9ae71e0b0738c6

Contents?: true

Size: 1.1 KB

Versions: 641

Compression:

Stored size: 1.1 KB

Contents

require 'open3'
require 'fastlane_core/ui/ui'

module Snapshot
  class LatestOsVersion
    def self.ios_version
      return ENV["SNAPSHOT_IOS_VERSION"] if FastlaneCore::Env.truthy?("SNAPSHOT_IOS_VERSION")
      self.version("iOS")
    end

    @versions = {}
    def self.version(os)
      @versions[os] ||= version_for_os(os)
    end

    def self.version_for_os(os)
      # 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(/#{os} ([\d\.]+) \(.*/)
      if matched.nil?
        FastlaneCore::UI.user_error!("Could not determine installed #{os} SDK version. Try running the _xcodebuild_ command manually to ensure it works.")
      elsif matched.length > 1
        return matched[1]
      else
        FastlaneCore::UI.user_error!("Could not determine installed #{os} SDK version. Please pass it via the environment variable 'SNAPSHOT_IOS_VERSION'")
      end
    end
  end
end

Version data entries

641 entries across 641 versions & 3 rubygems

Version Path
fastlane_pricing_fix-2.212.1 snapshot/lib/snapshot/latest_os_version.rb
fastlane-2.212.1 snapshot/lib/snapshot/latest_os_version.rb
fastlane-2.212.0 snapshot/lib/snapshot/latest_os_version.rb
fastlane-2.211.0 snapshot/lib/snapshot/latest_os_version.rb
fastlane-2.210.1 snapshot/lib/snapshot/latest_os_version.rb
fastlane-2.210.0 snapshot/lib/snapshot/latest_os_version.rb
fastlane-2.209.1 snapshot/lib/snapshot/latest_os_version.rb
fastlane-2.209.0 snapshot/lib/snapshot/latest_os_version.rb
fastlane-2.208.0 snapshot/lib/snapshot/latest_os_version.rb
fastlane-2.207.0 snapshot/lib/snapshot/latest_os_version.rb
fastlane-2.206.2 snapshot/lib/snapshot/latest_os_version.rb
fastlane-2.206.1 snapshot/lib/snapshot/latest_os_version.rb
fastlane-2.206.0 snapshot/lib/snapshot/latest_os_version.rb
fastlane-2.205.2 snapshot/lib/snapshot/latest_os_version.rb
fastlane-2.205.1 snapshot/lib/snapshot/latest_os_version.rb
fastlane-2.205.0 snapshot/lib/snapshot/latest_os_version.rb
fastlane-2.204.3 snapshot/lib/snapshot/latest_os_version.rb
fastlane-2.204.2 snapshot/lib/snapshot/latest_os_version.rb
fastlane-2.204.1 snapshot/lib/snapshot/latest_os_version.rb
fastlane-2.204.0 snapshot/lib/snapshot/latest_os_version.rb