class Logrotate < Formula desc "Rotates, compresses, and mails system logs" homepage "https://github.com/logrotate/logrotate" url "https://github.com/logrotate/logrotate/releases/download/3.15.1/logrotate-3.15.1.tar.xz" sha256 "491fec9e89f1372f02a0ab66579aa2e9d63cac5178dfa672c204c88e693a908b" bottle do cellar :any sha256 "95f2d314052e8c01a227231483b649186f9c6b1e489c0c14f83864420f8825bb" => :catalina sha256 "19923834d4fb0303cfda1825d5bdf0916cd7bd6bd094a76036b5d6f2e3a2f0e0" => :mojave sha256 "d01fb02bceeccb6d21e7db2ccdffc49edd21f61553c1d4e5684eb4e63c8523d1" => :high_sierra sha256 "bb2de9bc3d629bce8f0e49a145a0cfde09e3f41b8fb59a1cb846641505edb6c6" => :sierra end depends_on "popt" def install system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}", "--with-compress-command=/usr/bin/gzip", "--with-uncompress-command=/usr/bin/gunzip", "--with-state-file-path=#{var}/lib/logrotate.status" system "make", "install" inreplace "examples/logrotate.conf", "/etc/logrotate.d", "#{etc}/logrotate.d" etc.install "examples/logrotate.conf" => "logrotate.conf" (etc/"logrotate.d").mkpath end plist_options :manual => "logrotate" def plist; <<~EOS Label #{plist_name} ProgramArguments #{sbin}/logrotate #{etc}/logrotate.conf RunAtLoad StartCalendarInterval Hour 6 Minute 25 EOS end test do (testpath/"test.log").write("testlograndomstring") (testpath/"testlogrotate.conf").write <<~EOS #{testpath}/test.log { size 1 copytruncate } EOS system "#{sbin}/logrotate", "-s", "logstatus", "testlogrotate.conf" assert(File.size?("test.log").nil?, "File is not zero length!") end end