Skip to content

Commit

Permalink
Fixed tests, added Makefile instead of Python script
Browse files Browse the repository at this point in the history
  • Loading branch information
schollz committed Aug 9, 2016
1 parent 619eb6f commit a3d23a9
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 66 deletions.
55 changes: 55 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
SOURCEDIR=.
SOURCES := $(shell find $(SOURCEDIR) -name '*.go')

BINARY=findclient

VERSION=0.5
BUILD_TIME=`date +%FT%T%z`
BUILD=`git rev-parse HEAD`

LDFLAGS=-ldflags "-X main.VersionNum=${VERSION} -X main.Build=${BUILD} -X main.BuildTime=${BUILD_TIME}"

.DEFAULT_GOAL: $(BINARY)

$(BINARY): $(SOURCES)
go get github.com/stretchr/testify/assert
go get github.com/codegangsta/cli
go get github.com/op/go-logging
go build ${LDFLAGS} -o ${BINARY} ${SOURCES}

.PHONY: install
install:
go install ${LDFLAGS} ./...

.PHONY: clean
clean:
if [ -f ${BINARY} ] ; then rm ${BINARY} ; fi
rm -rf builds
rm -rf find
rm -rf findclient*

.PHONY: binaries
binaries:
go test
rm -rf builds
mkdir builds
# Build Windows
env GOOS=windows GOARCH=amd64 go build ${LDFLAGS} -o findclient.exe -v *.go
zip -r findclient_${VERSION}_windows_amd64.zip findclient.exe LICENSE
mv findclient_${VERSION}_windows_amd64.zip builds/
rm findclient.exe
# Build Linux
env GOOS=linux GOARCH=amd64 go build ${LDFLAGS} -o findclient -v *.go
zip -r findclient_${VERSION}_linux_amd64.zip findclient LICENSE
mv findclient_${VERSION}_linux_amd64.zip builds/
rm findclient
# Build OS X
env GOOS=darwin GOARCH=amd64 go build ${LDFLAGS} -o findclient -v *.go
zip -r findclient_${VERSION}_osx.zip findclient LICENSE
mv findclient_${VERSION}_osx.zip builds/
rm findclient
# Build Raspberry Pi / Chromebook
env GOOS=linux GOARCH=arm go build ${LDFLAGS} -o findclient -v *.go
zip -r findclient_${VERSION}_linux_arm.zip findclient LICENSE
mv findclient_${VERSION}_linux_arm.zip builds/
rm findclient
12 changes: 10 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,25 @@ func setupLogging() {
}
}

var VersionNum string
var Build string
var BuildTime string

func main() {
var f Fingerprint
var times int
var address string
var wlan_interface string
var osConfig OSConfig

if len(Build) == 0 {
Build = "devdevdevdevdevdev"
}

app := cli.NewApp()
app.Name = "fingerprint"
app.Name = "findclient"
app.Usage = "client for sending WiFi fingerprints to a FIND server"
app.Version = "0.2"
app.Version = VersionNum + " " + Build[0:7]
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "server,s",
Expand Down
2 changes: 1 addition & 1 deletion main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func ExampleSendFingerprintServerOnlineTrack() {
fmt.Println(err)
}
fmt.Println(response)
// Output: Calculated location: zakhome floor 2 office
// Output: Current location: zakhome floor 2 office
}

func ExampleSendFingerprintServerOffline() {
Expand Down
63 changes: 0 additions & 63 deletions makeBinaries.py

This file was deleted.

0 comments on commit a3d23a9

Please sign in to comment.