forked from sobolevn/git-secret
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
169 lines (135 loc) · 4.07 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
SHELL:=/usr/bin/env bash
PREFIX?="/usr"
DESTDIR?=
#
# Building:
#
git-secret: src/version.sh src/_utils/*.sh src/commands/*.sh src/main.sh
cat $^ > "$@"; \
chmod +x git-secret; sync
.PHONY: all
all: build
.PHONY: clean
clean:
rm -f git-secret
.PHONY: build
build: git-secret
.PHONY: install
install:
chmod +x "./utils/install.sh"; sync; \
"./utils/install.sh" "${DESTDIR}${PREFIX}"
.PHONY: uninstall
uninstall:
chmod +x "./utils/uninstall.sh"; sync; \
"./utils/uninstall.sh" "${DESTDIR}${PREFIX}"
#
# Testing:
#
# The $(shell echo $${PWD}) construct is to access *nix paths under windows
# Under git for windows '$PATH' is set to windows paths, e.g. C:\Something
# Using a sub-shell we get the raw *nix paths, e.g. /c/Something
.PHONY: test
test: clean build
chmod +x "./utils/tests.sh"; sync; \
export SECRET_PROJECT_ROOT="$(shell echo $${PWD})"; \
export PATH="$(shell echo $${PWD})/vendor/bats-core/bin:$(shell echo $${PWD}):$(shell echo $${PATH})"; \
"./utils/tests.sh"
#
# Manuals:
#
.PHONY: install-ronn
install-ronn:
if [ ! `gem list ronn -i` == "true" ]; then gem install ronn; fi
.PHONY: clean-man
clean-man:
find "man/" -type f ! -name "*.ronn" -delete
.PHONY: build-man
build-man: install-ronn clean-man git-secret
touch man/*/*.ronn
export GITSECRET_VERSION=`./git-secret --version` && ronn --roff --organization="sobolevn" --manual="git-secret $${GITSECRET_VERSION}" man/*/*.ronn
.PHONY: build-gh-pages
build-gh-pages:
chmod +x "./utils/gh-branch.sh"; sync; \
"./utils/gh-branch.sh"
#
# Development:
#
.PHONY: install-hooks
install-hooks:
ln -fs "${PWD}/utils/hooks/pre-commit.sh" "${PWD}/.git/hooks/pre-commit"; \
chmod +x "${PWD}/.git/hooks/pre-commit"; sync; \
ln -fs "${PWD}/utils/hooks/post-commit.sh" "${PWD}/.git/hooks/post-commit"; \
chmod +x "${PWD}/.git/hooks/post-commit"; sync
.PHONY: develop
develop: clean build install-hooks
.PHONY: lint
lint:
find src utils -type f -name '*.sh' -print0 | xargs -0 -I {} shellcheck {}
find tests -type f -name '*.bats' -o -name '*.bash' -print0 | xargs -0 -I {} shellcheck {}
#
# Packaging:
#
.PHONY: install-fpm
install-fpm:
if [ ! `gem list fpm -i` == "true" ]; then gem install fpm; fi
# .apk:
.PHONY: build-apk
build-apk: clean build install-fpm
chmod +x "./utils/build-utils.sh"; sync; \
chmod +x "./utils/apk/apk-build.sh"; sync; \
export SECRET_PROJECT_ROOT="${PWD}"; \
"./utils/apk/apk-build.sh"
.PHONY: test-apk-ci
test-apk-ci: build-apk
chmod +x "./utils/apk/apk-ci.sh"; sync; \
export SECRET_PROJECT_ROOT="${PWD}"; \
export PATH="${PWD}/vendor/bats-core/bin:${PATH}"; \
"./utils/apk/apk-ci.sh"
.PHONY: deploy-apk
deploy-apk: build-apk
chmod +x "./utils/apk/apk-deploy.sh"; sync; \
export SECRET_PROJECT_ROOT="${PWD}"; \
"./utils/apk/apk-deploy.sh"
# .deb:
.PHONY: build-deb
build-deb: clean build install-fpm
chmod +x "./utils/build-utils.sh"; sync; \
chmod +x "./utils/deb/deb-build.sh"; sync; \
export SECRET_PROJECT_ROOT="${PWD}"; \
"./utils/deb/deb-build.sh"
.PHONY: test-deb-ci
test-deb-ci: build-deb
chmod +x "./utils/deb/deb-ci.sh"; sync; \
export SECRET_PROJECT_ROOT="${PWD}"; \
export PATH="${PWD}/vendor/bats-core/bin:${PATH}"; \
"./utils/deb/deb-ci.sh"
.PHONY: deploy-deb
deploy-deb: build-deb
chmod +x "./utils/deb/deb-deploy.sh"; sync; \
export SECRET_PROJECT_ROOT="${PWD}"; \
"./utils/deb/deb-deploy.sh"
# .rpm:
.PHONY: build-rpm
build-rpm: clean build install-fpm
chmod +x "./utils/build-utils.sh"; sync; \
chmod +x "./utils/rpm/rpm-build.sh"; sync; \
export SECRET_PROJECT_ROOT="${PWD}"; \
"./utils/rpm/rpm-build.sh"
.PHONY: test-rpm-ci
test-rpm-ci: build-rpm
chmod +x "./utils/rpm/rpm-ci.sh"; sync; \
export SECRET_PROJECT_ROOT="${PWD}"; \
export PATH="${PWD}/vendor/bats-core/bin:${PATH}"; \
"./utils/rpm/rpm-ci.sh"
.PHONY: deploy-rpm
deploy-rpm: build-rpm
chmod +x "./utils/rpm/rpm-deploy.sh"; sync; \
export SECRET_PROJECT_ROOT="${PWD}"; \
"./utils/rpm/rpm-deploy.sh"
# make:
.PHONY: test-make-ci
test-make-ci: clean
chmod +x "./utils/make/make-ci.sh"; sync; \
export SECRET_PROJECT_ROOT="${PWD}"; \
export PATH="${PWD}/vendor/bats-core/bin:${PATH}"; \
"./utils/make/make-ci.sh"