<commit_before>class NatsStreamingServer < Formula
  desc "Lightweight cloud messaging system"
  homepage "https://nats.io"
  url "https://github.com/nats-io/nats-streaming-server/archive/v0.5.0.tar.gz"
  sha256 "b9d353964b6fa159cafdc304d163a296647e811b2c4ad4570caeb7000138e4cb"
  head "https://github.com/nats-io/nats-streaming-server.git"

  bottle do
    cellar :any_skip_relocation
    sha256 "48e764cf78c7a2ee45f6eefbb087b7f7d25336985cd86e0e980edb683ab78f40" => :high_sierra
    sha256 "53632dff52482bfc78bbfdbbbf708058d46c728685af44a2e27b04d4bf0a3a53" => :sierra
    sha256 "2d42f45471c50ce0f8f6eaad57d643041eb6644744a876c2333a3d4ac8f908ca" => :el_capitan
    sha256 "805e398fa4517b4996c5f86774fa9282114c7371561dd7d0d7ff24badaafb331" => :yosemite
  end

  depends_on "go" => :build

  def install
    ENV["GOPATH"] = buildpath
    mkdir_p "src/github.com/nats-io"
    ln_s buildpath, "src/github.com/nats-io/nats-streaming-server"
    buildfile = buildpath/"src/github.com/nats-io/nats-streaming-server/nats-streaming-server.go"
    system "go", "build", "-v", "-o", bin/"nats-streaming-server", buildfile
  end

  plist_options :manual => "nats-streaming-server"

  def plist; <<-EOS.undent
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//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>ProgramArguments</key>
        <array>
          <string>#{opt_bin}/nats-streaming-server</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
      </dict>
    </plist>
    EOS
  end

  test do
    pid = fork do
      exec "#{bin}/nats-streaming-server --port=8085 --pid=#{testpath}/pid --log=#{testpath}/log"
    end
    sleep 3

    begin
      assert_match "INFO", shell_output("curl localhost:8085")
      assert File.exist?(testpath/"log")
      assert_match version.to_s, File.read(testpath/"log")
    ensure
      Process.kill "SIGINT", pid
      Process.wait pid
    end
  end
end<commit_msg>nats-streaming-server: use assert_predicate instead of File.exist?<commit_after>class NatsStreamingServer < Formula
  desc "Lightweight cloud messaging system"
  homepage "https://nats.io"
  url "https://github.com/nats-io/nats-streaming-server/archive/v0.5.0.tar.gz"
  sha256 "b9d353964b6fa159cafdc304d163a296647e811b2c4ad4570caeb7000138e4cb"
  head "https://github.com/nats-io/nats-streaming-server.git"

  bottle do
    cellar :any_skip_relocation
    sha256 "48e764cf78c7a2ee45f6eefbb087b7f7d25336985cd86e0e980edb683ab78f40" => :high_sierra
    sha256 "53632dff52482bfc78bbfdbbbf708058d46c728685af44a2e27b04d4bf0a3a53" => :sierra
    sha256 "2d42f45471c50ce0f8f6eaad57d643041eb6644744a876c2333a3d4ac8f908ca" => :el_capitan
    sha256 "805e398fa4517b4996c5f86774fa9282114c7371561dd7d0d7ff24badaafb331" => :yosemite
  end

  depends_on "go" => :build

  def install
    ENV["GOPATH"] = buildpath
    mkdir_p "src/github.com/nats-io"
    ln_s buildpath, "src/github.com/nats-io/nats-streaming-server"
    buildfile = buildpath/"src/github.com/nats-io/nats-streaming-server/nats-streaming-server.go"
    system "go", "build", "-v", "-o", bin/"nats-streaming-server", buildfile
  end

  plist_options :manual => "nats-streaming-server"

  def plist; <<-EOS.undent
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//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>ProgramArguments</key>
        <array>
          <string>#{opt_bin}/nats-streaming-server</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
      </dict>
    </plist>
    EOS
  end

  test do
    pid = fork do
      exec "#{bin}/nats-streaming-server --port=8085 --pid=#{testpath}/pid --log=#{testpath}/log"
    end
    sleep 3

    begin
      assert_match "INFO", shell_output("curl localhost:8085")
      assert_predicate testpath/"log", :exist?
      assert_match version.to_s, File.read(testpath/"log")
    ensure
      Process.kill "SIGINT", pid
      Process.wait pid
    end
  end
end
{'fraction_non_alphanumeric': 0.13538461538461538, 'fraction_numerical': 0.11124260355029586, 'mean_word_length': 3.453108535300316, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 2, '>': 53, 'https://': 6, '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': '1341622', 'n_tokens_mistral': 1951, 'n_tokens_neox': 1687, 'n_words': 241}