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 Label #{plist_name} Program #{opt_bin}/graylog-collector-sidecar RunAtLoad EOS end test do assert_match version.to_s, shell_output("#{bin}/graylog-collector-sidecar -version") end end