Merge pull request #55 from davidnewhall/dn2_more

Stuff to do.
This commit is contained in:
David Newhall II 2019-06-24 01:30:28 -07:00 committed by GitHub
commit e9ce25c272
9 changed files with 8 additions and 13 deletions

View File

@ -13,7 +13,7 @@ go:
- 1.12.x
services:
- docker
before_install:
install:
- mkdir -p $GOPATH/bin
# Download the `dep` binary to bin folder in $GOPATH
- curl -sLo $GOPATH/bin/dep https://github.com/golang/dep/releases/download/v0.5.3/dep-linux-amd64
@ -22,15 +22,11 @@ before_install:
- curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin latest
#- curl -sL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin latest
- rvm install 2.0.0
install:
- rvm 2.0.0 do gem install --no-document fpm
- make docker
script:
# Test built docker image.
- docker run -d --name unifi-poller golift/unifi-poller | tee docker_id
# Once we figure out how to keep it running we can remove the -a in ps args.
- docker ps -a | grep -q unifi-poller
- docker logs $(<docker_id) 2>&1 | grep -Eq "Loading Configuration File[:] /etc/unifi-poller/up.conf"
- docker run golift/unifi-poller 2>&1 | grep -Eq "Loading Configuration File[:] /etc/unifi-poller/up.conf"
# test and build everything
- rvm 2.0.0 do make release
after_success:

View File

@ -6,7 +6,6 @@ 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.
GOLANGCI_LINT_ARGS=--enable-all -D gochecknoglobals
PACKAGE:=./cmd/$(BINARY)
DOCKER_REPO=golift
MD2ROFF_BIN=github.com/github/hub/md2roff-bin
@ -62,23 +61,23 @@ README.html: md2roff
build: $(BINARY)
$(BINARY):
go build -o $(BINARY) -ldflags "-w -s -X github.com/davidnewhall/unifi-poller/pkg/unifi-poller.Version=$(VERSION)" $(PACKAGE)
go build -o $(BINARY) -ldflags "-w -s -X github.com/davidnewhall/unifi-poller/unifipoller.Version=$(VERSION)"
linux: $(BINARY).linux
$(BINARY).linux:
# Building linux binary.
GOOS=linux go build -o $(BINARY).linux -ldflags "-w -s -X github.com/davidnewhall/unifi-poller/pkg/unifi-poller.Version=$(VERSION)" $(PACKAGE)
GOOS=linux go build -o $(BINARY).linux -ldflags "-w -s -X github.com/davidnewhall/unifi-poller/unifipoller.Version=$(VERSION)"
macos: $(BINARY).macos
$(BINARY).macos:
# Building darwin binary.
GOOS=darwin go build -o $(BINARY).macos -ldflags "-w -s -X github.com/davidnewhall/unifi-poller/pkg/unifi-poller.Version=$(VERSION)" $(PACKAGE)
GOOS=darwin go build -o $(BINARY).macos -ldflags "-w -s -X github.com/davidnewhall/unifi-poller/unifipoller.Version=$(VERSION)"
exe: $(BINARY).exe
windows: $(BINARY).exe
$(BINARY).exe:
# Building windows binary.
GOOS=windows go build -o $(BINARY).exe -ldflags "-w -s -X github.com/davidnewhall/unifi-poller/pkg/unifi-poller.Version=$(VERSION)" $(PACKAGE)
GOOS=windows go build -o $(BINARY).exe -ldflags "-w -s -X github.com/davidnewhall/unifi-poller/unifipoller.Version=$(VERSION)"
# Packages

View File

@ -85,7 +85,7 @@ means, if you wanted to do something like make telegraf collect your data instea
of UniFi Poller you can achieve that with a little bit of Go code. You could write
a small app that acts as a telegraf input plugin using the [unifi](https://github.com/golift/unifi)
library to grab the data from your controller. As a bonus, all of the code in UniFi Poller is
[also a library](https://godoc.org/github.com/davidnewhall/unifi-poller/pkg/unifi-poller)
[also a library](https://godoc.org/github.com/davidnewhall/unifi-poller/unifipoller)
and can be used in other projects.
# What now...

View File

@ -3,7 +3,7 @@ package main
import (
"log"
unifipoller "github.com/davidnewhall/unifi-poller/pkg/unifi-poller"
"github.com/davidnewhall/unifi-poller/unifipoller"
)
// Keep it simple.