class Netdata < Formula desc "Distributed real-time performance and health monitoring" homepage "https://my-netdata.io/" url "https://github.com/netdata/netdata/archive/v1.18.0.tar.gz" sha256 "8396e818f8fe5c1ce345e99a74da8204970810095047dcf5feffee28d35cc937" bottle do sha256 "efe65bb8b214bb5e1a7190f0ae1e8d40260988274ba8cfaadbb6c25bdf0f5b60" => :catalina sha256 "fa78287208be945689ed30e431c1b5bf942410e02efffc0aab2158d8e1571a4e" => :mojave sha256 "2b5bd72d0c2c0d7247dd188a46146ed266778bc85f7b73077dfa9f33ad9ffd4c" => :high_sierra end depends_on "autoconf" => :build depends_on "automake" => :build depends_on "pkg-config" => :build depends_on "openssl@1.1" if MacOS.version <= :sierra def install system "autoreconf", "-ivf" system "./configure", "--disable-dependency-tracking", "--disable-silent-rules", "--prefix=#{prefix}", "--sysconfdir=#{etc}", "--localstatedir=#{var}", "--libexecdir=#{libexec}", "--with-math", "--with-zlib", "--with-user=netdata", "UUID_CFLAGS=-I/usr/include", "UUID_LIBS=-lc" system "make", "clean" system "make", "install" (etc/"netdata").install "system/netdata.conf" end def post_install config = etc/"netdata/netdata.conf" inreplace config do |s| s.gsub!(/web files owner = .*/, "web files owner = #{ENV["USER"]}") s.gsub!(/web files group = .*/, "web files group = #{Etc.getgrgid(prefix.stat.gid).name}") end (var/"netdata").mkpath end plist_options :manual => "#{HOMEBREW_PREFIX}/sbin/netdata -D" def plist; <<~EOS Label #{plist_name} RunAtLoad ProgramArguments #{opt_sbin}/netdata -D WorkingDirectory #{var} EOS end test do system "#{sbin}/netdata", "-W", "set", "registry", "netdata unique id file", "#{testpath}/netdata.unittest.unique.id", "-W", "set", "registry", "netdata management api key file", "#{testpath}/netdata.api.key", "-W", "unittest" end end