class Goaccess < Formula desc "Log analyzer and interactive viewer for the Apache Webserver" homepage "https://goaccess.io/" url "https://tar.goaccess.io/goaccess-1.3.tar.gz" sha256 "8c775c5c24bf85a933fd6f1249004847342d6542aa533e4ec02aaf7be41d7b9b" head "https://github.com/allinurl/goaccess.git" bottle do sha256 "99106f50907de61efcbb2bdd2721663ece2f204d34cc7502bd6a832f848abc40" => :mojave sha256 "1fff9be1edbf4464d1b5d77db5ad466e945ff579bbc5d94cf6ebad6ff0716c68" => :high_sierra sha256 "0f4ba776c01eace596cf26fe61a5055d8120c66e115f9029ea9a70d5103cacd3" => :sierra end depends_on "autoconf" => :build depends_on "automake" => :build depends_on "gettext" depends_on "libmaxminddb" depends_on "tokyo-cabinet" def install ENV.append_path "PATH", Formula["gettext"].bin system "autoreconf", "-vfi" args = %W[ --disable-debug --disable-dependency-tracking --prefix=#{prefix} --enable-utf8 --enable-tcb=btree --enable-geoip=mmdb --with-libintl-prefix=#{Formula["gettext"].opt_prefix} ] system "./configure", *args system "make", "install" end test do (testpath/"access.log").write \ '127.0.0.1 - - [04/May/2015:15:48:17 +0200] "GET / HTTP/1.1" 200 612 "-" ' \ '"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) ' \ 'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36"' output = shell_output \ "#{bin}/goaccess --time-format=%T --date-format=%d/%b/%Y " \ "--log-format='%h %^[%d:%t %^] \"%r\" %s %b \"%R\" \"%u\"' " \ "-f access.log -o json 2>/dev/null" assert_equal "Chrome", JSON.parse(output)["browsers"]["data"].first["data"] end end