From 094705d76c24dc4a2789b5f4f47697d168ba55df Mon Sep 17 00:00:00 2001 From: David Newhall II Date: Thu, 13 Jun 2019 02:25:41 -0700 Subject: [PATCH] Fix homebrew formula template --- templates/unifi-poller.rb.tmpl | 66 ++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 31 deletions(-) diff --git a/templates/unifi-poller.rb.tmpl b/templates/unifi-poller.rb.tmpl index 3a73cb8a..e438fa05 100644 --- a/templates/unifi-poller.rb.tmpl +++ b/templates/unifi-poller.rb.tmpl @@ -22,40 +22,44 @@ class UnifiPoller < Formula cd bin_path do system "dep", "ensure" system "make", "install", "VERSION=#{version}", "PREFIX=#{prefix}", "ETC=#{etc}" + system "mkdir", "-p", "#{var}/log/unifi-poller" end end + def caveats + s = <<-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 + brew services start unifi-poller ~ log file: #{var}/log/unifi-poller/log + The manual explains the config file options: man unifi-poller + EOS + end - 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 - UserName - nobody - GroupName - nobody - - - 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 + end test do assert_match "unifi-poller v#{version}", shell_output("#{bin}/unifi-poller -v 2>&1", 2)