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.11.0/netdata-v1.11.0.tar.gz" sha256 "c42c8411c22c72e3e52fed38d7b9537bcfaf568d01e9c1e35ec645490627619d" bottle do sha256 "6a7fe0a85aa774194211ffd6c35ce05d2c810d6d29ead78e792568ff77d5559b" => :mojave sha256 "a052d8c334f20cefcffbcb2be622f4973244395d8ac9f1ba58b10cfc85384561" => :high_sierra sha256 "e1b90b623c641a09bee02a1676beed1ac1fc5ebc1c36a10bd0b00a9e266541bc" => :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 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", "unittest" end end