<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 xcode_version
    @xcode_version || MacOS.xcode_version
  end

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

  def describe_perl
    perl = `which perl`.chomp
    return "N/A" unless perl

    real_perl = Pathname.new(perl).realpath.to_s
    return perl if perl == real_perl
    return "#{perl} => #{real_perl}"
  end

  def describe_python
    python = `which python`.chomp
    return "N/A" unless python

    real_python = Pathname.new(python).realpath.to_s

    return python if python == real_python
    return "#{python} => #{real_python}"
  end

  def describe_ruby
    ruby = `which ruby`.chomp
    return "N/A" unless ruby

    real_ruby = Pathname.new(ruby).realpath.to_s
    return ruby if ruby == real_ruby
    return "#{ruby} => #{real_ruby}"
  end

  def real_path a_path
    Pathname.new(a_path).realpath.to_s
  end

  def config_s; <<-EOS.undent
    HOMEBREW_VERSION: #{HOMEBREW_VERSION}
    HEAD: #{sha}
    HOMEBREW_PREFIX: #{HOMEBREW_PREFIX}
    HOMEBREW_CELLAR: #{HOMEBREW_CELLAR}<commit_msg>brew --config: properly handle empty `which` strings<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 xcode_version
    @xcode_version || MacOS.xcode_version
  end

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

  def describe_perl
    perl = `which perl`.chomp
    return "N/A" if perl.empty?

    real_perl = Pathname.new(perl).realpath.to_s
    return perl if perl == real_perl
    return "#{perl} => #{real_perl}"
  end

  def describe_python
    python = `which python`.chomp
    return "N/A" if python.empty?

    real_python = Pathname.new(python).realpath.to_s

    return python if python == real_python
    return "#{python} => #{real_python}"
  end

  def describe_ruby
    ruby = `which ruby`.chomp
    return "N/A" if ruby.empty?

    real_ruby = Pathname.new(ruby).realpath.to_s
    return ruby if ruby == real_ruby
    return "#{ruby} => #{real_ruby}"
  end

  def real_path a_path
    Pathname.new(a_path).realpath.to_s
  end

  def config_s; <<-EOS.undent
    HOMEBREW_VERSION: #{HOMEBREW_VERSION}
    HEAD: #{sha}
    HOMEBREW_PREFIX: #{HOMEBREW_PREFIX}
    HOMEBREW_CELLAR: #{HOMEBREW_CELLAR}
{'fraction_non_alphanumeric': 0.10095541401273886, 'fraction_numerical': 0.008280254777070064, 'mean_word_length': 3.037275064267352, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4800899', 'n_tokens_mistral': 1258, 'n_tokens_neox': 1140, 'n_words': 279}