homebrew-core/Formula/influxdb.rb

84 lines
2.5 KiB
Ruby
Raw Normal View History

require "formula"
class Influxdb < Formula
homepage "http://influxdb.org"
2014-10-25 01:42:52 +00:00
url "https://s3.amazonaws.com/get.influxdb.org/influxdb-0.8.4.src.tar.gz"
sha1 "c3e7dba0a790370bf63c4d80af2fb52d84b1bead"
2013-12-04 06:24:52 +00:00
bottle do
sha1 "00baab0b7a8d8fb881f08b9a5c3c7f745cfcada4" => :yosemite
sha1 "42ff9717282f9ca527921f4fe35ce4c7f3ab2097" => :mavericks
sha1 "2f638371dd6d200c45c93cb8b721aea8a8aef7aa" => :mountain_lion
2013-12-04 06:24:52 +00:00
end
depends_on "leveldb"
2014-10-03 15:09:48 +00:00
depends_on "rocksdb"
2014-09-26 22:05:42 +00:00
depends_on "autoconf" => :build
depends_on "protobuf" => :build
depends_on "bison" => :build
depends_on "flex" => :build
depends_on "go" => :build
2014-09-26 22:05:42 +00:00
depends_on "gawk" => :build
def install
2014-10-25 01:42:52 +00:00
ENV["GOPATH"] = buildpath
Dir.chdir File.join(buildpath, "src", "github.com", "influxdb", "influxdb")
2014-02-25 07:00:56 +00:00
flex = Formula["flex"].bin/"flex"
bison = Formula["bison"].bin/"bison"
system "./configure", "--with-flex=#{flex}", "--with-bison=#{bison}"
2014-10-25 01:42:52 +00:00
system "make", "parser", "protobuf"
system "go", "build", "-tags", "rocksdb", "-o", "influxdb", "github.com/influxdb/influxdb/daemon"
2014-04-17 21:30:26 +00:00
inreplace "config.sample.toml" do |s|
s.gsub! "/tmp/influxdb/development/db", "#{var}/influxdb/data"
s.gsub! "/tmp/influxdb/development/raft", "#{var}/influxdb/raft"
2014-03-10 15:12:48 +00:00
s.gsub! "/tmp/influxdb/development/wal", "#{var}/influxdb/wal"
2014-09-26 22:05:42 +00:00
s.gsub! "influxdb.log", "#{var}/influxdb/logs/influxdb.log"
end
2014-09-26 22:05:42 +00:00
bin.install "influxdb" => "influxdb"
2014-04-17 21:30:26 +00:00
etc.install "config.sample.toml" => "influxdb.conf"
2014-01-17 23:02:12 +00:00
(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>
2014-03-06 05:28:31 +00:00
<string>#{opt_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
2014-01-17 23:02:12 +00:00
system "#{bin}/influxdb", "-v"
end
end