forked from chrmoritz/homebrew-versions
-
Notifications
You must be signed in to change notification settings - Fork 18
/
cassandra12.rb
75 lines (64 loc) · 2.58 KB
/
cassandra12.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
74
75
class Cassandra12 < Formula
desc "Eventually consistent, distributed key-value store"
homepage "https://cassandra.apache.org"
url "https://www.apache.org/dyn/closer.cgi?path=/cassandra/1.2.19/apache-cassandra-1.2.19-bin.tar.gz"
sha256 "1c0c6e62dc612a43d6cb54bc70054876576a6cae7b90aca2162aa379df1b787e"
bottle :unneeded
conflicts_with "cassandra",
:because => "cassandra12 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! "/lib/", "/"
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