require 'formula' class Memcached < Formula url "http://memcached.googlecode.com/files/memcached-1.4.7.tar.gz" homepage 'http://memcached.org/' sha1 '09e6ba550ea9f55b3116cd084b23ea2b923f9b41' depends_on 'libevent' def options [ ["--enable-sasl", "Enable SASL support -- disables ASCII protocol!"], ] end def install args = ["--prefix=#{prefix}"] args << "--enable-sasl" if ARGV.include? "--enable-sasl" system "./configure", *args system "make install" (prefix+'com.danga.memcached.plist').write startup_plist (prefix+'com.danga.memcached.plist').chmod 0644 end def caveats; <<-EOS.undent You can enable memcached to automatically load on login with: mkdir -p ~/Library/LaunchAgents cp #{prefix}/com.danga.memcached.plist ~/Library/LaunchAgents/ launchctl load -w ~/Library/LaunchAgents/com.danga.memcached.plist Or start it manually: #{HOMEBREW_PREFIX}/bin/memcached Add "-d" to start it as a daemon. EOS end def startup_plist return <<-EOPLIST Label com.danga.memcached KeepAlive ProgramArguments #{HOMEBREW_PREFIX}/bin/memcached -l localhost RunAtLoad WorkingDirectory #{HOMEBREW_PREFIX} EOPLIST end end