88 lines
2.6 KiB
Ruby
88 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.8.0.tar.gz"
|
|
sha256 "f1c6fa57a11e3ee11756c4a3b6e59845aede0f7e6191f41193b1f94a2453eb08"
|
|
head "https://github.com/influxdata/chronograf.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "836f37308ba8caf34aa8acc9190c9a6a1762bb8aee13c7c203c36744d70d2019" => :catalina
|
|
sha256 "ef17bb23eb3510cf38c15a35f1f2ea9d273af833d2f39cd48787f4ce7e958f56" => :mojave
|
|
sha256 "65aab11960c0c5176b1781be726d50adc06ee073ab821963778af522f8a73c5b" => :high_sierra
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
depends_on "go-bindata" => :build
|
|
depends_on "node" => :build
|
|
depends_on "yarn" => :build
|
|
depends_on "influxdb"
|
|
depends_on "kapacitor"
|
|
|
|
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
|
|
|
|
cd chronograf_path do
|
|
cd "ui" do # fix node 12 compatibility
|
|
system "yarn", "upgrade", "parcel@1.11.0", "node-sass@4.12.0"
|
|
end
|
|
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
|
|
pid = fork do
|
|
exec "#{bin}/chronograf"
|
|
end
|
|
sleep 10
|
|
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
|