homebrew-core/Formula/kafka.rb
Joshua Griffith 9b05c03f87 kafka 0.8.1 (new formula)
Closes Homebrew/homebrew#27511.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2014-03-19 14:52:42 +00:00

44 lines
1.4 KiB
Ruby

require "formula"
class Kafka < Formula
homepage "http://kafka.apache.org"
head "http://git-wip-us.apache.org/repos/asf/kafka.git"
url "http://mirrors.ibiblio.org/apache/kafka/0.8.1/kafka-0.8.1-src.tgz"
mirror "http://mirror.sdunix.com/apache/kafka/0.8.1/kafka-0.8.1-src.tgz"
sha1 "af88a986ef711f5fd30063a9cb3395e63884bf0b"
depends_on "zookeeper"
def install
system "./gradlew", "jar"
# Use 1 partition by default so individual consumers receive all topic messages
inreplace "config/server.properties", "num.partitions=2", "num.partitions=1"
logs = var/"log/kafka"
inreplace "config/log4j.properties", "kafka.logs.dir=logs", "kafka.logs.dir=#{logs}"
inreplace "config/test-log4j.properties", ".File=logs/", ".File=#{logs}/"
data = var/"lib"
inreplace "config/server.properties",
"log.dirs=/tmp/kafka-logs", "log.dirs=#{data}/kafka-logs"
inreplace "config/zookeeper.properties",
"dataDir=/tmp/zookeeper", "dataDir=#{data}/zookeeper"
libexec.install %w(contrib core examples lib perf system_test)
prefix.install "bin"
bin.env_script_all_files(libexec/"bin", :JAVA_HOME => "`/usr/libexec/java_home`")
mv "config", "kafka"
etc.install "kafka"
libexec.install_symlink etc/"kafka" => "config"
end
def caveats; <<-EOS.undent
To start Kafka, ensure that ZooKeeper is running and then execute:
kafka-server-start.sh #{etc}/kafka/server.properties
EOS
end
end