require 'formula' class Varnish < Formula homepage 'https://www.varnish-cache.org/' url 'https://repo.varnish-cache.org/source/varnish-4.0.3.tar.gz' sha1 'ba4668cb7d17f95c4c5e4baf964fe1412a269297' bottle do sha256 "050160fe3c7780d56f0ff3a68e26c200c72ffb785451d351cb2b1410d7b86588" => :yosemite sha256 "204524142865d6ea5fc9d1dec5c877402726ec44133bcc0d1e0aeb31e39730c7" => :mavericks sha256 "31c5ee79f9bc61d9951dac9a6f56687b8c2724ff934c90ecfb171687707fd4d3" => :mountain_lion end depends_on 'pkg-config' => :build depends_on 'pcre' resource "docutils" do url "https://pypi.python.org/packages/source/d/docutils/docutils-0.11.tar.gz" sha1 "3894ebcbcbf8aa54ce7c3d2c8f05460544912d67" end def install ENV.prepend_create_path "PYTHONPATH", buildpath+"lib/python2.7/site-packages" resource("docutils").stage do system "python", "setup.py", "install", "--prefix=#{buildpath}" end system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}", "--localstatedir=#{var}", "--with-rst2man=#{buildpath}/bin/rst2man.py", "--with-rst2html=#{buildpath}/bin/rst2html.py" system "make install" (var+'varnish').mkpath end test do system "#{opt_sbin}/varnishd", "-V" end def plist; <<-EOS.undent Label #{plist_name} ProgramArguments #{opt_sbin}/varnishd -n #{var}/varnish -f #{etc}/varnish/default.vcl -s malloc,1G -T 127.0.0.1:2000 -a 0.0.0.0:80 KeepAlive RunAtLoad WorkingDirectory #{HOMEBREW_PREFIX} StandardErrorPath #{var}/varnish/varnish.log StandardOutPath #{var}/varnish/varnish.log EOS end end