blob: a9928ed2acb8874694a24812f59e838c570af921 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
  | 
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
    revision 1
    sha1 "53a44dbefeeff41290b56aba3d19cf6e023d0365" => :mavericks
    sha1 "401465576c5d57e0e57c2c4cf4a9d51a4f657f6f" => :mountain_lion
    sha1 "28ef892dd211dbb8f9262b77f6c687c6ddafe33f" => :lion
  end
  devel do
    url "http://get.influxdb.org/influxdb-0.5.0-rc.5.src.tar.gz"
    sha1 "8dd4a61d7557446b0846921c9d93111445d35a72"
  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.toml.sample" 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.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_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
  |