homebrew-core/Formula/goaccess.rb

53 lines
1.7 KiB
Ruby

class Goaccess < Formula
desc "Log analyzer and interactive viewer for the Apache Webserver"
homepage "https://goaccess.io/"
url "https://tar.goaccess.io/goaccess-1.4.2.tar.gz"
sha256 "f0ea433170058866e57bd5d0f98dc70c3857f4762ca5a29e6ece26d2ccce4f67"
license "MIT"
head "https://github.com/allinurl/goaccess.git"
bottle do
sha256 "d2a6c510116c165f4014324b88e0b83c088d758e9335574234cc175d85d652ac" => :big_sur
sha256 "4bdb574b0d364bf51a0e9835cf72f81d50c8ede165a99cb5699a848310babc7c" => :catalina
sha256 "99ee5b56fa892baa5c510c0adef0e3077967ac44a543db0a8c70c647401a94f6" => :mojave
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