7eaa6013b0
* also install bash_completion script Closes Homebrew/homebrew#16533. Signed-off-by: Adam Vandenberg <flangy@gmail.com>
89 lines
2.9 KiB
Ruby
89 lines
2.9 KiB
Ruby
require 'formula'
|
|
|
|
class Rabbitmq < Formula
|
|
homepage 'http://www.rabbitmq.com'
|
|
url 'http://www.rabbitmq.com/releases/rabbitmq-server/v3.0.1/rabbitmq-server-generic-unix-3.0.1.tar.gz'
|
|
sha1 '6256a589eea964adc7e051945818cb1b63ededc7'
|
|
|
|
depends_on 'erlang'
|
|
depends_on 'simplejson' => :python if MacOS.version == :leopard
|
|
|
|
def install
|
|
# Install the base files
|
|
prefix.install Dir['*']
|
|
|
|
# Setup the lib files
|
|
(var+'lib/rabbitmq').mkpath
|
|
(var+'log/rabbitmq').mkpath
|
|
|
|
# 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?
|
|
|
|
# Enable the management web UI and visualiser
|
|
enabled_plugins_path = etc+'rabbitmq/enabled_plugins'
|
|
enabled_plugins_path.write enabled_plugins unless enabled_plugins_path.exist?
|
|
|
|
# Extract rabbitmqadmin and install to sbin
|
|
# use it to generate, then install the bash completion file
|
|
system ("/usr/bin/unzip", "-qq", "-j", "#{prefix}/plugins/rabbitmq_management-#{version}.ez", "rabbitmq_management-#{version}/priv/www/cli/rabbitmqadmin")
|
|
sbin.install 'rabbitmqadmin'
|
|
|
|
system ("#{sbin}/rabbitmqadmin --bash-completion > rabbitmqadmin.bash")
|
|
(prefix+'etc/bash_completion.d').install 'rabbitmqadmin.bash'
|
|
|
|
end
|
|
|
|
def caveats; <<-EOS.undent
|
|
Management Plugin enabled by default at http://localhost:15672
|
|
EOS
|
|
end
|
|
|
|
def enabled_plugins; <<-EOS.undent
|
|
[rabbitmq_management,rabbitmq_management_visualiser].
|
|
EOS
|
|
end
|
|
|
|
def rabbitmq_env; <<-EOS.undent
|
|
CONFIG_FILE=#{etc}/rabbitmq/rabbitmq
|
|
NODE_IP_ADDRESS=127.0.0.1
|
|
NODENAME=rabbit@localhost
|
|
EOS
|
|
end
|
|
|
|
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>UserName</key>
|
|
<string>#{`whoami`.chomp}</string>
|
|
<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
|
|
end
|
|
end
|