require "formula" class Influxdb < Formula homepage "http://influxdb.com" url "https://s3.amazonaws.com/get.influxdb.org/influxdb-0.8.8.src.tar.gz" sha1 "a5686d0374ec5ab616e335e9c5fb1aeacd17fb00" bottle do sha1 "f59ea0b22a3e67bedd7114eab969b96a2d7b24e4" => :yosemite sha1 "c8eabdc0de535474dae4de8a77bae7f4a2711029" => :mavericks sha1 "693a7b3ab9a445a9e681048ecb7aba3582821fe8" => :mountain_lion end depends_on "leveldb" depends_on "rocksdb" depends_on "autoconf" => :build depends_on "protobuf" => :build depends_on "bison" => :build depends_on "flex" => :build depends_on "go" => :build depends_on "gawk" => :build depends_on :hg => :build def install ENV["GOPATH"] = buildpath Dir.chdir File.join(buildpath, "src", "github.com", "influxdb", "influxdb") flex = Formula["flex"].bin/"flex" bison = Formula["bison"].bin/"bison" inreplace "configure" do |s| s.gsub! "echo -n", "$as_echo_n" end system "./configure", "--with-flex=#{flex}", "--with-bison=#{bison}", "--with-rocksdb" system "make", "parser", "protobuf" system "go", "build", "-tags", "leveldb rocksdb", "-o", "influxdb", "github.com/influxdb/influxdb/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! "influxdb.log", "#{var}/influxdb/logs/influxdb.log" end bin.install "influxdb" => "influxdb" etc.install "config.sample.toml" => "influxdb.conf" (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