2014-03-04 22:54:29 +00:00
|
|
|
require "formula"
|
|
|
|
|
|
|
|
class Kafka < Formula
|
|
|
|
homepage "http://kafka.apache.org"
|
|
|
|
head "http://git-wip-us.apache.org/repos/asf/kafka.git"
|
2014-04-30 18:15:50 +00:00
|
|
|
url "http://mirrors.ibiblio.org/apache/kafka/0.8.1.1/kafka-0.8.1.1-src.tgz"
|
|
|
|
mirror "http://mirror.sdunix.com/apache/kafka/0.8.1.1/kafka-0.8.1.1-src.tgz"
|
|
|
|
sha1 "104c15d22da36216a678e6a0c3243c552e47af87"
|
2014-03-04 22:54:29 +00:00
|
|
|
|
|
|
|
depends_on "zookeeper"
|
2014-10-27 03:30:28 +00:00
|
|
|
depends_on :java => "1.7"
|
2014-03-04 22:54:29 +00:00
|
|
|
|
|
|
|
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
|
2014-04-20 18:09:04 +00:00
|
|
|
|
|
|
|
Gradle's Scala plugin is not Java 8 compatible, so you may have to
|
2014-06-04 15:07:49 +00:00
|
|
|
use Java 7, see:
|
2014-04-20 18:09:04 +00:00
|
|
|
http://issues.gradle.org/browse/GRADLE-3023
|
2014-06-04 15:07:49 +00:00
|
|
|
|
|
|
|
If you have Java 7 installed along with other versions, try:
|
|
|
|
JAVA_HOME=$(/usr/libexec/java_home -v 1.7) brew install kafka
|
2014-03-04 22:54:29 +00:00
|
|
|
EOS
|
|
|
|
end
|
|
|
|
end
|