require "formula" class Influxdb < Formula homepage "http://influxdb.org" url "http://get.influxdb.org/src/influxdb-0.1.0.tar.gz" sha1 "97b7a8f36597403e34b918744c60ce0398a2fffb" bottle do sha1 '2a381e41d4f9c528a196e23d6958f0e33abec685' => :mavericks sha1 '161ce695e748855936539d082b556625a7cc1661' => :mountain_lion sha1 'df7423b3de554fffb475528f5aac4fecbefcabe3' => :lion end depends_on "leveldb" depends_on "protobuf" => :build depends_on "bison" => :build depends_on "flex" => :build depends_on "go" => :build fails_with :clang do cause "clang: error: argument unused during compilation: '-fno-eliminate-unused-debug-types'" end def install ENV["GOPATH"] = buildpath system "go build src/server/server.go" inreplace "config.json.sample" do |s| s.gsub! "/tmp/influxdb/development/db", "#{var}/influxdb/data" s.gsub! "/tmp/influxdb/development/raft", "#{var}/influxdb/raft" s.gsub! "./admin/", "#{share}/admin/" end bin.install "server" => "influxdb" etc.install "config.json.sample" => "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_prefix}/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