<commit_before>class Pacparser < Formula
  desc "Library to parse proxy auto-config (PAC) files"
  homepage "https://github.com/pacparser/pacparser"
  url "https://github.com/pacparser/pacparser/archive/1.3.7.tar.gz"
  sha256 "575c5d8096b4c842b2af852bbb8bcfde96170b28b49f33249dbe2057a8beea13"
  license "LGPL-3.0-or-later"
  head "https://github.com/pacparser/pacparser.git"

  bottle do
    cellar :any
    rebuild 3
    sha256 "55ce66921189d2ba41d3cf58f7548237442c5387372b8cc4bab891cf1ed7766f" => :big_sur
    sha256 "1999482c32deaa8c6b9a38800b6dbc4f6d18076177f6a8a0dad49c21c4327781" => :arm64_big_sur
    sha256 "ca13d2507c9c6616bc6c3604c19a7f6f1652bb3b3c1fed3168c4d832a10b0174" => :catalina
    sha256 "3544e7aed8d310d3407997f46b8b51cbbc2b1d962f90535175baff72301e375e" => :mojave
  end

  # Fix build for MacOS 11.1
  patch do
    url "https://github.com/manugarg/pacparser/commit/28afea85c7578d033132f3817b62d3bb707cc3a3.patch?full_index=1"
    sha256 "52fc5b276caf6e95a3ae4ac21e75c9751daaf429f344fdc6b62c85de4aa40d48"
  end

  def install
    # Disable parallel build due to upstream concurrency issue.
    # https://github.com/pacparser/pacparser/issues/27
    ENV.deparallelize
    ENV["VERSION"] = version
    Dir.chdir "src"
    system "make", "install", "PREFIX=#{prefix}"
  end

  test do
    # example pacfile taken from upstream sources
    (testpath/"test.pac").write <<~'EOS'
      function FindProxyForURL(url, host) {

        if ((isPlainHostName(host) ||
            dnsDomainIs(host, ".example.edu")) &&
            !localHostOrDomainIs(host, "www.example.edu"))
          return "plainhost/.example.edu";

        // Return externaldomain if host matches .*\.externaldomain\.example
        if (/.*\.externaldomain\.example/.test(host))
          return "externaldomain";<commit_msg>pacparser: update 1.3.7 bottle.<commit_after>class Pacparser < Formula
  desc "Library to parse proxy auto-config (PAC) files"
  homepage "https://github.com/pacparser/pacparser"
  url "https://github.com/pacparser/pacparser/archive/1.3.7.tar.gz"
  sha256 "575c5d8096b4c842b2af852bbb8bcfde96170b28b49f33249dbe2057a8beea13"
  license "LGPL-3.0-or-later"
  head "https://github.com/pacparser/pacparser.git"

  bottle do
    cellar :any
    rebuild 3
    sha256 "55ce66921189d2ba41d3cf58f7548237442c5387372b8cc4bab891cf1ed7766f" => :big_sur
    sha256 "1999482c32deaa8c6b9a38800b6dbc4f6d18076177f6a8a0dad49c21c4327781" => :arm64_big_sur
    sha256 "ca13d2507c9c6616bc6c3604c19a7f6f1652bb3b3c1fed3168c4d832a10b0174" => :catalina
    sha256 "3544e7aed8d310d3407997f46b8b51cbbc2b1d962f90535175baff72301e375e" => :mojave
    sha256 "c589a12cc1f53e3928cb55b04c9b8f250b02676d37e491e64ebac32bbeedbd57" => :x86_64_linux
  end

  # Fix build for MacOS 11.1
  patch do
    url "https://github.com/manugarg/pacparser/commit/28afea85c7578d033132f3817b62d3bb707cc3a3.patch?full_index=1"
    sha256 "52fc5b276caf6e95a3ae4ac21e75c9751daaf429f344fdc6b62c85de4aa40d48"
  end

  def install
    # Disable parallel build due to upstream concurrency issue.
    # https://github.com/pacparser/pacparser/issues/27
    ENV.deparallelize
    ENV["VERSION"] = version
    Dir.chdir "src"
    system "make", "install", "PREFIX=#{prefix}"
  end

  test do
    # example pacfile taken from upstream sources
    (testpath/"test.pac").write <<~'EOS'
      function FindProxyForURL(url, host) {

        if ((isPlainHostName(host) ||
            dnsDomainIs(host, ".example.edu")) &&
            !localHostOrDomainIs(host, "www.example.edu"))
          return "plainhost/.example.edu";

        // Return externaldomain if host matches .*\.externaldomain\.example
        if (/.*\.externaldomain\.example/.test(host))
          return "externaldomain";
{'fraction_non_alphanumeric': 0.10448562986838571, 'fraction_numerical': 0.17324738114423852, 'mean_word_length': 4.066666666666666, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 12, 'https://': 10, 'lorem ipsum': 0, 'www.': 2, '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': '3785330', 'n_tokens_mistral': 1835, 'n_tokens_neox': 1470, 'n_words': 213}