-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: sabith <[email protected]>
- Loading branch information
Showing
5 changed files
with
217 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
vendor/ | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
language: go | ||
|
||
go: | ||
- master | ||
|
||
script: make | ||
|
||
deploy: | ||
provider: releases | ||
api_key: $GITHUB_TOKEN | ||
file_glob: true | ||
file: "build/*" | ||
skip_cleanup: true | ||
on: | ||
tags: true |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Gopkg.toml example | ||
# | ||
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md | ||
# for detailed Gopkg.toml documentation. | ||
# | ||
# required = ["github.com/user/thing/cmd/thing"] | ||
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] | ||
# | ||
# [[constraint]] | ||
# name = "github.com/user/project" | ||
# version = "1.0.0" | ||
# | ||
# [[constraint]] | ||
# name = "github.com/user/project2" | ||
# branch = "dev" | ||
# source = "github.com/myfork/project2" | ||
# | ||
# [[override]] | ||
# name = "github.com/x/y" | ||
# version = "2.4.0" | ||
# | ||
# [prune] | ||
# non-go = false | ||
# go-tests = true | ||
# unused-packages = true | ||
|
||
|
||
[[constraint]] | ||
name = "github.com/Sirupsen/logrus" | ||
version = "1.0.5" | ||
|
||
[[constraint]] | ||
name = "github.com/bitly/go-simplejson" | ||
version = "0.5.0" | ||
|
||
[[constraint]] | ||
name = "github.com/eclipse/paho.mqtt.golang" | ||
version = "1.1.1" | ||
|
||
[[constraint]] | ||
name = "github.com/mattn/go-colorable" | ||
version = "0.0.9" | ||
|
||
[[constraint]] | ||
name = "github.com/urfave/cli" | ||
version = "1.20.0" | ||
|
||
[prune] | ||
go-tests = true | ||
unused-packages = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
GREEN := $(shell tput -Txterm setaf 2) | ||
YELLOW := $(shell tput -Txterm setaf 3) | ||
WHITE := $(shell tput -Txterm setaf 7) | ||
RESET := $(shell tput -Txterm sgr0) | ||
|
||
|
||
.PHONY: all | ||
|
||
GO_PROJECT = github.com/shirou/mqttcli | ||
BUILD_DEST = build | ||
COMMIT_HASH=`git rev-parse --short HEAD` | ||
GIT_COMMIT = $(shell git rev-parse HEAD) | ||
GIT_SHA = $(shell git rev-parse --short HEAD) | ||
GIT_DIRTY = $(shell test -n "`git status --porcelain`" && echo "dirty" || echo "clean") | ||
|
||
LDFLAGS += -w -s -extldflags -static | ||
|
||
ifndef VERSION | ||
VERSION = DEV | ||
endif | ||
|
||
GOFLAGS := -ldflags "$(LDFLAGS)" | ||
|
||
## Download dependencies and the run unit test and build the binary | ||
all: install clean build | ||
|
||
## Clean the dist directory | ||
clean: | ||
@rm -rf $(BUILD_DEST) | ||
|
||
## download dependencies to run this project | ||
install: | ||
@which gox > /dev/null || go get github.com/mitchellh/gox | ||
@which dep > /dev/null || go get github.com/golang/dep/cmd/dep | ||
dep ensure -vendor-only | ||
|
||
## Run for local development | ||
start: | ||
DATA_DIRECTORY="$$PWD/data" \ | ||
go run *.go | ||
|
||
## Build the linux binary | ||
build: | ||
@rm -rf $(BUILD_DEST) | ||
@mkdir -p $(BUILD_DEST) > /dev/null | ||
@CGO_ENABLED=0 \ | ||
gox \ | ||
-output "$(BUILD_DEST)/{{.Dir}}_{{.OS}}_{{.Arch}}" \ | ||
$(GOFLAGS) \ | ||
. | ||
|
||
## Prints the version info about the project | ||
info: | ||
@echo "Version: ${VERSION}" | ||
@echo "Git Commit: ${GIT_COMMIT}" | ||
@echo "Git Tree State: ${GIT_DIRTY}" | ||
|
||
## Print the dependency graph and open in MAC | ||
dependencygraph: | ||
dep status -dot | dot -T png | open -f -a /Applications/Preview.app | ||
|
||
## Prints this help command | ||
help: | ||
@echo '' | ||
@echo 'Usage:' | ||
@echo ' ${YELLOW}make${RESET} ${GREEN}<target>${RESET}' | ||
@echo '' | ||
@echo 'Targets:' | ||
@awk '/^[a-zA-Z\-\_0-9]+:/ { \ | ||
helpMessage = match(lastLine, /^## (.*)/); \ | ||
if (helpMessage) { \ | ||
helpCommand = substr($$1, 0, index($$1, ":")-1); \ | ||
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \ | ||
printf " ${YELLOW}%-$(TARGET_MAX_CHAR_NUM)s${RESET}: ${GREEN}%s${RESET}\n", helpCommand, helpMessage; \ | ||
} \ | ||
} \ | ||
{ lastLine = $$0 }' $(MAKEFILE_LIST) |