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'
|
2014-01-29 10:53:08 +00:00
|
|
|
url 'http://www.rabbitmq.com/releases/rabbitmq-server/v3.2.3/rabbitmq-server-mac-standalone-3.2.3.tar.gz'
|
|
|
|
sha1 'f7bd7fbc5e8f9021204352e02dba806d2064d564'
|
2009-09-01 15:01:20 +00:00
|
|
|
|
2013-07-10 02:30:15 +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
|
|
|
|
2013-06-27 10:43:15 +00:00
|
|
|
# Correct SYS_PREFIX for things like rabbitmq-plugins
|
|
|
|
inreplace sbin/'rabbitmq-defaults' do |s|
|
|
|
|
s.gsub! 'SYS_PREFIX=${RABBITMQ_HOME}', "SYS_PREFIX=#{HOMEBREW_PREFIX}"
|
|
|
|
s.gsub! 'CLEAN_BOOT_FILE="${SYS_PREFIX}', "CLEAN_BOOT_FILE=\"#{prefix}"
|
|
|
|
s.gsub! 'SASL_BOOT_FILE="${SYS_PREFIX}', "SASL_BOOT_FILE=\"#{prefix}"
|
|
|
|
end
|
2012-05-05 01:46:05 +00:00
|
|
|
|
2013-06-27 10:43:15 +00:00
|
|
|
# Set RABBITMQ_HOME in rabbitmq-env
|
2012-05-05 01:46:05 +00:00
|
|
|
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
|
|
|
|
2013-06-27 10:43:15 +00:00
|
|
|
# Enable plugins - management web UI and visualiser; STOMP, MQTT, AMQP 1.0 protocols
|
2012-05-05 01:46:05 +00:00
|
|
|
enabled_plugins_path = etc+'rabbitmq/enabled_plugins'
|
2013-06-27 10:43:15 +00:00
|
|
|
enabled_plugins_path.write '[rabbitmq_management,rabbitmq_management_visualiser,rabbitmq_stomp,rabbitmq_amqp1_0,rabbitmq_mqtt].' unless enabled_plugins_path.exist?
|
2012-11-23 16:46:27 +00:00
|
|
|
|
2012-12-12 15:21:29 +00:00
|
|
|
# Extract rabbitmqadmin and install to sbin
|
|
|
|
# use it to generate, then install the bash completion file
|
2013-02-10 20:27:38 +00:00
|
|
|
system "/usr/bin/unzip", "-qq", "-j",
|
|
|
|
"#{prefix}/plugins/rabbitmq_management-#{version}.ez",
|
|
|
|
"rabbitmq_management-#{version}/priv/www/cli/rabbitmqadmin"
|
2012-11-23 16:46:27 +00:00
|
|
|
|
2013-02-10 20:27:38 +00:00
|
|
|
sbin.install 'rabbitmqadmin'
|
2013-05-03 18:30:52 +00:00
|
|
|
(sbin/'rabbitmqadmin').chmod 0755
|
2013-05-03 18:03:31 +00:00
|
|
|
(bash_completion/'rabbitmqadmin.bash').write `#{sbin}/rabbitmqadmin --bash-completion`
|
2011-04-26 14:56:57 +00:00
|
|
|
end
|
|
|
|
|
2012-11-25 15:06:41 +00:00
|
|
|
def caveats; <<-EOS.undent
|
2012-11-23 16:46:27 +00:00
|
|
|
Management Plugin enabled by default at http://localhost:15672
|
2011-04-26 14:56:57 +00:00
|
|
|
EOS
|
|
|
|
end
|
2012-05-22 01:43:11 +00:00
|
|
|
|
2012-11-25 15:06:41 +00:00
|
|
|
def rabbitmq_env; <<-EOS.undent
|
2012-05-05 01:46:05 +00:00
|
|
|
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
|
|
|
|
2012-11-25 15:06:41 +00:00
|
|
|
plist_options :manual => 'rabbitmq-server'
|
|
|
|
|
|
|
|
def plist; <<-EOS.undent
|
|
|
|
<?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>
|
|
|
|
<string>#{plist_name}</string>
|
|
|
|
<key>Program</key>
|
|
|
|
<string>#{opt_prefix}/sbin/rabbitmq-server</string>
|
|
|
|
<key>RunAtLoad</key>
|
|
|
|
<true/>
|
|
|
|
<key>EnvironmentVariables</key>
|
|
|
|
<dict>
|
|
|
|
<!-- need erl in the path -->
|
|
|
|
<key>PATH</key>
|
|
|
|
<string>/usr/local/sbin:/usr/bin:/bin:/usr/local/bin</string>
|
|
|
|
<!-- specify the path to the rabbitmq-env.conf file -->
|
|
|
|
<key>CONF_ENV_FILE</key>
|
|
|
|
<string>#{etc}/rabbitmq/rabbitmq-env.conf</string>
|
|
|
|
</dict>
|
|
|
|
</dict>
|
|
|
|
</plist>
|
|
|
|
EOS
|
2009-09-01 15:01:20 +00:00
|
|
|
end
|
|
|
|
end
|