diff --git a/Makefile b/Makefile index c481c89a..a1e1f7f3 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ BINARY:=unifi-poller URL:=https://github.com/davidnewhall/$(BINARY) MAINT=David Newhall II -DESC=This daemon polls a UniFi controller at a short interval and stores the collected measurements in an Influx Database. +DESC=Polls a UniFi controller and stores metrics in InfluxDB GOLANGCI_LINT_ARGS=--enable-all -D gochecknoglobals DOCKER_REPO=golift MD2ROFF_BIN=github.com/github/hub/md2roff-bin diff --git a/init/homebrew/unifi-poller.rb.tmpl b/init/homebrew/unifi-poller.rb.tmpl index cf6704ec..654500e6 100644 --- a/init/homebrew/unifi-poller.rb.tmpl +++ b/init/homebrew/unifi-poller.rb.tmpl @@ -1,13 +1,10 @@ # Homebrew Formula Template. Built by Makefile: `make fomula` -require "language/go" - class UnifiPoller < Formula - version "{{Version}}" - sha256 "{{SHA256}}" - url "{{URL}}/archive/v#{version}.tar.gz" - head "{{URL}}" desc "{{Desc}}" homepage "{{URL}}" + url "{{URL}}/archive/v{{Version}}.tar.gz" + sha256 "{{SHA256}}" + head "{{URL}}" depends_on "go" => :build depends_on "dep" @@ -20,16 +17,17 @@ class UnifiPoller < Formula # to $GOPATH/src/github.com/davidnewhall/unifi-poller bin_path.install Dir["*"] cd bin_path do - system "dep", "ensure" + system "dep", "ensure", "-vendor-only" system "make", "install", "VERSION=#{version}", "PREFIX=#{prefix}", "ETC=#{etc}" # If this fails, the user gets a nice big warning about write permissions on their # #{var}/log folder. The alternative could be letting the app silently fail # to start when it cannot write logs. This is better. Fix perms; reinstall. - system "touch", "#{var}/log/unifi-poller.log" + touch("#{var}/log/unifi-poller.log") end end + def caveats - s = <<-EOS + <<-EOS This application will not work until the config file has authentication information for a UniFi Controller and an Influx Database. Edit the config file at #{etc}/unifi-poller/up.conf then start the application with @@ -38,30 +36,33 @@ class UnifiPoller < Formula EOS end - def plist; <<-EOS - - - - - Label - #{plist_name} - ProgramArguments - - #{bin}/unifi-poller - -c - #{etc}/unifi-poller/up.conf - - RunAtLoad - - KeepAlive - - StandardErrorPath - #{var}/log/unifi-poller.log - StandardOutPath - #{var}/log/unifi-poller.log - - - EOS + plist_options :startup => true + + def plist + <<-EOS + + + + + Label + #{plist_name} + ProgramArguments + + #{bin}/unifi-poller + -c + #{etc}/unifi-poller/up.conf + + RunAtLoad + + KeepAlive + + StandardErrorPath + #{var}/log/unifi-poller.log + StandardOutPath + #{var}/log/unifi-poller.log + + + EOS end test do