require "formula" class Influxdb < Formula homepage "http://influxdb.org" url "http://get.influxdb.org/influxdb-0.6.0.src.tar.gz" sha1 "5f1973a6b04eceb22cd989477fcea6cead1879ea" bottle do sha1 "7777678ee95d5971126869a5916a8826f7777fe2" => :mavericks sha1 "d93b0f58f03bb1ae6eafba9af9007a48df894b2b" => :mountain_lion sha1 "328d7b22e3b568ba4a03ab92bb2f453c197f0735" => :lion end depends_on "leveldb" depends_on "protobuf" => :build depends_on "bison" => :build depends_on "flex" => :build depends_on "go" => :build def install ENV["GOPATH"] = buildpath flex = Formula["flex"].bin/"flex" bison = Formula["bison"].bin/"bison" system "./configure", "--with-flex=#{flex}", "--with-bison=#{bison}" system "make", "dependencies", "protobuf", "parser" system "go", "build", "daemon" inreplace "config.sample.toml" do |s| s.gsub! "/tmp/influxdb/development/db", "#{var}/influxdb/data" s.gsub! "/tmp/influxdb/development/raft", "#{var}/influxdb/raft" s.gsub! "/tmp/influxdb/development/wal", "#{var}/influxdb/wal" s.gsub! "./admin", "#{opt_share}/admin" end bin.install "daemon" => "influxdb" etc.install "config.sample.toml" => "influxdb.conf" share.install "admin" (var/"influxdb/data").mkpath (var/"influxdb/raft").mkpath end plist_options :manual => "influxdb -config=#{HOMEBREW_PREFIX}/etc/influxdb.conf" def plist; <<-EOS.undent KeepAlive SuccessfulExit Label #{plist_name} ProgramArguments #{opt_bin}/influxdb -config=#{etc}/influxdb.conf RunAtLoad WorkingDirectory #{var} StandardErrorPath #{var}/log/influxdb.log StandardOutPath #{var}/log/influxdb.log EOS end test do system "#{bin}/influxdb", "-v" end end