forked from lotia/homebrew-versions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cassandra10.rb
73 lines (63 loc) · 2.58 KB
/
cassandra10.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
69
70
71
72
73
class Cassandra10 < Formula
desc "Eventually consistent, distributed key-value store"
homepage "https://cassandra.apache.org"
url "https://archive.apache.org/dist/cassandra/1.0.12/apache-cassandra-1.0.12-bin.tar.gz"
sha256 "97f2896263960aa53faa201b07d5a89d531d5e2ab3d9d788e5fc5bc5e9ef985a"
conflicts_with "cassandra",
:because => "cassandra10 and cassandra install the same binaries."
def install
(var/"lib/cassandra").mkpath
(var/"log/cassandra").mkpath
(etc/"cassandra").mkpath
inreplace "conf/cassandra.yaml", "/var/lib/cassandra", "#{var}/lib/cassandra"
inreplace "conf/log4j-server.properties", "/var/log/cassandra", "#{var}/log/cassandra"
inreplace "conf/cassandra-env.sh", "/lib/", "/"
inreplace "bin/cassandra.in.sh" do |s|
s.gsub! "CASSANDRA_HOME=`dirname $0`/..", "CASSANDRA_HOME=#{libexec}"
# Store configs in etc, outside of keg
s.gsub! "CASSANDRA_CONF=$CASSANDRA_HOME/conf", "CASSANDRA_CONF=#{etc}/cassandra"
# Jars installed to prefix, no longer in a lib folder
s.gsub! "CASSANDRA_HOME/lib/*.jar", "CASSANDRA_HOME/*.jar"
end
rm Dir["bin/*.bat"]
(etc/"cassandra").install Dir["conf/*"]
libexec.install Dir["*.txt", "{bin,interface,javadoc,pylib,lib/licenses}"]
libexec.install Dir["lib/*.jar"]
bin.write_exec_script Dir["#{libexec}/bin/*"]
share.install [libexec/"bin/cassandra.in.sh", libexec/"bin/stop-server"]
inreplace Dir["#{libexec}/bin/cassandra*", "#{libexec}/bin/debug-cql",
"#{libexec}/bin/json2sstable", "#{libexec}/bin/nodetool",
"#{libexec}/bin/sstable*"],
%r{`dirname "?\$0"?`\/cassandra.in.sh},
"#{share}/cassandra.in.sh"
end
def caveats; <<-EOS.undent
If you plan to use the CQL shell (cqlsh), you will need the Python CQL library
installed. Since Homebrew prefers using pip for Python packages, you can
install that using:
pip install cql
EOS
end
def plist; <<-EOS.undent
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>#{plist_name}</string>
<key>ProgramArguments</key>
<array>
<string>#{opt_bin}/cassandra</string>
<string>-f</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>WorkingDirectory</key>
<string>#{var}/lib/cassandra</string>
</dict>
</plist>
EOS
end
end