require 'formula' class CouchdbLucene < Formula url 'https://github.com/rnewson/couchdb-lucene/tarball/v0.8.0' homepage 'https://github.com/rnewson/couchdb-lucene' sha1 '63c835499bed8fc3213ca5eaac59f362f42f21c6' depends_on 'couchdb' depends_on 'maven' def install system "mvn" system "tar", "-xzf", "target/couchdb-lucene-#{version}-dist.tar.gz" prefix.install Dir["couchdb-lucene-#{version}/*"] (etc + "couchdb/local.d/couchdb-lucene.ini").write ini_file end def caveats; <<-EOS.undent You can enable couchdb-lucene to automatically load on login with: mkdir -p ~/Library/LaunchAgents cp "#{plist_path}" ~/Library/LaunchAgents/ launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename} Or start it manually with: #{bin}/run EOS end def ini_file return <<-EOS [couchdb] os_process_timeout=60000 ; increase the timeout from 5 seconds. [external] fti=#{which 'python'} #{prefix}/tools/couchdb-external-hook.py [httpd_db_handlers] _fti = {couch_httpd_external, handle_external_req, <<"fti">>} EOS end def startup_plist return <<-EOS Label #{plist_name} EnvironmentVariables HOME ~ DYLD_LIBRARY_PATH /opt/local/lib:$DYLD_LIBRARY_PATH ProgramArguments #{HOMEBREW_PREFIX}/bin/run UserName #{`whoami`.chomp} StandardOutPath /dev/null StandardErrorPath /dev/null RunAtLoad KeepAlive EOS end end