forked from lotia/homebrew-versions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsolr36.rb
68 lines (60 loc) · 1.94 KB
/
solr36.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
class Solr36 < Formula
desc "Enterprise search platform from Apache Lucene project"
homepage "https://lucene.apache.org/solr/"
url "https://archive.apache.org/dist/lucene/solr/3.6.2/apache-solr-3.6.2.tgz"
sha256 "537426dcbdd0dc82dd5bf16b48b6bcaf87cb4049c1245eea8dcb79eeaf3e7ac6"
depends_on :java
conflicts_with "solr", :because => "Differing versions of same formula"
def script; <<-EOS.undent
#!/bin/sh
if [ -z "$1" ]; then
echo "Usage: $ solr36 path/to/config/dir"
else
cd #{libexec}/example && java -Dsolr.solr.home=$1 -jar start.jar
fi
EOS
end
def install
libexec.install Dir["*"]
(bin+"solr36").write script
(var+"logs"+name).mkpath
(etc+name).mkpath
(etc+name).install Dir[libexec+"example/multicore"] unless (etc+name+"multicore").exist?
end
def caveats; <<-EOS.undent
To start solr:
solr path/to/solr/config/dir
See the solr homepage for more setup information:
brew home solr
EOS
end
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>ProgramArguments</key>
<array>
<string>/usr/bin/java</string>
<string>-Djetty.home=#{libexec}/example</string>
<string>-Djetty.logs=#{var}/logs/#{name}</string>
<string>-Dsolr.solr.home=#{etc+name+"multicore"}</string>
<string>-jar</string>
<string>#{libexec}/example/start.jar</string>
</array>
<key>ServiceDescription</key>
<string>Solr</string>
<key>WorkingDirectory</key>
<string>#{HOMEBREW_PREFIX}</string>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
EOS
end
test do
system "solr36"
end
end