homebrew-core/Formula/influxdb.rb
Homebrew 0f48c53437 influxdb: add 0.4.1 bottle.
Closes Homebrew/homebrew#26300.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2014-01-31 19:14:45 +01:00

79 lines
2.3 KiB
Ruby

require "formula"
class Influxdb < Formula
homepage "http://influxdb.org"
url "http://get.influxdb.org/influxdb-0.4.1.src.tar.gz"
sha1 "f452cfce6e08f56e0fd6071d2a127446c165e08b"
bottle do
sha1 "90d21ae22304b058954ce5deaba6b3f9c77eb16c" => :mavericks
sha1 "d38c2781c2f81cb2ad5ad12e8789d511235ec908" => :mountain_lion
sha1 "be6df288b6d385c27e48ba221a12970be0eb0beb" => :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.factory("flex").bin/"flex"
bison = Formula.factory("bison").bin/"bison"
system "./configure", "--with-flex=#{flex}", "--with-bison=#{bison}"
system "make", "dependencies", "protobuf", "parser"
system "go", "build", "daemon"
inreplace "config.toml.sample" do |s|
s.gsub! "/tmp/influxdb/development/db", "#{var}/influxdb/data"
s.gsub! "/tmp/influxdb/development/raft", "#{var}/influxdb/raft"
s.gsub! "./admin", "#{opt_prefix}/share/admin"
end
bin.install "daemon" => "influxdb"
etc.install "config.toml.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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<dict>
<key>SuccessfulExit</key>
<false/>
</dict>
<key>Label</key>
<string>#{plist_name}</string>
<key>ProgramArguments</key>
<array>
<string>#{opt_prefix}/bin/influxdb</string>
<string>-config=#{etc}/influxdb.conf</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>WorkingDirectory</key>
<string>#{var}</string>
<key>StandardErrorPath</key>
<string>#{var}/log/influxdb.log</string>
<key>StandardOutPath</key>
<string>#{var}/log/influxdb.log</string>
</dict>
</plist>
EOS
end
test do
system "#{bin}/influxdb", "-v"
end
end