This repository has been archived by the owner on Dec 1, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 40
/
Makefile
92 lines (72 loc) · 2.42 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
NODE_LOCAL_BIN=./node_modules/.bin
NODE_ENV?=development # by default we are in development mode
ifeq ($(shell echo ${NODE_ENV}), development)
SESSION_SECRET?=unguessable # default secret for development and test mode
endif
.PHONY: test
test: lint mocha selenium_all
.PHONY: test_server
test_server: jshint_server mocha
install:
@npm install
.PHONY: lint
lint: jshint flake8
# bootstrap our python virtual environment if it's not there
.venv:
virtualenv -p python2.7 `pwd`/.venv
. .venv/bin/activate && pip install -r bin/require.pip
clean:
rm -rf .venv node_modules
# flake8 is a python linter
PYTHON_SOURCES = test/functional/*.py test/frontend/*.py
.PHONY: flake8
flake8: .venv
. .venv/bin/activate && flake8 $(PYTHON_SOURCES)
.PHONY: jshint
jshint:
@$(NODE_LOCAL_BIN)/jshint *.js static server test
.PHONY: jshint_server
jshint_server:
@$(NODE_LOCAL_BIN)/jshint *.js server test/server
.PHONY: mocha
mocha:
@env NODE_ENV=test SESSION_SECRET=${SESSION_SECRET} \
./node_modules/mocha/bin/mocha --reporter spec test/server
.PHONY: runserver
runserver:
@env NODE_ENV=${NODE_ENV} PORT=5000 SESSION_SECRET=${SESSION_SECRET} \
node app.js
.PHONY: runserver_dev
runserver_dev:
@echo "Warning: make runserver_dev is deprecated, use runserver instead"
make runserver
.PHONY: cover_server
cover_server:
@env NODE_ENV=test SESSION_SECRET=${SESSION_SECRET} \
$(NODE_LOCAL_BIN)/istanbul cover \
$(NODE_LOCAL_BIN)/_mocha -- test/server
@echo aim your browser at coverage/lcov-report/index.html for details
# XXX refactor this file to not invoke run_selenium_test.sh twice, and call
# other targets
.PHONY: selenium_all
selenium_all:
bin/run_selenium_test.sh "python -m unittest discover -v test/frontend" \
"python -m unittest discover -v test/functional"
.PHONY: selenium
selenium:
bin/run_selenium_test.sh "python -m unittest discover -v test/functional"
.PHONY: selenium-repeat
REPEAT_TIMES ?= 10
REPEAT_TEST ?= -m unittest discover -v test/functional
selenium-repeat:
bin/run_selenium_test.sh "bin/repeat_loop.sh $(REPEAT_TIMES) python $(REPEAT_TEST)"
.PHONY: frontend
frontend:
bin/run_selenium_test.sh "python -m unittest discover -v test/frontend"
PINPANEL_DIR ?= bin/PinPanel
PINPANEL_SRCS ?= $(PINPANEL_DIR)/install.rdf $(PINPANEL_DIR)/bootstrap.js
bin/PinPanel.xpi: $(PINPANEL_SRCS)
rm -f bin/PinPanel.xpi
( cd bin/PinPanel && zip ../PinPanel.xpi install.rdf bootstrap.js )
.PHONY: pinpanel
pinpanel: bin/PinPanel.xpi