Skip to content

Commit

Permalink
[ver] Release 0.2.1
Browse files Browse the repository at this point in the history
- update dependency
- update Makefile to generate binary for all three platforms
- ayi web static list on localhost:3000 instead of :3000
  • Loading branch information
at15 committed Aug 31, 2018
1 parent 7a09ded commit 2970cf9
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 5 deletions.
69 changes: 65 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,38 @@
VERSION = 0.2.0
define AYI_HELP_MSG
Make commands for ayi

help show help

Dev:
install install ./cmd/ayi to $$GOPATH/bin/ayi
fmt gofmt
test unit test
generate generate code using gommon

Dev first time:
dep-install install dependencies based on lock file
dep-update update dependency based on Gopkg.toml and code

Build:
build build binary of all platforms and package to zip
endef
export AYI_HELP_MSG

.PHONY: help
help:
@echo "$$AYI_HELP_MSG"

VERSION = 0.2.1
BUILD_COMMIT = $(shell git rev-parse HEAD)
BUILD_TIME = $(shell date +%Y-%m-%dT%H:%M:%S%z)
CURRENT_USER = $(USER)
FLAGS = -X main.version=$(VERSION) -X main.commit=$(BUILD_COMMIT) -X main.buildTime=$(BUILD_TIME) -X main.buildUser=$(CURRENT_USER)

GO = CGO_ENABLED=0 go
GO_LINUX_BUILD = GOOS=linux GOARCH=amd64
GO_MAC_BUILD = GOOS=darwin GOARCH=amd64
GO_WINDOWS_BUILD = GOOS=windows GOARCH=amd64

.PHONY: fmt
fmt:
gofmt -d -l -w ./cmd ./app ./config ./util
Expand All @@ -16,17 +45,49 @@ test:
install:
go install -ldflags "$(FLAGS)" ./cmd/ayi

.PHONY: update-dep
update-dep:
dep ensure -update
.PHONY: dep-install
dep-install:
dep ensure -v

.PHONY: dep-update
dep-update:
dep ensure -update -v

.PHONY: generate
generate:
gommon generate -v

.PHONY: build build-linux build-mac build-windows
build: build-linux build-mac build-windows

build-linux:
rm -f ayi-v$(VERSION)-linux-amd64
$(GO_LINUX_BUILD) go build -ldflags "$(FLAGS)" -o ayi-v$(VERSION)-linux-amd64 ./cmd/ayi
zip ayi-v$(VERSION)-linux-amd64.zip ayi-v$(VERSION)-linux-amd64
# rm ayi-v$(VERSION)-linux-amd64

build-mac:
rm -f ayi-v$(VERSION)-darwin-amd64
$(GO_MAC_BUILD) go build -ldflags "$(FLAGS)" -o ayi-v$(VERSION)-darwin-amd64 ./cmd/ayi
zip ayi-v$(VERSION)-darwin-amd64.zip ayi-v$(VERSION)-darwin-amd64
# rm ayi-v$(VERSION)-darwin-amd64

build-windows:
rm -f ayi-v$(VERSION)-windows-amd64
$(GO_WINDOWS_BUILD) go build -ldflags "$(FLAGS)" -o ayi-v$(VERSION)-windows-amd64 ./cmd/ayi
zip ayi-v$(VERSION)-windows-amd64.zip ayi-v$(VERSION)-windows-amd64
# rm ayi-v$(VERSION)-windows-amd64

.PHONY: package
package:
rm -f ayi-v$(VERSION)-linux-amd64.zip
go build -ldflags "$(FLAGS)" -o ayi-v$(VERSION)-linux-amd64 ./cmd/ayi
zip ayi-v$(VERSION)-linux-amd64.zip ayi-v$(VERSION)-linux-amd64
rm ayi-v$(VERSION)-linux-amd64

.PHONY: loc

# https://github.com/Aaronepower/tokei respect ignore file
# exclude playground
loc:
tokei .
2 changes: 1 addition & 1 deletion app/web/static.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func (a *App) staticCommand() *cobra.Command {
Run: func(cmd *cobra.Command, args []string) {
// TODO: go.ice should have a static http server to be used out of box
cfg := iconfig.HttpServerConfig{
Addr: fmt.Sprintf(":%d", a.port),
Addr: fmt.Sprintf("localhost:%d", a.port),
EnableTracing: false,
}
h := http.FileServer(http.Dir("."))
Expand Down

0 comments on commit 2970cf9

Please sign in to comment.