<commit_before>require 'hardware'

module Homebrew extend self
  def __config
    puts config_s
  end

  def llvm
    @llvm ||= MacOS.llvm_build_version
  end

  def gcc_42
    @gcc_42 ||= MacOS.gcc_42_build_version
  end

  def gcc_40
    @gcc_40 ||= MacOS.gcc_40_build_version
  end

  def clang
    @clang ||= MacOS.clang_version
  end

  def clang_build
    @clang_build ||= MacOS.clang_build_version
  end

  def describe_xcode
    @describe_xcode ||= begin
      default_prefix = case MacOS.version
        when 10.5, 10.6 then '/Developer'
        else '/Applications/Xcode.app/Contents/Developer'
        end

      guess = '(guessed)' unless MacOS::Xcode.installed?
      prefix = if MacOS::Xcode.installed?
        "=> #{MacOS::Xcode.prefix}" unless MacOS::Xcode.prefix.to_s == default_prefix
      end

      [MacOS::Xcode.version, guess, prefix].compact.join(' ')
    end
  end

  def describe_clt
    @describe_clt ||= if MacOS::CLT.installed? then MacOS::CLT.version else 'N/A' end
  end

  def head
    head = HOMEBREW_REPOSITORY.cd do
      `git rev-parse --verify -q HEAD 2>/dev/null`.chomp
    end
    if head.empty? then "(none)" else head end
  end

  def describe_path path
    return "N/A" if path.nil?
    realpath = path.realpath
    if realpath == path then path else "#{path} => #{realpath}" end
  end

  def describe_x11
    return "N/A" unless MacOS::XQuartz.installed?
    return "XQuartz #{MacOS::XQuartz.version} in " + describe_path(MacOS::XQuartz.prefix)
  end

  def describe_perl
    describe_path(which 'perl')
  end

  def describe_python
    describe_path(which 'python')
  end

  def describe_ruby
    describe_path(which 'ruby')
  end

  def hardware
    "CPU: #{Hardware.cores_as_words}-core #{Hardware.bits}-bit #{Hardware.intel_family}"
  end

  def kernel
    `uname -m`.chomp
  end

  # we try to keep output minimal
  def dump_build_config
    puts "HOMEBREW_VERSION: #{HOMEBREW_VERSION}"
    puts "HEAD: #{head}"
    puts "HOMEBREW_PREFIX: #{HOMEBREW_PREFIX}" if HOMEBREW_PREFIX.to_s != "/usr/local"<commit_msg>--config: remove confusing XQuartz annotation<commit_after>require 'hardware'

module Homebrew extend self
  def __config
    puts config_s
  end

  def llvm
    @llvm ||= MacOS.llvm_build_version
  end

  def gcc_42
    @gcc_42 ||= MacOS.gcc_42_build_version
  end

  def gcc_40
    @gcc_40 ||= MacOS.gcc_40_build_version
  end

  def clang
    @clang ||= MacOS.clang_version
  end

  def clang_build
    @clang_build ||= MacOS.clang_build_version
  end

  def describe_xcode
    @describe_xcode ||= begin
      default_prefix = case MacOS.version
        when 10.5, 10.6 then '/Developer'
        else '/Applications/Xcode.app/Contents/Developer'
        end

      guess = '(guessed)' unless MacOS::Xcode.installed?
      prefix = if MacOS::Xcode.installed?
        "=> #{MacOS::Xcode.prefix}" unless MacOS::Xcode.prefix.to_s == default_prefix
      end

      [MacOS::Xcode.version, guess, prefix].compact.join(' ')
    end
  end

  def describe_clt
    @describe_clt ||= if MacOS::CLT.installed? then MacOS::CLT.version else 'N/A' end
  end

  def head
    head = HOMEBREW_REPOSITORY.cd do
      `git rev-parse --verify -q HEAD 2>/dev/null`.chomp
    end
    if head.empty? then "(none)" else head end
  end

  def describe_path path
    return "N/A" if path.nil?
    realpath = path.realpath
    if realpath == path then path else "#{path} => #{realpath}" end
  end

  def describe_x11
    return "N/A" unless MacOS::XQuartz.installed?
    return "#{MacOS::XQuartz.version} in " + describe_path(MacOS::XQuartz.prefix)
  end

  def describe_perl
    describe_path(which 'perl')
  end

  def describe_python
    describe_path(which 'python')
  end

  def describe_ruby
    describe_path(which 'ruby')
  end

  def hardware
    "CPU: #{Hardware.cores_as_words}-core #{Hardware.bits}-bit #{Hardware.intel_family}"
  end

  def kernel
    `uname -m`.chomp
  end

  # we try to keep output minimal
  def dump_build_config
    puts "HOMEBREW_VERSION: #{HOMEBREW_VERSION}"
    puts "HEAD: #{head}"
    puts "HOMEBREW_PREFIX: #{HOMEBREW_PREFIX}" if HOMEBREW_PREFIX.to_s != "/usr/local"
{'fraction_non_alphanumeric': 0.10845410628019324, 'fraction_numerical': 0.010144927536231883, 'mean_word_length': 3.091897233201581, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4489818', 'n_tokens_mistral': 1561, 'n_tokens_neox': 1447, 'n_words': 356}