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'
|
2012-04-27 23:27:54 +00:00
|
|
|
url 'http://www.apache.org/dyn/closer.cgi?path=/cassandra/1.1.0/apache-cassandra-1.1.0-bin.tar.gz'
|
|
|
|
sha1 'fba12b5b89211487c6d595f69d13e8b963732b62'
|
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"
|
2010-04-21 08:45:34 +00:00
|
|
|
|
2011-06-03 20:03:54 +00:00
|
|
|
inreplace "conf/cassandra-env.sh" do |s|
|
|
|
|
s.gsub! "/lib/", "/"
|
|
|
|
end
|
|
|
|
|
2010-04-21 08:45:34 +00:00
|
|
|
inreplace "bin/cassandra.in.sh" do |s|
|
2011-01-28 15:24:54 +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
|
2011-01-28 15:24:54 +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
|
2011-01-28 15:24:54 +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/*"]
|
2011-06-03 20:03:54 +00:00
|
|
|
prefix.install Dir["*.txt"] + Dir["{bin,interface,javadoc,lib/licenses}"]
|
2010-04-21 08:45:34 +00:00
|
|
|
prefix.install Dir["lib/*.jar"]
|
2011-09-15 23:50:17 +00:00
|
|
|
|
2011-12-31 05:56:52 +00:00
|
|
|
plist_path.write startup_plist
|
|
|
|
plist_path.chmod 0644
|
2011-09-15 23:50:17 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def caveats; <<-EOS.undent
|
|
|
|
If this is your first install, automatically load on login with:
|
|
|
|
mkdir -p ~/Library/LaunchAgents
|
2011-12-31 05:56:52 +00:00
|
|
|
cp #{plist_path} ~/Library/LaunchAgents/
|
|
|
|
launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename}
|
2011-09-15 23:50:17 +00:00
|
|
|
EOS
|
|
|
|
end
|
|
|
|
|
|
|
|
def startup_plist; <<-EOPLIST
|
|
|
|
<?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>
|
2011-12-31 05:56:52 +00:00
|
|
|
<string>#{plist_name}</string>
|
2011-09-15 23:50:17 +00:00
|
|
|
|
|
|
|
<key>ProgramArguments</key>
|
|
|
|
<array>
|
2011-12-31 22:13:31 +00:00
|
|
|
<string>#{HOMEBREW_PREFIX}/bin/cassandra</string>
|
2011-09-15 23:50:17 +00:00
|
|
|
<string>-f</string>
|
|
|
|
</array>
|
|
|
|
|
|
|
|
<key>RunAtLoad</key>
|
|
|
|
<true/>
|
|
|
|
|
|
|
|
<key>WorkingDirectory</key>
|
|
|
|
<string>#{var}/lib/cassandra</string>
|
|
|
|
</dict>
|
|
|
|
</plist>
|
|
|
|
EOPLIST
|
2010-04-21 08:45:34 +00:00
|
|
|
end
|
2010-08-29 13:49:21 +00:00
|
|
|
end
|