<commit_before>class Metricbeat < Formula
  desc "Collect metrics from your systems and services"
  homepage "https://www.elastic.co/beats/metricbeat"
  url "https://github.com/elastic/beats.git",
      tag:      "v7.16.2",
      revision: "3c518f4d17a15dc85bdd68a5a03d5af51d9edd8e"
  license "Apache-2.0"
  head "https://github.com/elastic/beats.git", branch: "master"

  bottle do
    sha256 cellar: :any_skip_relocation, arm64_monterey: "28c38d8b425cfeeff84bf73c4107725a76184d6495cff6bea75a53275213efee"
    sha256 cellar: :any_skip_relocation, arm64_big_sur:  "b5c22f16161653c337248418feb7d8969229c0cc042d3cbbd15f8b93ce38b66f"
    sha256 cellar: :any_skip_relocation, monterey:       "c81a7105379ae7a9369022d441dcb0a7d3bebc8825c71d40fa9b2f681828e5bf"
    sha256 cellar: :any_skip_relocation, big_sur:        "3f1158be7255aa647914c382cbd64bc675813aabc71728270b2cc857917d9094"
    sha256 cellar: :any_skip_relocation, catalina:       "21fd52ffc9691a978061e05c95d99a3d9319f55912961729806edd2ed3f56225"
    sha256 cellar: :any_skip_relocation, x86_64_linux:   "be8b1326f7deab2c6d0e188afcc16b274560fe24a8678dbd46eeb3b3a427b934"
  end

  depends_on "go" => :build
  depends_on "mage" => :build
  depends_on "python@3.10" => :build

  def install
    # remove non open source files
    rm_rf "x-pack"

    cd "metricbeat" do
      # don't build docs because it would fail creating the combined OSS/x-pack
      # docs and we aren't installing them anyway
      inreplace "magefile.go", "mg.Deps(CollectDocs, FieldsDocs)", ""

      system "mage", "-v", "build"
      ENV.deparallelize
      system "mage", "-v", "update"

      (etc/"metricbeat").install Dir["metricbeat.*", "fields.yml", "modules.d"]
      (libexec/"bin").install "metricbeat"
      prefix.install "build/kibana"
    end

    (bin/"metricbeat").write <<~EOS
      #!/bin/sh
      exec #{libexec}/bin/metricbeat \
        --path.config #{etc}/metricbeat \
        --path.data #{var}/lib/metricbeat \<commit_msg>metricbeat: update 7.16.2 bottle.<commit_after>class Metricbeat < Formula
  desc "Collect metrics from your systems and services"
  homepage "https://www.elastic.co/beats/metricbeat"
  url "https://github.com/elastic/beats.git",
      tag:      "v7.16.2",
      revision: "3c518f4d17a15dc85bdd68a5a03d5af51d9edd8e"
  license "Apache-2.0"
  head "https://github.com/elastic/beats.git", branch: "master"

  bottle do
    sha256 cellar: :any_skip_relocation, arm64_monterey: "88345b5f44fa74d9bc69bf49ddc3a433a29b5c8e3cb35219025ba439adc73e05"
    sha256 cellar: :any_skip_relocation, arm64_big_sur:  "2dd086040e97fcdf582b95e1f5f1c620ef1e6049eb734bb5014cdb2e043d4cab"
    sha256 cellar: :any_skip_relocation, monterey:       "1c5161a6887019e14401d20191be5985719eb558fdd7c0b7c15401531349b694"
    sha256 cellar: :any_skip_relocation, big_sur:        "779503e17d193d9717400f353657aba942fb901d525b3f1cb787dfd84423b684"
    sha256 cellar: :any_skip_relocation, catalina:       "22089c540475269947777777e93648f559a334c22659c98cc8906ff7c1b44b09"
    sha256 cellar: :any_skip_relocation, x86_64_linux:   "df29cbb91daa55b7ee40f93c3f40ff0ea58b566cd675df988bbe22d83e9f15b1"
  end

  depends_on "go" => :build
  depends_on "mage" => :build
  depends_on "python@3.10" => :build

  def install
    # remove non open source files
    rm_rf "x-pack"

    cd "metricbeat" do
      # don't build docs because it would fail creating the combined OSS/x-pack
      # docs and we aren't installing them anyway
      inreplace "magefile.go", "mg.Deps(CollectDocs, FieldsDocs)", ""

      system "mage", "-v", "build"
      ENV.deparallelize
      system "mage", "-v", "update"

      (etc/"metricbeat").install Dir["metricbeat.*", "fields.yml", "modules.d"]
      (libexec/"bin").install "metricbeat"
      prefix.install "build/kibana"
    end

    (bin/"metricbeat").write <<~EOS
      #!/bin/sh
      exec #{libexec}/bin/metricbeat \
        --path.config #{etc}/metricbeat \
        --path.data #{var}/lib/metricbeat \
{'fraction_non_alphanumeric': 0.10982367758186398, 'fraction_numerical': 0.1561712846347607, 'mean_word_length': 4.0457433290978395, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 6, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, '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': '7110035', 'n_tokens_mistral': 1910, 'n_tokens_neox': 1566, 'n_words': 259}