bomb.pl - wrapper to stop a process after N seconds, MKWS-110
[mkws-moved-to-github.git] / test / Makefile
1 # Copyright (c) 2013 IndexData ApS. http://indexdata.com
2
3 # For running on Mike's local install of node.js
4 MIKE = PATH=$$PATH:/usr/local/lib/node-v0.10.24-linux-x64/bin
5 NPM_INSTALL_FLAGS=-q
6 PHANTOMJS=      ./bomb.pl ./node_modules/phantomjs/bin/phantomjs
7 PHANTOMJS_URL=  https://mkws-dev.indexdata.com/jasmine-popup.html       
8 PHANTOMJS_TIMEOUT=      12      
9 IMAGES= ./images
10 SCREENSHOT_WIDTH=       360 480 640 768 1024 1200 1440 2048
11
12 all: check
13
14 clean:
15         rm -f mkws-error.png mkws-error.html images/*.png
16
17 distclean: clean
18         rm -rf node_modules
19
20 mkws-complete-syntax-check:
21         ${MAKE} -C../tools/htdocs $@
22
23 check: mkws-complete-syntax-check
24         @if [ ! -e node_modules ]; then echo "please run first: make node-modules"; exit 1; fi 
25         jasmine-node --noColor --captureExceptions --forceexit ./spec
26         jasmine-node --noColor --captureExceptions --forceexit ./spec-sp
27
28 test: check
29
30 terse:
31         $(MIKE) jasmine-node --noColor --captureExceptions --forceexit spec
32
33 phantomjs:
34         ${PHANTOMJS} phantom/evaluate.js ${PHANTOMJS_URL} ${PHANTOMJS_TIMEOUT}
35
36 screenshot:
37         ${PHANTOMJS} phantom/screenshot.js ${PHANTOMJS_URL} ${IMAGES}/screenshot.png 1200 1000
38
39 screenshot-mkws:
40         for i in ${SCREENSHOT_WIDTH}; do \
41             ${PHANTOMJS} phantom/screenshot.js http://mkws.indexdata.com ${IMAGES}/mkws-$$i.png $$i 1000 &  \
42         done; wait
43         ls -l ${IMAGES}
44
45 screenshot-indexdata:
46         for i in ${SCREENSHOT_WIDTH}; do \
47             ${PHANTOMJS} phantom/screenshot.js http://www.indexdata.com ${IMAGES}/indexdata-$$i.png $$i 1000 &  \
48         done; wait
49         ls -l ${IMAGES}
50
51 jsbeautifier jsb indent:
52         for i in package.json ./spec*/*.js ./js/*.js ./phantom/*.js; do \
53           jsbeautifier -j $$i > $@.tmp && mv -f $@.tmp $$i; \
54         done
55
56 node_modules node-modules:
57         npm install ${NPM_INSTALL_FLAGS}
58
59 help:
60         @echo "make [ all | check | clean | distclean ]"
61         @echo "     [ phantomjs | screenshot ]"
62         @echo "     [ jsbeautifier | node-modules ]"
63         @echo ""
64         @echo "DEBUG=1 make phantomjs PHANTOMJS_TIMEOUT=8 PHANTOM_URL=https://mkws-dev.indexdata.com/jasmine-popup.html"
65