2010-04-21 08:45:34 +00:00
|
|
|
require 'formula'
|
|
|
|
|
2011-03-10 18:09:03 +00:00
|
|
|
class Cassandra < Formula
|
2010-04-21 08:45:34 +00:00
|
|
|
homepage 'http://cassandra.apache.org'
|
2013-09-30 03:37:26 +00:00
|
|
|
url 'http://www.apache.org/dyn/closer.cgi?path=/cassandra/2.0.1/apache-cassandra-2.0.1-bin.tar.gz'
|
|
|
|
sha1 'fc9b00bbb0cf1f76e16f4d82db4c207a9d43268b'
|
2010-04-21 08:45:34 +00:00
|
|
|
|
|
|
|
def install
|
|
|
|
(var+"lib/cassandra").mkpath
|
|
|
|
(var+"log/cassandra").mkpath
|
|
|
|
(etc+"cassandra").mkpath
|
|
|
|
|
2011-01-28 15:24:54 +00:00
|
|
|
inreplace "conf/cassandra.yaml", "/var/lib/cassandra", "#{var}/lib/cassandra"
|
|
|
|
inreplace "conf/log4j-server.properties", "/var/log/cassandra", "#{var}/log/cassandra"
|
2012-09-14 01:29:53 +00:00
|
|
|
inreplace "conf/cassandra-env.sh", "/lib/", "/"
|
2011-06-03 20:03:54 +00:00
|
|
|
|
2010-04-21 08:45:34 +00:00
|
|
|
inreplace "bin/cassandra.in.sh" do |s|
|
2013-08-13 15:40:19 +00:00
|
|
|
s.gsub! "CASSANDRA_HOME=\"`dirname \"$0\"`/..\"", "CASSANDRA_HOME=\"#{prefix}\""
|
2010-04-21 08:45:34 +00:00
|
|
|
# Store configs in etc, outside of keg
|
2013-08-13 15:40:19 +00:00
|
|
|
s.gsub! "CASSANDRA_CONF=\"$CASSANDRA_HOME/conf\"", "CASSANDRA_CONF=\"#{etc}/cassandra\""
|
2010-04-21 08:45:34 +00:00
|
|
|
# Jars installed to prefix, no longer in a lib folder
|
2013-08-13 15:40:19 +00:00
|
|
|
s.gsub! "\"$CASSANDRA_HOME\"/lib/*.jar", "\"$CASSANDRA_HOME\"/*.jar"
|
2010-04-21 08:45:34 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
rm Dir["bin/*.bat"]
|
|
|
|
|
|
|
|
(etc+"cassandra").install Dir["conf/*"]
|
2012-06-06 16:51:09 +00:00
|
|
|
prefix.install Dir["*.txt"] + Dir["{bin,interface,javadoc,pylib,lib/licenses}"]
|
2010-04-21 08:45:34 +00:00
|
|
|
prefix.install Dir["lib/*.jar"]
|
2013-09-07 19:09:55 +00:00
|
|
|
|
|
|
|
share.install [bin+'cassandra.in.sh', bin+'stop-server']
|
|
|
|
inreplace Dir["#{bin}/cassandra*", "#{bin}/debug-cql",
|
|
|
|
"#{bin}/json2sstable", "#{bin}/nodetool",
|
|
|
|
"#{bin}/sstable*"],
|
|
|
|
/`dirname "?\$0"?`\/cassandra.in.sh/,
|
2013-09-07 19:38:16 +00:00
|
|
|
"#{share}/cassandra.in.sh"
|
2011-09-15 23:50:17 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def caveats; <<-EOS.undent
|
2012-06-06 16:51:09 +00:00
|
|
|
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
|
2011-09-15 23:50:17 +00:00
|
|
|
EOS
|
|
|
|
end
|
|
|
|
|
2012-11-25 15:06:41 +00:00
|
|
|
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/>
|
2011-09-15 23:50:17 +00:00
|
|
|
|
2012-11-25 15:06:41 +00:00
|
|
|
<key>Label</key>
|
|
|
|
<string>#{plist_name}</string>
|
2011-09-15 23:50:17 +00:00
|
|
|
|
2012-11-25 15:06:41 +00:00
|
|
|
<key>ProgramArguments</key>
|
|
|
|
<array>
|
|
|
|
<string>#{opt_prefix}/bin/cassandra</string>
|
|
|
|
<string>-f</string>
|
|
|
|
</array>
|
2011-09-15 23:50:17 +00:00
|
|
|
|
2012-11-25 15:06:41 +00:00
|
|
|
<key>RunAtLoad</key>
|
|
|
|
<true/>
|
2011-09-15 23:50:17 +00:00
|
|
|
|
2012-11-25 15:06:41 +00:00
|
|
|
<key>WorkingDirectory</key>
|
|
|
|
<string>#{var}/lib/cassandra</string>
|
|
|
|
</dict>
|
|
|
|
</plist>
|
|
|
|
EOS
|
2010-04-21 08:45:34 +00:00
|
|
|
end
|
2010-08-29 13:49:21 +00:00
|
|
|
end
|