2016-10-10 21:21:41 +00:00
|
|
|
class SnapTelemetry < Formula
|
|
|
|
desc "Snap is an opensource telemetry framework"
|
|
|
|
homepage "http://snap-telemetry.io/"
|
2016-11-23 20:26:19 +00:00
|
|
|
url "https://github.com/intelsdi-x/snap/archive/0.19.0.tar.gz"
|
|
|
|
sha256 "28c6ffa208b54251266d48236911d8c38fd27cabd79a84bf91d47376fd69dc7f"
|
2016-10-10 21:21:41 +00:00
|
|
|
|
|
|
|
head "https://github.com/intelsdi-x/snap.git"
|
|
|
|
|
2016-11-03 01:49:14 +00:00
|
|
|
bottle do
|
|
|
|
cellar :any_skip_relocation
|
2016-11-24 21:36:08 +00:00
|
|
|
sha256 "f511ccc9546bfbb75c3b61c7af3e86299137efab8e36599746df3ef8e72bbf3b" => :sierra
|
|
|
|
sha256 "41ed14ded1571f4a9578cb5c254fbbf19c70a312d85d13ce86b5bb96f38cb059" => :el_capitan
|
|
|
|
sha256 "40db8343a5afbd10d4dcca80d33496d52ad5ced91c2eec636812a5041fdf1725" => :yosemite
|
2016-11-03 01:49:14 +00:00
|
|
|
end
|
|
|
|
|
2016-11-03 02:35:38 +00:00
|
|
|
depends_on "go" => :build
|
|
|
|
depends_on "glide" => :build
|
2016-10-10 21:21:41 +00:00
|
|
|
|
|
|
|
def install
|
|
|
|
ENV["GOPATH"] = buildpath
|
|
|
|
ENV["CGO_ENABLED"] = "0"
|
|
|
|
ENV["GLIDE_HOME"] = HOMEBREW_CACHE/"glide_home/#{name}"
|
|
|
|
|
2016-11-23 20:26:19 +00:00
|
|
|
snapteld = buildpath/"src/github.com/intelsdi-x/snap"
|
|
|
|
snapteld.install buildpath.children
|
2016-10-10 21:21:41 +00:00
|
|
|
|
2016-11-23 20:26:19 +00:00
|
|
|
cd snapteld do
|
2016-10-10 21:21:41 +00:00
|
|
|
system "glide", "install"
|
2016-11-23 20:26:19 +00:00
|
|
|
system "go", "build", "-o", "snapteld", "-ldflags", "-w -X main.gitversion=#{version}"
|
|
|
|
sbin.install "snapteld"
|
2016-11-03 02:35:38 +00:00
|
|
|
prefix.install_metafiles
|
2016-10-10 21:21:41 +00:00
|
|
|
end
|
|
|
|
|
2016-11-23 20:26:19 +00:00
|
|
|
snaptel = buildpath/"src/github.com/intelsdi-x/snap/cmd/snaptel"
|
|
|
|
cd snaptel do
|
|
|
|
system "go", "build", "-o", "snaptel", "-ldflags", "-w -X main.gitversion=#{version}"
|
|
|
|
bin.install "snaptel"
|
2016-10-10 21:21:41 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
2016-11-23 20:26:19 +00:00
|
|
|
assert_match version.to_s, shell_output("#{sbin}/snapteld --version")
|
|
|
|
assert_match version.to_s, shell_output("#{bin}/snaptel --version")
|
2016-10-10 21:21:41 +00:00
|
|
|
|
|
|
|
begin
|
2016-11-23 20:26:19 +00:00
|
|
|
snapteld_pid = fork do
|
|
|
|
exec "#{sbin}/snapteld -t 0 -l 1 -o #{testpath}"
|
2016-10-10 21:21:41 +00:00
|
|
|
end
|
|
|
|
sleep 5
|
2016-11-23 20:26:19 +00:00
|
|
|
assert_match("No plugins", shell_output("#{bin}/snaptel plugin list"))
|
|
|
|
assert_match("No task", shell_output("#{bin}/snaptel task list"))
|
|
|
|
assert_predicate testpath/"snapteld.log", :exist?
|
2016-10-10 21:21:41 +00:00
|
|
|
ensure
|
2016-11-23 20:26:19 +00:00
|
|
|
Process.kill("TERM", snapteld_pid)
|
2016-10-10 21:21:41 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|