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
|
2009-10-02 09:53:14 +00:00
|
|
|
homepage 'http://rabbitmq.com'
|
2011-04-09 15:52:08 +00:00
|
|
|
url 'http://www.rabbitmq.com/releases/rabbitmq-server/v2.4.1/rabbitmq-server-2.4.1.tar.gz'
|
|
|
|
md5 '6db31b4353bd44f8ae9b6756b0a831e6'
|
2009-09-01 15:01:20 +00:00
|
|
|
|
|
|
|
depends_on 'erlang'
|
2011-04-08 18:16:37 +00:00
|
|
|
depends_on 'simplejson' => :python if MacOS.leopard?
|
2009-09-01 15:01:20 +00:00
|
|
|
|
2010-06-29 19:23:10 +00:00
|
|
|
def patches
|
2010-09-07 14:24:34 +00:00
|
|
|
# Can't build manpages without a lot of other junk, so disable
|
2010-06-29 19:23:10 +00:00
|
|
|
DATA
|
|
|
|
end
|
|
|
|
|
2009-09-01 15:01:20 +00:00
|
|
|
def install
|
2010-02-17 18:14:00 +00:00
|
|
|
target_dir = "#{lib}/rabbitmq/erlang/lib/rabbitmq-#{version}"
|
2009-09-01 15:01:20 +00:00
|
|
|
system "make"
|
2009-11-11 19:27:37 +00:00
|
|
|
ENV['TARGET_DIR'] = target_dir
|
|
|
|
ENV['MAN_DIR'] = man
|
|
|
|
ENV['SBIN_DIR'] = sbin
|
|
|
|
system "make install"
|
2009-10-02 09:53:14 +00:00
|
|
|
|
2010-09-07 14:24:34 +00:00
|
|
|
(etc+'rabbitmq').mkpath
|
|
|
|
(var+'lib/rabbitmq').mkpath
|
|
|
|
(var+'log/rabbitmq').mkpath
|
2009-10-02 09:53:14 +00:00
|
|
|
|
2011-03-24 19:01:13 +00:00
|
|
|
%w{rabbitmq-server rabbitmqctl rabbitmq-env}.each do |script|
|
2010-09-08 16:07:59 +00:00
|
|
|
inreplace sbin+script do |s|
|
|
|
|
s.gsub! '/etc/rabbitmq', "#{etc}/rabbitmq"
|
|
|
|
s.gsub! '/var/lib/rabbitmq', "#{var}/lib/rabbitmq"
|
|
|
|
s.gsub! '/var/log/rabbitmq', "#{var}/log/rabbitmq"
|
2010-01-13 11:06:52 +00:00
|
|
|
end
|
2009-10-17 19:27:27 +00:00
|
|
|
end
|
|
|
|
|
2010-01-13 11:06:52 +00:00
|
|
|
# RabbitMQ Erlang binaries are installed in lib/rabbitmq/erlang/lib/rabbitmq-x.y.z/ebin
|
|
|
|
# therefore need to add this path for erl -pa
|
2010-09-07 21:34:39 +00:00
|
|
|
inreplace sbin+'rabbitmq-env', '${SCRIPT_DIR}/..', target_dir
|
2011-04-26 14:56:57 +00:00
|
|
|
|
|
|
|
(prefix+'com.rabbitmq.rabbitmq-server.plist').write startup_plist
|
|
|
|
end
|
|
|
|
|
|
|
|
def caveats
|
|
|
|
<<-EOS.undent
|
|
|
|
If this is your first install, automatically load on login with:
|
|
|
|
mkdir -p ~/Library/LaunchAgents
|
|
|
|
cp #{prefix}/com.rabbitmq.rabbitmq-server.plist ~/Library/LaunchAgents/
|
|
|
|
launchctl load -w ~/Library/LaunchAgents/com.rabbitmq.rabbitmq-server.plist
|
|
|
|
|
|
|
|
If this is an upgrade and you already have the com.rabbitmq.rabbitmq-server.plist loaded:
|
|
|
|
launchctl unload -w ~/Library/LaunchAgents/com.rabbitmq.rabbitmq-server.plist
|
|
|
|
cp #{prefix}/com.rabbitmq.rabbitmq-server.plist ~/Library/LaunchAgents/
|
|
|
|
launchctl load -w ~/Library/LaunchAgents/com.rabbitmq.rabbitmq-server.plist
|
|
|
|
|
|
|
|
To start rabbitmq-server manually:
|
|
|
|
rabbitmq-server
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
|
|
|
|
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>
|
|
|
|
<string>com.rabbitmq.rabbitmq-server</string>
|
|
|
|
<key>Program</key>
|
|
|
|
<string>/usr/local/sbin/rabbitmq-server</string>
|
|
|
|
<key>RunAtLoad</key>
|
|
|
|
<true/>
|
|
|
|
<key>UserName</key>
|
|
|
|
<string>#{`whoami`.chomp}</string>
|
|
|
|
<!-- need erl in the path -->
|
|
|
|
<key>EnvironmentVariables</key>
|
|
|
|
<dict>
|
|
|
|
<key>PATH</key>
|
|
|
|
<string>/usr/local/sbin:/usr/bin:/bin:/usr/local/bin</string>
|
|
|
|
</dict>
|
|
|
|
</dict>
|
|
|
|
</plist>
|
|
|
|
EOPLIST
|
2009-09-01 15:01:20 +00:00
|
|
|
end
|
|
|
|
end
|
2010-06-29 19:23:10 +00:00
|
|
|
|
|
|
|
__END__
|
|
|
|
diff --git a/Makefile b/Makefile
|
2010-11-30 23:28:05 +00:00
|
|
|
index d3f052f..98ce763 100644
|
2010-06-29 19:23:10 +00:00
|
|
|
--- a/Makefile
|
|
|
|
+++ b/Makefile
|
2010-11-30 23:28:05 +00:00
|
|
|
@@ -267,7 +267,7 @@ $(SOURCE_DIR)/%_usage.erl:
|
2010-09-07 14:24:34 +00:00
|
|
|
|
2010-06-29 19:23:10 +00:00
|
|
|
docs_all: $(MANPAGES) $(WEB_MANPAGES)
|
2010-09-07 14:24:34 +00:00
|
|
|
|
2010-11-30 23:28:05 +00:00
|
|
|
-install: install_bin install_docs
|
|
|
|
+install: install_bin
|
2010-09-07 14:24:34 +00:00
|
|
|
|
2010-11-30 23:28:05 +00:00
|
|
|
install_bin: all install_dirs
|
|
|
|
cp -r ebin include LICENSE LICENSE-MPL-RabbitMQ INSTALL $(TARGET_DIR)
|