<commit_before>class CollectorSidecar < Formula
  desc "Manage log collectors through Graylog"
  homepage "https://github.com/Graylog2/collector-sidecar"
  url "https://github.com/Graylog2/collector-sidecar/archive/0.1.6.tar.gz"
  sha256 "a0eefbdea42376c76f337a10283317fa413934ab9f4d6d90e6248f333809b0b5"

  bottle do
    sha256 "2eaffde8fe15dc7bee69a6970d39ac063ae48e3a956464358d1a48a206770bb0" => :mojave
    sha256 "8774401834aff935ed79ef5d65e21d6ab03b4299c00c614230744c842017cfa7" => :high_sierra
    sha256 "845b6ccf3ede4996063c05520db19ef557dcff38d876ab16fc1b7265daf7a25a" => :sierra
    sha256 "db9ca13f2826c4ee0fe93e88ce705bc2131dc1706667edfd87a8a5158253c0e4" => :el_capitan
  end

  depends_on "glide" => :build
  depends_on "go" => :build
  depends_on "mercurial" => :build
  depends_on "filebeat"

  def install
    ENV["GOPATH"] = buildpath
    ENV["GLIDE_HOME"] = HOMEBREW_CACHE/"glide_home/#{name}"
    (buildpath/"src/github.com/Graylog2/collector-sidecar").install buildpath.children

    cd "src/github.com/Graylog2/collector-sidecar" do
      inreplace "main.go", "/etc", etc

      inreplace "collector_sidecar.yml" do |s|
        s.gsub! "/usr", HOMEBREW_PREFIX
        s.gsub! "/etc", etc
        s.gsub! "/var", var
      end

      system "glide", "install"
      system "make", "build"
      (etc/"graylog/collector-sidecar").install "collector_sidecar.yml"
      bin.install "graylog-collector-sidecar"
      prefix.install_metafiles
    end
  end

  plist_options :manual => "graylog-collector-sidecar"

  def plist; <<~EOS
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
    "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
      <dict>
        <key>Label</key>
        <string>#{plist_name}</string>
        <key>Program</key>
        <string>#{opt_bin}/graylog-collector-sidecar</string>
        <key>RunAtLoad</key>
        <true/>
      </dict>
    </plist>
  EOS
  end

  test do
    assert_match version.to_s, shell_output("#{bin}/graylog-collector-sidecar -version")
  end
end
<commit_msg>collector-sidecar 0.1.7<commit_after>class CollectorSidecar < Formula
  desc "Manage log collectors through Graylog"
  homepage "https://github.com/Graylog2/collector-sidecar"
  url "https://github.com/Graylog2/collector-sidecar/archive/0.1.7.tar.gz"
  sha256 "6a1bcfd746ae417f3200db7bcc25ca2b61099f8e84fa4621ae3d010226b53784"

  bottle do
    sha256 "2eaffde8fe15dc7bee69a6970d39ac063ae48e3a956464358d1a48a206770bb0" => :mojave
    sha256 "8774401834aff935ed79ef5d65e21d6ab03b4299c00c614230744c842017cfa7" => :high_sierra
    sha256 "845b6ccf3ede4996063c05520db19ef557dcff38d876ab16fc1b7265daf7a25a" => :sierra
    sha256 "db9ca13f2826c4ee0fe93e88ce705bc2131dc1706667edfd87a8a5158253c0e4" => :el_capitan
  end

  depends_on "glide" => :build
  depends_on "go" => :build
  depends_on "mercurial" => :build
  depends_on "filebeat"

  def install
    ENV["GOPATH"] = buildpath
    ENV["GLIDE_HOME"] = HOMEBREW_CACHE/"glide_home/#{name}"
    (buildpath/"src/github.com/Graylog2/collector-sidecar").install buildpath.children

    cd "src/github.com/Graylog2/collector-sidecar" do
      inreplace "main.go", "/etc", etc

      inreplace "collector_sidecar.yml" do |s|
        s.gsub! "/usr", HOMEBREW_PREFIX
        s.gsub! "/etc", etc
        s.gsub! "/var", var
      end

      system "glide", "install"
      system "make", "build"
      (etc/"graylog/collector-sidecar").install "collector_sidecar.yml"
      bin.install "graylog-collector-sidecar"
      prefix.install_metafiles
    end
  end

  plist_options :manual => "graylog-collector-sidecar"

  def plist; <<~EOS
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
    "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
      <dict>
        <key>Label</key>
        <string>#{plist_name}</string>
        <key>Program</key>
        <string>#{opt_bin}/graylog-collector-sidecar</string>
        <key>RunAtLoad</key>
        <true/>
      </dict>
    </plist>
  EOS
  end

  test do
    assert_match version.to_s, shell_output("#{bin}/graylog-collector-sidecar -version")
  end
end

{'fraction_non_alphanumeric': 0.1306710775047259, 'fraction_numerical': 0.10987712665406427, 'mean_word_length': 3.596091205211726, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 2, '>': 53, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, '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': '3192771', 'n_tokens_mistral': 1941, 'n_tokens_neox': 1669, 'n_words': 243}