<commit_before>class Rqlite < Formula
  desc "Lightweight, distributed relational database built on SQLite"
  homepage "http://www.rqlite.com/"
  url "https://github.com/rqlite/rqlite/archive/v5.11.0.tar.gz"
  sha256 "2a78405d60f53a76608171d9348fe84455dc0e07c3eddbedb5c25bd03158cb85"
  license "MIT"

  bottle do
    sha256 cellar: :any_skip_relocation, arm64_big_sur: "6e9605fc91d586f7bf474f708b5b4c1264a82915598bdae21a84c726013f15c3"
    sha256 cellar: :any_skip_relocation, big_sur:       "6d419ca2817c547658cd986f81b86651c935a71f5e26c992f2067c0b3991782d"
    sha256 cellar: :any_skip_relocation, catalina:      "e0a5ef770f0a24d08cbfb8b2e2fbe5b01312e797842c642aff43589536c92b38"
    sha256 cellar: :any_skip_relocation, mojave:        "3f425c5b80f7603379d01e3ac7cde73aa4b2f07eaafff6c398947c6c23a091a3"
  end

  depends_on "go" => :build

  def install
    ["rqbench", "rqlite", "rqlited"].each do |cmd|
      system "go", "build", *std_go_args, "-o", bin/cmd, "./cmd/#{cmd}"
    end
  end

  test do
    port = free_port
    fork do
      exec bin/"rqlited", "-http-addr", "localhost:#{port}",
                          "-raft-addr", "localhost:#{free_port}",
                          testpath
    end
    sleep 5

    (testpath/"test.sql").write <<~EOS<commit_msg>rqlite: update 5.11.0 bottle.<commit_after>class Rqlite < Formula
  desc "Lightweight, distributed relational database built on SQLite"
  homepage "http://www.rqlite.com/"
  url "https://github.com/rqlite/rqlite/archive/v5.11.0.tar.gz"
  sha256 "2a78405d60f53a76608171d9348fe84455dc0e07c3eddbedb5c25bd03158cb85"
  license "MIT"

  bottle do
    sha256 cellar: :any_skip_relocation, arm64_big_sur: "d0d2dc6f79a48b237e1657d9f1a1040b81e75cad7c17a28fe914adfd4f4c1e40"
    sha256 cellar: :any_skip_relocation, big_sur:       "14aa36e999a0d814a21e1728a4c4d534fc7bfd642df271b2b327267fd527ea98"
    sha256 cellar: :any_skip_relocation, catalina:      "2c3f6c3474a845b8b8373543cd5d4712adc4c3d953c457bbb63569710ecf12e2"
    sha256 cellar: :any_skip_relocation, mojave:        "f76378b87164c35617f7658a164ebf23a1335abd106304b657e5c1f899c70cf7"
  end

  depends_on "go" => :build

  def install
    ["rqbench", "rqlite", "rqlited"].each do |cmd|
      system "go", "build", *std_go_args, "-o", bin/cmd, "./cmd/#{cmd}"
    end
  end

  test do
    port = free_port
    fork do
      exec bin/"rqlited", "-http-addr", "localhost:#{port}",
                          "-raft-addr", "localhost:#{free_port}",
                          testpath
    end
    sleep 5

    (testpath/"test.sql").write <<~EOS
{'fraction_non_alphanumeric': 0.10806577916992952, 'fraction_numerical': 0.1816758026624902, 'mean_word_length': 3.7757009345794392, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '5785151', 'n_tokens_mistral': 1307, 'n_tokens_neox': 1062, 'n_words': 160}