-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
133 lines (104 loc) · 3.37 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
CURRENTDIR=`pwd`
modVer=$(shell cat go.mod | head -n 3 | tail -n 1 | awk '{print $2}' | cut -d'.' -f2)
currentVer=$(shell go version | awk '{print $3}' | sed -e "s/go//" | cut -d'.' -f2)
gitTag=$(shell git tag | head -n 1)
###############################################################################
# Managing Dependencies
###############################################################################
.PHONY: check-ver
check-ver:
#echo $(modVer)
#echo $(currentVer)
@if [ ${currentVer} -lt ${modVer} ]; then\
echo go version ${modVer}++ is required but your go version is ${currentVer};\
fi
.PHONY: update
update:
GO111MODULE=off go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
go get -u -d -v ./...
###############################################################################
# Golang formatter and detection
###############################################################################
.PHONY: imports
imports:
./scripts/sh/imports.sh
.PHONY: lint
lint:
golangci-lint run
.PHONY: lintfix
lintfix:
golangci-lint run --fix
.PHONY: lintall
lintall: imports lint
###############################################################################
# Build
###############################################################################
.PHONY: build
build:
go build -v -o ${GOPATH}/bin/gh ./cmd/gh/
.PHONY: build-version
build-version:
go build -ldflags "-X main.version=${gitTag}" -v -o ${GOPATH}/bin/gh ./cmd/gh/
.PHONY: run
run:
go run -v ./cmd/gh/ speak -msg "My name is Hiroki. Nice to meet you. How's it going? Thank you."
###############################################################################
# Execute
###############################################################################
# saying something in English
.PHONY: say-en
say-en:
gh speak -msg "Thank you."
# saying something in Japanese.
.PHONY: say-ja
say-ja:
gh -lang ja speak -msg "ありがとうございます"
# saying something in Dutch.
.PHONY: say-nl
say-nl:
gh -lang nl speak -msg "Dank je"
# saying something in German.
.PHONY: say-de
say-de:
gh -lang de speak -msg "Danke."
# saying something in French.
.PHONY: say-fr
say-fr:
gh -lang fr speak -msg "Merci."
# playing music
.PHONY: play-music
play-music:
gh play -url "https://github.com/hiromaily/go-google-home/raw/master/assets/music/bensound-dubstep.mp3"
# using specific IP address of Google Home.
.PHONY: say-with-address
say-with-address:
gh -addr "xxx.xxx.xxx.xxx:8009" -msg "It reaches to specific IP address."
###############################################################################
# server mode
###############################################################################
# Sample for server mode.
#.PHONY: server
#server:
# gh server
# Sample to post message to server by HTTPie
#.PHONY: post-msg
#post-msg:
# http POST http://localhost:8080/speak text="It's sunny day today."
###############################################################################
# Release
# https://github.com/goreleaser/goreleaser
###############################################################################
.PHONY: release
release:
#goreleaser release
goreleaser release --rm-dist
rm -rf gh.json
.PHONY: brew-install
brew-install:
brew install hiromaily/tap/go-google-home
brew-uninstall:
brew uninstall hiromaily/tap/go-google-home
brew-update:
brew update
.PHONY: brew-reinstall
brew-reinstall: brew-uninstall brew-update brew-install