require 'formula' class Varnish < Formula homepage 'http://www.varnish-cache.org/' url 'http://repo.varnish-cache.org/source/varnish-3.0.3.tar.gz' sha1 '6e1535caa30c3f61af00160c59d318e470cd6f57' depends_on 'pkg-config' => :build depends_on 'pcre' def install system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}", "--localstatedir=#{var}" system "make install" (var+'varnish').mkpath end def caveats; <<-EOS.undent To launch on startup (port > 1024): * if this is your first install: mkdir -p ~/Library/LaunchAgents cp #{plist_path} ~/Library/LaunchAgents/ launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename} * if this is an upgrade and you already have the #{plist_path.basename} loaded: launchctl unload -w ~/Library/LaunchAgents/#{plist_path.basename} cp #{plist_path} ~/Library/LaunchAgents/ launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename} To launch on startup (port < 1024): * if this is your first install: sudo cp #{plist_path} /Library/LaunchAgents/ sudo launchctl load -w /Library/LaunchAgents/#{plist_path.basename} * if this is an upgrade and you already have the #{plist_path.basename} loaded: sudo launchctl unload -w /Library/LaunchAgents/#{plist_path.basename} sudo cp #{plist_path} /Library/LaunchAgents/ sudo launchctl load -w /Library/LaunchAgents/#{plist_path.basename} EOS end def startup_plist; <<-EOPLIST.undent Label #{plist_name} ProgramArguments #{HOMEBREW_PREFIX}/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 EOPLIST end end