2011-03-10 05:11:03 +00:00
|
|
|
class CouchdbLucene < Formula
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "Full-text search of CouchDB documents using Lucene"
|
2015-02-24 08:15:12 +00:00
|
|
|
homepage "https://github.com/rnewson/couchdb-lucene"
|
|
|
|
url "https://github.com/rnewson/couchdb-lucene/archive/v1.0.2.tar.gz"
|
2015-08-03 12:55:31 +00:00
|
|
|
sha256 "c3f33890670160b14515fd1e26aa30df89f6101f36148639f213c40a6fff8e7d"
|
2013-11-07 04:52:03 +00:00
|
|
|
|
2015-02-24 08:34:05 +00:00
|
|
|
bottle do
|
2016-01-06 19:47:09 +00:00
|
|
|
cellar :any_skip_relocation
|
|
|
|
revision 1
|
|
|
|
sha256 "38f8b7946415fadd1ed0d0bae55a2b4a07b887b68a6513436bb33347fe25b59f" => :el_capitan
|
|
|
|
sha256 "9da083783bddfdff05e89511006eddc7a4e382b04b897741a7418f48f6b6dff0" => :yosemite
|
|
|
|
sha256 "41fdbc137d3a24139de0fd0ae4111ae7d6f14d20fb9aaba25b5ef0b5bb21085d" => :mavericks
|
2015-02-24 08:34:05 +00:00
|
|
|
end
|
|
|
|
|
2015-02-24 08:15:12 +00:00
|
|
|
depends_on "couchdb"
|
|
|
|
depends_on "maven" => :build
|
|
|
|
depends_on :java
|
2010-04-19 20:43:50 +00:00
|
|
|
|
2009-12-20 02:51:22 +00:00
|
|
|
def install
|
2016-01-06 17:49:14 +00:00
|
|
|
ENV.java_cache
|
|
|
|
|
2012-01-09 21:22:30 +00:00
|
|
|
system "mvn"
|
2014-05-21 16:16:08 +00:00
|
|
|
system "tar", "-xzf", "target/couchdb-lucene-#{version}-dist.tar.gz", "--strip", "1"
|
2009-12-20 02:51:22 +00:00
|
|
|
|
2014-05-21 16:16:08 +00:00
|
|
|
prefix.install_metafiles
|
|
|
|
rm_rf Dir["bin/*.bat"]
|
|
|
|
libexec.install Dir["*"]
|
2010-04-19 20:43:50 +00:00
|
|
|
|
2014-05-31 15:00:24 +00:00
|
|
|
Dir.glob("#{libexec}/bin/*") do |path|
|
2014-05-21 16:16:08 +00:00
|
|
|
bin_name = File.basename(path)
|
2014-12-15 23:04:21 +00:00
|
|
|
cmd = "cl_#{bin_name}"
|
|
|
|
(bin/cmd).write shim_script(bin_name)
|
|
|
|
(libexec/"clbin").install_symlink bin/cmd => bin_name
|
2014-05-21 16:16:08 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
ini_path.write(ini_file) unless ini_path.exist?
|
|
|
|
end
|
|
|
|
|
|
|
|
def shim_script(target); <<-EOS.undent
|
|
|
|
#!/bin/bash
|
|
|
|
export CL_BASEDIR=#{libexec}/bin
|
|
|
|
exec "$CL_BASEDIR/#{target}" "$@"
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
|
|
|
|
def ini_path
|
|
|
|
etc/"couchdb/local.d/couchdb-lucene.ini"
|
2010-04-19 20:43:50 +00:00
|
|
|
end
|
|
|
|
|
2012-11-25 15:06:41 +00:00
|
|
|
def ini_file; <<-EOS.undent
|
2013-01-31 17:17:29 +00:00
|
|
|
[httpd_global_handlers]
|
|
|
|
_fti = {couch_httpd_proxy, handle_proxy_req, <<"http://127.0.0.1:5985">>}
|
2011-09-02 21:41:57 +00:00
|
|
|
EOS
|
2010-04-19 20:43:50 +00:00
|
|
|
end
|
|
|
|
|
2014-12-15 23:04:21 +00:00
|
|
|
plist_options :manual => "#{HOMEBREW_PREFIX}/opt/couchdb-lucene/bin/cl_run"
|
2009-12-20 02:51:22 +00:00
|
|
|
|
2012-11-25 15:06:41 +00:00
|
|
|
def plist; <<-EOS.undent
|
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
|
|
|
|
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
|
|
<plist version="1.0">
|
|
|
|
<dict>
|
|
|
|
<key>Label</key>
|
|
|
|
<string>#{plist_name}</string>
|
|
|
|
<key>EnvironmentVariables</key>
|
|
|
|
<dict>
|
|
|
|
<key>HOME</key>
|
|
|
|
<string>~</string>
|
|
|
|
</dict>
|
|
|
|
<key>ProgramArguments</key>
|
|
|
|
<array>
|
2014-12-15 23:04:21 +00:00
|
|
|
<string>#{opt_bin}/cl_run</string>
|
2012-11-25 15:06:41 +00:00
|
|
|
</array>
|
|
|
|
<key>StandardOutPath</key>
|
|
|
|
<string>/dev/null</string>
|
|
|
|
<key>StandardErrorPath</key>
|
|
|
|
<string>/dev/null</string>
|
|
|
|
<key>RunAtLoad</key>
|
|
|
|
<true/>
|
|
|
|
<key>KeepAlive</key>
|
|
|
|
<true/>
|
|
|
|
</dict>
|
|
|
|
</plist>
|
|
|
|
EOS
|
2009-12-20 02:51:22 +00:00
|
|
|
end
|
2014-12-15 23:04:21 +00:00
|
|
|
|
|
|
|
def caveats; <<-EOS.undent
|
|
|
|
All commands have been installed with the prefix 'cl_'.
|
|
|
|
|
|
|
|
If you really need to use these commands with their normal names, you
|
|
|
|
can add a "clbin" directory to your PATH from your bashrc like:
|
|
|
|
|
|
|
|
PATH="#{opt_libexec}/clbin:$PATH"
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
2016-01-06 17:49:14 +00:00
|
|
|
# This seems to be the easiest way to make the test play nicely in our
|
|
|
|
# sandbox. If it works here, it'll work in the normal location though.
|
|
|
|
cp_r Dir[opt_prefix/"*"], testpath
|
|
|
|
inreplace "bin/cl_run", "CL_BASEDIR=#{libexec}/bin",
|
|
|
|
"CL_BASEDIR=#{testpath}/libexec/bin"
|
|
|
|
|
|
|
|
io = IO.popen("#{testpath}/bin/cl_run")
|
2014-12-15 23:04:21 +00:00
|
|
|
sleep 2
|
|
|
|
Process.kill("SIGINT", io.pid)
|
|
|
|
Process.wait(io.pid)
|
|
|
|
io.read !~ /Exception/
|
|
|
|
end
|
2010-09-01 15:12:56 +00:00
|
|
|
end
|