forked from hekmekk/git-team
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
88 lines (72 loc) · 2.54 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
VERSION:=1.0.1
UNAME_S:= $(shell uname -s)
BASH_COMPLETION_PREFIX:=
ifeq ($(UNAME_S),Darwin)
BASH_COMPLETION_PREFIX:=/usr/local
endif
all: test fmt build man-page
deps:
go get
test: deps
go test ./core/...
fmt:
go fmt
build: deps
go build -o pkg/target/bin/git-team
man-page:
mkdir -p pkg/target/man/
go run git-team.go --help-man > pkg/target/man/git-team.1
gzip -f pkg/target/man/git-team.1
install:
install pkg/target/bin/git-team /usr/local/bin/git-team
mkdir -p /usr/local/share/man/man1
install -m "0644" pkg/target/man/git-team.1.gz /usr/local/share/man/man1/git-team.1.gz
install -m "0644" bash_completion/git-team.bash $(BASH_COMPLETION_PREFIX)/etc/bash_completion.d/git-team
@echo "[INFO] Don't forget to source $(BASH_COMPLETION_PREFIX)/etc/bash_completion"
uninstall:
rm -f /usr/bin/git-team
rm -f /etc/bash_completion.d/git-team
rm -f /usr/share/man/man1/git-team.1.gz
package-build:
mkdir -p pkg/src/
cp Makefile pkg/src/
cp git-team.go pkg/src/
cp go.mod pkg/src/
cp -r core pkg/src/
cp -r bash_completion pkg/src/
docker build --build-arg UID=$(shell id -u) --build-arg GID=$(shell id -g) --build-arg USERNAME=$(USER) -t git-team-pkg:v$(VERSION) pkg/
package: package-build
mkdir -p pkg/target/deb
chown -R $(shell id -u):$(shell id -g) pkg/target/deb
docker run --rm -h git-team-pkg -v $(shell pwd)/pkg/target/deb:/deb-target git-team-pkg:v$(VERSION) fpm \
-f \
-s dir \
-t deb \
-n "git-team" \
-v $(VERSION) \
-m "Rea Sand <[email protected]>" \
--url "https://github.com/hekmekk/git-team" \
--license "MIT" \
--description "git-team - commit template provisioning with co-authors" \
--deb-no-default-config-files \
-p /deb-target \
pkg/target/bin/git-team=/usr/bin/git-team \
bash_completion/git-team.bash=/etc/bash_completion.d/git-team \
pkg/target/man/git-team.1.gz=/usr/share/man/man1/git-team.1.gz
release:
@echo "nope... :D"
clean:
rm -f git-team
rm -rf pkg/src/
rm -rf pkg/target/
purge: clean uninstall
git config --global --remove-section team.alias || true
git config --global --remove-section commit || true
git config --remove-section team.alias || true
git config --remove-section commit || true
docker-build:
docker build --build-arg UID=$(shell id -u) --build-arg GID=$(shell id -g) --build-arg USERNAME=$(USER) -t git-team-run:v$(VERSION) .
docker-run: docker-build
mkdir -p /home/$(USER)/.config/git-team
chown -R $(shell id -u):$(shell id -g) /home/$(USER)/.config/git-team
docker run --rm -h git-team-run -v /home/$(USER)/:/home/$(USER)/ git-team-run:v$(VERSION) git team --help