class Netdata < Formula desc "Distributed real-time performance and health monitoring" homepage "https://my-netdata.io/" url "https://github.com/netdata/netdata/releases/download/v1.14.0/netdata-v1.14.0.tar.gz" sha256 "f3768f6927e3712dce73794c6943a12f4454410c872eb3dfd19af4f52296187a" bottle do sha256 "4deea4c1431e478a3da1f5ac471e2b277508b45213ba7f6cb74bdfabff274aad" => :mojave sha256 "1169f9b9e7d352bc26398f6aed88cd94cbfbda56589f612bef8bc3acfb05130c" => :high_sierra sha256 "8fc2f0bed8eb41e9c9ee165254cc7f6a2543a870a41a2f44495ce8cb632ac5fe" => :sierra end depends_on "autoconf" => :build depends_on "automake" => :build depends_on "pkg-config" => :build depends_on "ossp-uuid" def install system "./configure", "--disable-dependency-tracking", "--disable-silent-rules", "--prefix=#{prefix}", "--sysconfdir=#{etc}", "--localstatedir=#{var}" 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