homebrew-core/Formula/snap-telemetry.rb
2016-11-30 11:50:41 +01:00

57 lines
1.9 KiB
Ruby

class SnapTelemetry < Formula
desc "Snap is an opensource telemetry framework"
homepage "http://snap-telemetry.io/"
url "https://github.com/intelsdi-x/snap/archive/1.0.0.tar.gz"
sha256 "0868462d85bb08f8ad02ab89a95c769881ace1ad941b738a8fb394caf70b5a0c"
head "https://github.com/intelsdi-x/snap.git"
bottle do
cellar :any_skip_relocation
sha256 "37603be06a97e81496610183963a05fa4ef793daa956df77de5b1f2f5c148d4c" => :sierra
sha256 "82851d93f29bf6c0b630dbf3d012ee4dbe6b84e9ef48034fef6be2c3c84816ed" => :el_capitan
sha256 "b834903c0da316a255ff5a9253dd14e035c2417e3fe6390fe981ef73c2735307" => :yosemite
end
depends_on "go" => :build
depends_on "glide" => :build
def install
ENV["GOPATH"] = buildpath
ENV["CGO_ENABLED"] = "0"
ENV["GLIDE_HOME"] = HOMEBREW_CACHE/"glide_home/#{name}"
snapteld = buildpath/"src/github.com/intelsdi-x/snap"
snapteld.install buildpath.children
cd snapteld do
system "glide", "install"
system "go", "build", "-o", "snapteld", "-ldflags", "-w -X main.gitversion=#{version}"
sbin.install "snapteld"
prefix.install_metafiles
end
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"
end
end
test do
assert_match version.to_s, shell_output("#{sbin}/snapteld --version")
assert_match version.to_s, shell_output("#{bin}/snaptel --version")
begin
snapteld_pid = fork do
exec "#{sbin}/snapteld -t 0 -l 1 -o #{testpath}"
end
sleep 5
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?
ensure
Process.kill("TERM", snapteld_pid)
end
end
end