2009-10-15 08:07:12 +00:00
|
|
|
require 'formula'
|
2009-09-01 15:01:20 +00:00
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Rabbitmq < Formula
|
2011-08-31 17:17:24 +00:00
|
|
|
homepage 'http://www.rabbitmq.com'
|
2012-09-27 16:34:22 +00:00
|
|
|
url 'http://www.rabbitmq.com/releases/rabbitmq-server/v2.8.7/rabbitmq-server-generic-unix-2.8.7.tar.gz'
|
|
|
|
sha1 '16965e5c3486f6882df363064707777fc4cbbe2e'
|
2009-09-01 15:01:20 +00:00
|
|
|
|
|
|
|
depends_on 'erlang'
|
2012-09-05 04:04:01 +00:00
|
|
|
depends_on 'simplejson' => :python if MacOS.version == :leopard
|
2009-09-01 15:01:20 +00:00
|
|
|
|
|
|
|
def install
|
2012-05-05 01:46:05 +00:00
|
|
|
# Install the base files
|
|
|
|
prefix.install Dir['*']
|
2009-10-02 09:53:14 +00:00
|
|
|
|
2012-05-05 01:46:05 +00:00
|
|
|
# Setup the lib files
|
2010-09-07 14:24:34 +00:00
|
|
|
(var+'lib/rabbitmq').mkpath
|
|
|
|
(var+'log/rabbitmq').mkpath
|
2009-10-02 09:53:14 +00:00
|
|
|
|
2012-05-05 01:46:05 +00:00
|
|
|
# Replace the SYS_PREFIX for things like rabbitmq-plugins
|
|
|
|
inreplace (sbin + 'rabbitmq-defaults'), 'SYS_PREFIX=${RABBITMQ_HOME}', "SYS_PREFIX=#{HOMEBREW_PREFIX}"
|
|
|
|
|
|
|
|
# Set the RABBITMQ_HOME in rabbitmq-env
|
|
|
|
inreplace (sbin + 'rabbitmq-env'), 'RABBITMQ_HOME="${SCRIPT_DIR}/.."', "RABBITMQ_HOME=#{prefix}"
|
|
|
|
|
|
|
|
# Create the rabbitmq-env.conf file
|
|
|
|
rabbitmq_env_conf = etc+'rabbitmq/rabbitmq-env.conf'
|
|
|
|
rabbitmq_env_conf.write rabbitmq_env unless rabbitmq_env_conf.exist?
|
2009-10-17 19:27:27 +00:00
|
|
|
|
2012-05-05 01:46:05 +00:00
|
|
|
# Enable the management web UI
|
|
|
|
enabled_plugins_path = etc+'rabbitmq/enabled_plugins'
|
|
|
|
enabled_plugins_path.write enabled_plugins unless enabled_plugins_path.exist?
|
2011-04-26 14:56:57 +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-04-26 14:56:57 +00:00
|
|
|
|
2012-02-04 14:57:53 +00:00
|
|
|
If this is an upgrade and you already have the #{plist_path.basename} loaded:
|
2011-12-31 05:56:52 +00:00
|
|
|
launchctl unload -w ~/Library/LaunchAgents/#{plist_path.basename}
|
|
|
|
cp #{plist_path} ~/Library/LaunchAgents/
|
|
|
|
launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename}
|
2011-04-26 14:56:57 +00:00
|
|
|
|
2012-05-05 01:46:05 +00:00
|
|
|
Management Plugin enabled by default at http://localhost:55672
|
2012-05-22 01:43:11 +00:00
|
|
|
|
2012-05-05 01:46:05 +00:00
|
|
|
To start rabbitmq-server manually:
|
2011-04-26 14:56:57 +00:00
|
|
|
rabbitmq-server
|
|
|
|
EOS
|
|
|
|
end
|
2012-05-22 01:43:11 +00:00
|
|
|
|
2012-05-05 01:46:05 +00:00
|
|
|
def enabled_plugins
|
|
|
|
return <<-EOS.undent
|
|
|
|
[rabbitmq_management,rabbitmq_management_visualiser].
|
|
|
|
EOS
|
|
|
|
end
|
2011-04-26 14:56:57 +00:00
|
|
|
|
2012-05-05 01:46:05 +00:00
|
|
|
def rabbitmq_env
|
|
|
|
return <<-EOS.undent
|
|
|
|
CONFIG_FILE=#{etc}/rabbitmq/rabbitmq
|
|
|
|
NODE_IP_ADDRESS=127.0.0.1
|
2012-05-22 01:43:11 +00:00
|
|
|
NODENAME=rabbit@localhost
|
2012-05-05 01:46:05 +00:00
|
|
|
EOS
|
|
|
|
end
|
2012-05-22 01:43:11 +00:00
|
|
|
|
2011-04-26 14:56:57 +00:00
|
|
|
def startup_plist
|
|
|
|
return <<-EOPLIST
|
|
|
|
<?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>
|
2011-12-31 05:56:52 +00:00
|
|
|
<string>#{plist_name}</string>
|
2011-04-26 14:56:57 +00:00
|
|
|
<key>Program</key>
|
2011-12-31 22:13:31 +00:00
|
|
|
<string>#{HOMEBREW_PREFIX}/sbin/rabbitmq-server</string>
|
2011-04-26 14:56:57 +00:00
|
|
|
<key>RunAtLoad</key>
|
|
|
|
<true/>
|
|
|
|
<key>UserName</key>
|
|
|
|
<string>#{`whoami`.chomp}</string>
|
|
|
|
<key>EnvironmentVariables</key>
|
|
|
|
<dict>
|
2012-05-05 01:46:05 +00:00
|
|
|
<!-- need erl in the path -->
|
2011-04-26 14:56:57 +00:00
|
|
|
<key>PATH</key>
|
|
|
|
<string>/usr/local/sbin:/usr/bin:/bin:/usr/local/bin</string>
|
2012-05-05 01:46:05 +00:00
|
|
|
<!-- specify the path to the rabbitmq-env.conf file -->
|
|
|
|
<key>CONF_ENV_FILE</key>
|
|
|
|
<string>#{etc}/rabbitmq/rabbitmq-env.conf</string>
|
2011-04-26 14:56:57 +00:00
|
|
|
</dict>
|
|
|
|
</dict>
|
|
|
|
</plist>
|
|
|
|
EOPLIST
|
2009-09-01 15:01:20 +00:00
|
|
|
end
|
|
|
|
end
|