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.13.0/netdata-v1.13.0.tar.gz" sha256 "258e64a945bf80e91c4bffab35e7f2d8930025246814038f541ff0ac403a666c" bottle do sha256 "8b0ef1f317402901ba1189b03d9c27bd682748573dd40cb934254574dd512515" => :mojave sha256 "02bbea4b989f9a6276532ccbc98241deddb13f531348261fbdf150b8faa0ba1a" => :high_sierra sha256 "bacd3e8d0f19d34231114eb40523e7790a7d96e179331e8aad012e742ecf41b9" => :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