<commit_before>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.length > 1
        return @version ||= 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<commit_msg>Check for case where matched is nil. (Occurs when Xcode license agreement needs to be accepted)<commit_after>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?
        raise "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
        raise "Could not determine installed iOS SDK version. Please pass it via the environment variable 'SNAPSHOT_IOS_VERSION'".red
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.08091517857142858, 'fraction_numerical': 0.004464285714285714, 'mean_word_length': 2.7354166666666666, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 2, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7640079', 'n_tokens_mistral': 537, 'n_tokens_neox': 528, 'n_words': 194}