87 lines
2.6 KiB
Ruby
87 lines
2.6 KiB
Ruby
require "language/node"
|
|
|
|
class Chronograf < Formula
|
|
desc "Open source monitoring and visualization UI for the TICK stack"
|
|
homepage "https://docs.influxdata.com/chronograf/latest/"
|
|
url "https://github.com/influxdata/chronograf/archive/1.4.4.2.tar.gz"
|
|
sha256 "5bedf8f51eac859d762994d7c45fdfef45da5cd5b1d7f36e442f7eebde37c057"
|
|
head "https://github.com/influxdata/chronograf.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "4257d4d89f1281177355a6997127fbf1aa1e7e123b499c31d5ebb23eacfc32e9" => :high_sierra
|
|
sha256 "fc226c0dce5e67a0521430e0b344543095649d88a11cb92ce75029c8dbd5bbde" => :sierra
|
|
sha256 "7acd40aa9c226996e0dd5186ab443bbb6a7a2abb281d1e07b67a8e286e0504f4" => :el_capitan
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
depends_on "node" => :build
|
|
depends_on "yarn" => :build
|
|
depends_on "influxdb" => :recommended
|
|
depends_on "kapacitor" => :recommended
|
|
|
|
def install
|
|
ENV["GOPATH"] = buildpath
|
|
ENV.prepend_create_path "PATH", buildpath/"bin"
|
|
Language::Node.setup_npm_environment
|
|
chronograf_path = buildpath/"src/github.com/influxdata/chronograf"
|
|
chronograf_path.install buildpath.children
|
|
|
|
# fixes yarn + upath@1.0.4 incompatibility, remove once upath is upgraded to 1.0.5+
|
|
Pathname.new("#{ENV["HOME"]}/.yarnrc").write("ignore-engines true\n")
|
|
|
|
cd chronograf_path do
|
|
system "make", "dep"
|
|
system "make", ".jssrc"
|
|
system "make", "chronograf"
|
|
bin.install "chronograf"
|
|
prefix.install_metafiles
|
|
end
|
|
end
|
|
|
|
plist_options :manual => "chronograf"
|
|
|
|
def plist; <<~EOS
|
|
<?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}/chronograf</string>
|
|
</array>
|
|
<key>RunAtLoad</key>
|
|
<true/>
|
|
<key>WorkingDirectory</key>
|
|
<string>#{var}</string>
|
|
<key>StandardErrorPath</key>
|
|
<string>#{var}/log/chronograf.log</string>
|
|
<key>StandardOutPath</key>
|
|
<string>#{var}/log/chronograf.log</string>
|
|
</dict>
|
|
</plist>
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
begin
|
|
pid = fork do
|
|
exec "#{bin}/chronograf"
|
|
end
|
|
sleep 1
|
|
output = shell_output("curl -s 0.0.0.0:8888/chronograf/v1/")
|
|
sleep 1
|
|
assert_match %r{/chronograf/v1/layouts}, output
|
|
ensure
|
|
Process.kill("SIGINT", pid)
|
|
Process.wait(pid)
|
|
end
|
|
end
|
|
end
|