Skip to content

Commit 97ffb65

Browse files
hermancaldaraggarnier
authored andcommitted
Improve Makefile to show tasks when type "make"
1 parent 238df2c commit 97ffb65

File tree

1 file changed

+46
-4
lines changed

1 file changed

+46
-4
lines changed

Makefile

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,53 @@
1+
.SILENT:
2+
.DEFAULT_GOAL=help
3+
4+
COLOR_RESET = \033[0m
5+
COLOR_GREEN = \033[32m
6+
COLOR_YELLOW = \033[33m
7+
8+
PROJECT_NAME = `basename $(PWD)`
9+
110
GITLAB_CI_MONITOR_URL = https://github.com/globocom/gitlab-ci-monitor/archive/master.tar.gz
211

3-
.PHONY: install
12+
## prints this help
13+
help:
14+
printf "${COLOR_YELLOW}\n${PROJECT_NAME}\n\n${COLOR_RESET}"
15+
awk '/^[a-zA-Z\-\_0-9\.%]+:/ { \
16+
helpMessage = match(lastLine, /^## (.*)/); \
17+
if (helpMessage) { \
18+
helpCommand = substr($$1, 0, index($$1, ":")); \
19+
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
20+
printf "${COLOR_GREEN}$$ make %s${COLOR_RESET} %s\n", helpCommand, helpMessage; \
21+
} \
22+
} \
23+
{ lastLine = $$0 }' $(MAKEFILE_LIST)
24+
printf "\n"
25+
426
install:
527
rm -rf /usr/local/share/gitlab/monitor \
628
&& mkdir -p /usr/local/share/gitlab/monitor \
729
&& curl -s -L $(GITLAB_CI_MONITOR_URL) | tar xz -C /usr/local/share/gitlab/monitor --strip-components=1
830

9-
.PHONY: deploy
10-
deploy:
11-
npm run build && cd dist && tsuru app deploy -a gitlab-ci-monitor .
31+
## install project dependencies
32+
setup:
33+
npm install
34+
35+
## runs local server for development
36+
start:
37+
npm run start
38+
39+
## lints the js code
40+
lint:
41+
npm run lint
42+
43+
## runs the tests
44+
test: lint
45+
npm run test
46+
47+
## builds files for production environment
48+
build:
49+
npm run build
50+
51+
## deploys the application
52+
deploy: build
53+
cd dist && tsuru app deploy -a gitlab-ci-monitor .

0 commit comments

Comments
 (0)