Make brew pass all audit tests.

This commit is contained in:
David Newhall II 2019-06-25 00:40:06 -07:00
parent c35266af2f
commit 077cab1cd2
2 changed files with 35 additions and 34 deletions

View File

@ -4,7 +4,7 @@
BINARY:=unifi-poller
URL:=https://github.com/davidnewhall/$(BINARY)
MAINT=David Newhall II <david at sleepers dot pro>
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

View File

@ -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,7 +36,10 @@ class UnifiPoller < Formula
EOS
end
def plist; <<-EOS
plist_options :startup => true
def plist
<<-EOS
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">