unpoller_unpoller/templates/unifi-poller.rb.tmpl

32 lines
813 B
Cheetah

# Homebrew Formula, still under development - June 2019
require "language/go"
class UnifiPoller < Formula
version "{{Version}}"
sha256 "{{SHA256}}"
url "{{URL}}/archive/v#{version}.tar.gz"
head "{{URL}}"
desc "{{Desc}}"
homepage "{{URL}}"
depends_on "go" => :build
depends_on "dep"
def install
ENV["GOPATH"] = buildpath
bin_path = buildpath/"src/github.com/davidnewhall/unifi-poller"
# Copy all files from their current location (GOPATH root)
# to $GOPATH/src/github.com/davidnewhall/unifi-poller
bin_path.install Dir["*"]
cd bin_path do
system "dep", "ensure"
system "make", "install", "VERSION=#{version}", "PREFIX=#{prefix}"
end
end
test do
assert_match "unifi-poller v#{version}", shell_output("#{bin}/unifi-poller -v 2>&1", 2)
end
end