From 0720ec54f4a3815f41ff5bc815a74ceb5743054e Mon Sep 17 00:00:00 2001 From: David Newhall II Date: Wed, 12 Jun 2019 14:34:23 -0700 Subject: [PATCH] Forgot the template --- integrations/inputunifi/templates/README.md | 2 ++ .../inputunifi/templates/unifi-poller.rb.tmpl | 32 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 integrations/inputunifi/templates/README.md create mode 100644 integrations/inputunifi/templates/unifi-poller.rb.tmpl diff --git a/integrations/inputunifi/templates/README.md b/integrations/inputunifi/templates/README.md new file mode 100644 index 00000000..6d321dea --- /dev/null +++ b/integrations/inputunifi/templates/README.md @@ -0,0 +1,2 @@ +This folder contains build templates. +Used to create packages and homebrew formula. diff --git a/integrations/inputunifi/templates/unifi-poller.rb.tmpl b/integrations/inputunifi/templates/unifi-poller.rb.tmpl new file mode 100644 index 00000000..fe89c21f --- /dev/null +++ b/integrations/inputunifi/templates/unifi-poller.rb.tmpl @@ -0,0 +1,32 @@ +# Homebrew Formula, still under development - June 2019 +require "language/go" + +# Classname should match the name of the installed package. +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