forked from ovh-ux/ovh-manager-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
154 lines (124 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
#### SYSTEM COMMAND ####
NODE=node
NPM=npm
GRUNT=grunt
BOWER=bower
GIT=git
CD=cd
ECHO=@echo
TAR=tar -zcvf
DEL=rm -rf
MAKE=make
MV=mv
RSYNC=rsync -av --delete --exclude=".git"
CERTIFICATE_PASS=manager
CERTIFICATE_INFO='/FR=localhost/O=OVH./C=FR'
CERTIFICATE_KEY=server/certificate/server.key
CERTIFICATE_TMP_KEY=$(CERTIFICATE_KEY).tmp
CERTIFICATE_CSR_FILE=server/certificate/server.csr
CERTIFICATE_CRT_FILE=server/certificate/server.crt
#### FOLDERS ####
BOWER_DIR=client/bower_components
NODE_DIR=node_modules
GRUNT_DEP=$(NODE_DIR)/grunt
DIST_DIR=dist
DIST_EU_DIR=dist-EU
DIST_CA_DIR=dist-CA
#### FILES ####
DIST_TAR=dist.tar.gz
DIST_EU_TAR=dist-EU.tar.gz
DIST_CA_TAR=dist-CA.tar.gz
#### MACRO ####
NAME=`grep -Po '(?<="name": ")[^"]*' package.json`
#### OTHER ####
ifneq ($(strip $(bower_registry)),)
BOWER_PARAM=--config.registry=$(bower_registry)
endif
help:
$(ECHO) "_____________________________"
$(ECHO) "$(NAME)"
$(ECHO) "Copyright (c) OVH SAS."
$(ECHO) "All rights reserved."
$(ECHO) "_____________________________"
$(ECHO) " -- AVAILABLE TARGETS --"
$(ECHO) "make clean => clean the sources"
$(ECHO) "make gen-certificate => generate certificate"
$(ECHO) "make install => install deps"
$(ECHO) "make dev => launch the project (development)"
$(ECHO) "make prod => launch the project (production) - For testing purpose only"
$(ECHO) "make test => launch the tests"
$(ECHO) "make test-e2e suite=smoke|full browser=phantomjs|chrome|firefox => launch the e2e tests"
$(ECHO) "make coverage => launch the coverage"
$(ECHO) "make build => build the project and generate dist"
$(ECHO) "make release type=patch|minor|major => build the project, generate build folder, increment release and commit the source"
$(ECHO) "_____________________________"
clean:
$(DEL) $(NODE_DIR)
$(DEL) $(BOWER_DIR)
$(DEL) $(DIST_DIR)
$(DEL) $(DIST_TAR)
$(DEL) $(DIST_EU_DIR)
$(DEL) $(DIST_CA_DIR)
$(DEL) $(DIST_EU_TAR)
$(DEL) $(DIST_CA_TAR)
gen-certificate:
mkdir -p server/certificate
openssl genrsa -des3 -passout pass:$(CERTIFICATE_PASS) -out $(CERTIFICATE_KEY) 1024
openssl req -passin pass:$(CERTIFICATE_PASS) -new -key $(CERTIFICATE_KEY) -out $(CERTIFICATE_CSR_FILE) -subj $(CERTIFICATE_INFO)
cp $(CERTIFICATE_KEY) $(CERTIFICATE_TMP_KEY)
openssl rsa -passin pass:$(CERTIFICATE_PASS) -in $(CERTIFICATE_TMP_KEY) -out $(CERTIFICATE_KEY)
openssl x509 -req -days 365 -in $(CERTIFICATE_CSR_FILE) -signkey $(CERTIFICATE_KEY) -out $(CERTIFICATE_CRT_FILE)
rm $(CERTIFICATE_TMP_KEY)
install:
$(NPM) install
$(BOWER) install $(BOWER_PARAM)
dev: deps
$(GRUNT) serve
# [OLD] legacy system, should be:
# prod: deps
# $(GRUNT) serve:dist
build: build-eu
$(TAR) $(DIST_TAR) $(DIST_EU_TAR)
build-eu: deps
$(GRUNT) build --mode=prod --zone=EU
$(MV) $(DIST_DIR) $(DIST_EU_DIR)
$(TAR) $(DIST_EU_TAR) $(DIST_EU_DIR)
build-ca: deps
$(GRUNT) build --mode=prod --zone=CA
$(MV) $(DIST_DIR) $(DIST_CA_DIR)
$(TAR) $(DIST_CA_TAR) $(DIST_CA_DIR)
release: deps
$(NPM) version $(type) -m "chore: release v%s"
###############
# Tests tasks #
###############
TEST_REPORTS=test-reports
test: deps
$(GRUNT) test
coverage: deps
$(GRUNT) test:coverage:unit
webdriver:
$(NPM) run update-webdriver
test-e2e: deps webdriver
$(GRUNT) test:e2e --suite=$(suite) --browser=$(browser); \
if [ $$? = 0 ]; \
then \
$(MAKE) tar-test-reports; \
exit 0; \
else \
$(MAKE) tar-test-reports; \
exit 2; \
fi
tar-test-reports:
$(TAR) $(TEST_REPORTS).tar.gz $(TEST_REPORTS)
#############
# Sub tasks #
#############
# Dependencies of the project
deps: $(GRUNT_DEP) $(BOWER_DIR)
$(BOWER_DIR):
$(MAKE) install
$(NODE_DIR)/%:
$(MAKE) install
clean-dist: $(GRUNT_DEP)
$(GRUNT) clean