-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.include.mk
246 lines (224 loc) · 11.1 KB
/
Makefile.include.mk
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
OS := ${shell uname}
.PHONY: test deploy
BELONG = "coderplanets"
REPO = "coderplanets_server"
DASHBOARD_PM2_LINK = "https://app.pm2.io"
DASHBOARD_ALIYUN_LINK = "https://home.console.aliyun.com/new"
DASHBOARD_SENTRY_LINK = "https://sentry.io/groupher-stack/cps_server_prod"
CI_BUILD_LINK = "https://travis-ci.org/$(BELONG)/$(REPO)"
CI_COVERAGE_LINK = "https://coveralls.io/github/$(BELONG)/$(REPO)"
CI_CODECOV_LINK = "https://codecov.io/gh/$(BELONG)/$(REPO)"
CI_CODEBEAT_LINK = "https://codebeat.co/projects/github-com-coderplanets-coderplanets_server-dev"
CI_DOC_LINK = "https://inch-ci.org/github/$(BELONG)/$(REPO)"
CI_DEPSBOT_LINK = "https://github.com/dependabot/feedback/issues/6"
GITHUB_CODE_LINK = "https://github.com/$(BELONG)/$(REPO)"
GITHUB_DOC_LINK = "https://github.com/$(BELONG)/$(REPO)/tree/dev/docs"
GITHUB_PR_LINK = "https://github.com/$(BELONG)/$(REPO)/pulls"
GITHUB_ISSUE_LINK = "https://github.com/$(BELONG)/$(REPO)/issues"
GITHUB_APP_LINK = "https://github.com/settings/applications/689577"
ifeq ($(OS),Darwin) # Mac OS X
BROWSER_TOOL = open
endif
ifeq ($(OS),Linux)
BROWSER_TOOL = google-chrome
endif
ifeq ($(OS),Windows)
BROWSER_TOOL = explorer
endif
define browse
$(BROWSER_TOOL) "$(1)"
endef
define setup.help
@echo "\n"
@echo " [valid setup commands]"
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
@echo " setup.run : setup the basic env for you, include 3-step"
@echo " | 1. mix ecto.setup # create/migrate tables in db"
@echo " | 2. mix deps.get # for insall deps"
@echo " | 3. npm install # for commit-msg linter"
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
endef
define launch.help
@echo "\n"
@echo " [valid launch commands]"
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
@echo " launch.mock : start server in mock(default) mode"
@echo " | config locate in \"config/mock.exs\""
@echo " ....................................................."
@echo " launch.dev : start phoenix server in development env"
@echo " | config locate in \"config/dev.exs\""
@echo " ....................................................."
@echo " launch.prod : start phoenix server in produnction env"
@echo " | config locate in \"config/prod.exs\""
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
endef
define deploy.help
@echo "\n"
@echo " [valid deploy commands]"
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
@echo " deploy.dev : pack & push code to aliyun for dev"
@echo " | need manually restart docker container on aliyun"
@echo " ..............................................................."
@echo " deploy.prod : pack & push code to for produnction"
@echo " | need manually restart docker container on aliyun"
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
endef
define gen.help
@echo "\n"
@echo " [valid generators]"
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
@echo " gen.migration : generate migration fils"
@echo " | e.p : gen.migration arg=\"add_name_to_users\""
@echo " | note : need to run \"make migrate\" later"
@echo " .................................................................................."
@echo " gen.context : generate a new context"
@echo " | e.p: make gen.context Accounts Credential credentials"
@echo " email:string:unique user_id:references:users"
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
endef
define commit.help
@echo "\n"
@echo " [valid commit commands]"
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
@echo " commit : commit changes follow convention"
@echo " | convention: AngularJS's commit message convention"
@echo " | link: https://github.com/commitizen/cz-cli"
@echo " | link: https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines"
@echo " | require: npm install"
@echo " | require: npm -v > 5.2 to use npx"
@echo " | link: https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b"
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
endef
define release.help
@echo "\n"
@echo " [valid release commands]"
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
@echo " release : release version by automatic CHANGELOG generation"
@echo " | link: https://github.com/conventional-changelog/standard-version"
@echo " | more:"
@echo " | npm run release -- --prerelease"
@echo " | npm run release -- --prerelease alpha"
@echo " ................................................................................."
@echo " release.master : release master branch"
@echo " ................................................................................."
@echo " release.dev : release dev branch"
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
endef
define console.help
@echo "\n"
@echo " [valid console commands]"
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
@echo " console : run iex"
@echo " ..................................."
@echo " console.dev : run iex in dev env"
@echo " ..................................."
@echo " console.mock : run iex in mock env"
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
endef
define reset.help
@echo "\n"
@echo " [WARNING: reset db commands]"
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
@echo " reset.test : reset test db"
@echo " ..................................."
@echo " reset.mock : reset mock db"
@echo " ..................................."
@echo " reset.prod : reset prod db"
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
endef
define seeds.help
@echo "\n"
@echo " [seeds db commands]"
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
@echo " seeds.mock : insert default communities etc .. to mock db"
@echo " .........................................................."
@echo " seeds.prod : insert default communities etc .. to prod db"
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
endef
define test.help
@echo "\n"
@echo " [valid test commands]"
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
@echo " test : run all the test then quit"
@echo " ....................................................."
@echo " test.watch : run all the test in watch mode"
@echo " ....................................................."
@echo " test.watch.wip : run @wip test in watch mode"
@echo " ....................................................."
@echo " test.watch.wip2 : shortcut for lots of @wip around"
@echo " ....................................................."
@echo " test.watch.bug : sometimes fails for unkown reason"
@echo " ....................................................."
@echo " test.report : show test coverage status web page"
@echo " ....................................................."
@echo " test.report.text : show test coverage in terminal"
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
endef
define lint.help
@echo "\n"
@echo " [valid test commands]"
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
@echo " lint : analysis by credo in strict mode"
@echo " | doc: https://github.com/rrrene/credo/"
@echo " ......................................................."
@echo " lint.static : analysis by dialyzer"
@echo " | doc: https://github.com/jeremyjh/dialyxir"
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
endef
define dashboard.help
@echo "\n"
@echo " [valid dashboard commands]"
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
@echo " dashboard.pm2 : pm2 running status"
@echo " | $(DASHBOARD_PM2_LINK)"
@echo " ................................................................................."
@echo " dashboard.sentry : sentry error track"
@echo " | $(DASHBOARD_SENTRY_LINK)"
@echo " ................................................................................."
@echo " dashboard.aliyun : aliyun console"
@echo " | $(DASHBOARD_ALIYUN_LINK)"
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
endef
define ci.help
@echo "\n"
@echo " [valid ci commands]"
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
@echo " ci.build : browse travis status"
@echo " | $(CI_BUILD_LINK)"
@echo " .........................................................................."
@echo " ci.coverage : browse test coveralls status"
@echo " | $(CI_COVERAGE_LINK)"
@echo " .........................................................................."
@echo " ci.codecov : browse test codecov status"
@echo " | $(CI_CODECOV_LINK)"
@echo " .........................................................................."
@echo " ci.doc : browse doc coverage status"
@echo " | $(CI_DOC_LINK)"
@echo " .........................................................................."
@echo " ci.depsbot : check outdated deps"
@echo " | wip: $(CI_DEPSBOT_LINK) "
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
endef
define github.help
@echo "\n"
@echo " [valid github commands]"
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
@echo " github.code : browse source code in github"
@echo " | $(GITHUB_CODE_LINK)"
@echo " ...................................................................................."
@echo " github.doc : browse repo docs in github"
@echo " | $(GITHUB_DOC_LINK)"
@echo " ...................................................................................."
@echo " github.pr : browse PRs in github"
@echo " | $(GITHUB_PR_LINK)"
@echo " ...................................................................................."
@echo " github.issue : browse issues in github"
@echo " | $(GITHUB_ISSUE_LINK)"
@echo " ...................................................................................."
@echo " github.issue.new : create issue in github"
@echo " | $(GITHUB_ISSUE_LINK)/new"
@echo " ...................................................................................."
@echo " github.app : github oauth status (need login)"
@echo " | $(GITHUB_APP_LINK)"
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
endef