Sha256: 48175133f56709306eec34237ceb88f7b22021e02371d43dbbe321cf5bc97cf3

Contents?: true

Size: 1.03 KB

Versions: 21

Compression:

Stored size: 1.03 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
      stdout, _stderr, _status = Open3.capture3('xcodebuild -version -sdk')

      matched = stdout.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

21 entries across 21 versions & 3 rubygems

Version Path
fastlane-2.227.0 snapshot/lib/snapshot/latest_os_version.rb
fastlane-2.226.0 snapshot/lib/snapshot/latest_os_version.rb
fastlane-2.225.0 snapshot/lib/snapshot/latest_os_version.rb
fastlane-2.224.0 snapshot/lib/snapshot/latest_os_version.rb
fastlane-2.223.1 snapshot/lib/snapshot/latest_os_version.rb
fastlane-2.223.0 snapshot/lib/snapshot/latest_os_version.rb
fastlane-2.222.0 snapshot/lib/snapshot/latest_os_version.rb
fastlane-2.221.1 snapshot/lib/snapshot/latest_os_version.rb
fastlane-2.221.0 snapshot/lib/snapshot/latest_os_version.rb
fastlane-2.220.0 snapshot/lib/snapshot/latest_os_version.rb
fastlane-2.219.0 snapshot/lib/snapshot/latest_os_version.rb
fastlane-2.218.0 snapshot/lib/snapshot/latest_os_version.rb
fastlane-security-patched-2.216.0 snapshot/lib/snapshot/latest_os_version.rb
fastlane-2.217.0 snapshot/lib/snapshot/latest_os_version.rb
fastlane-2.216.0 snapshot/lib/snapshot/latest_os_version.rb
fastlane-2.215.1 snapshot/lib/snapshot/latest_os_version.rb
fastlane-2.215.0 snapshot/lib/snapshot/latest_os_version.rb
fastlane-mercafacil-2.214.0 snapshot/lib/snapshot/latest_os_version.rb
fastlane-2.214.0 snapshot/lib/snapshot/latest_os_version.rb
fastlane-2.213.0 snapshot/lib/snapshot/latest_os_version.rb