<commit_before>require "formula"

class Hh < Formula
  homepage "https://github.com/dvorka/hstr"
  url "https://github.com/dvorka/hstr/releases/download/1.13/hh-1.13-src.tgz"
  sha1 "09fee6d687a8b8a7c6f508ced071fb88b0a9bb28"

  bottle do
    cellar :any
    sha1 "3110fabac2e10d0bd49f0893a9bff1babf8ad4d3" => :yosemite
    sha1 "9e7f8e5fab6fdfb0151eb426a97187e7abeb8519" => :mavericks
    sha1 "e31eebb154535a7fc7e35a498178e1163068e4fb" => :mountain_lion
  end

  head do
    url "https://github.com/dvorka/hstr.git"
    depends_on "autoconf" => :build
    depends_on "automake" => :build
    depends_on "libtool" => :build
  end

  depends_on "readline"

  def install
    # Upstream bug report for curses/ncursesw:
    # https://github.com/dvorka/hstr/issues/103
    if build.head?
      inreplace %w(src/hstr.c src/include/hstr_curses.h), "ncursesw/", ""
      system "autoreconf", "-fvi"
    end
    inreplace "configure", "ncursesw", "ncurses"
    system "./configure", "--disable-dependency-tracking",
                          "--prefix=#{prefix}"
    system "make", "install"
  end

  test do
    path = testpath/".hh_test"<commit_msg>hh 1.15<commit_after>class Hh < Formula
  homepage "https://github.com/dvorka/hstr"
  url "https://github.com/dvorka/hstr/releases/download/1.15/hh-1.15-src.tgz"
  sha1 "c97d27687512d1e26828062df300d56159dfa05b"

  bottle do
    cellar :any
    sha1 "3110fabac2e10d0bd49f0893a9bff1babf8ad4d3" => :yosemite
    sha1 "9e7f8e5fab6fdfb0151eb426a97187e7abeb8519" => :mavericks
    sha1 "e31eebb154535a7fc7e35a498178e1163068e4fb" => :mountain_lion
  end

  head do
    url "https://github.com/dvorka/hstr.git"
    depends_on "autoconf" => :build
    depends_on "automake" => :build
    depends_on "libtool" => :build
  end

  depends_on "readline"

  def install
    system "autoreconf", "-fvi" if build.head?
    # Upstream bug report for curses/ncursesw:
    # https://github.com/dvorka/hstr/issues/103
    inreplace %w[src/hstr.c src/include/hstr_curses.h], "ncursesw/", ""
    inreplace "configure", "ncursesw", "ncurses"
    system "./configure", "--disable-dependency-tracking",
                          "--prefix=#{prefix}"
    system "make", "install"
  end

  test do
    path = testpath/".hh_test"
{'fraction_non_alphanumeric': 0.13140311804008908, 'fraction_numerical': 0.09532293986636971, 'mean_word_length': 3.327552986512524, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4293271', 'n_tokens_mistral': 1026, 'n_tokens_neox': 920, 'n_words': 147}