make -> ${MAKE}, part of MKWS-292
[mkws-moved-to-github.git] / test / widgets / Makefile
1 # Copyright (c) 2013-2014 Index Data ApS. http://indexdata.com
2
3 PHANTOMJS_TIMEOUT=18
4 PHANTOMJS=      ../node_modules/phantomjs/bin/phantomjs
5 IMAGES=         ./images
6 SCREENSHOT_WIDTH_HEIGHT=        1000 1200
7 PERL_SCRIPTS=   ../bin/bomb.pl
8 PROG=   ../phantom/screenshot.js
9 MD5=    $(shell which md5 md5sum)
10 TIMEOUT=5
11
12 PHANTOMJS_URL=  http://cph.koha.indexdata.com/cgi-bin/koha/opac-search.pl?q=sushi
13 PHANTOMJS_URL=  http://www.indexdata.com/
14
15 all: help
16
17 clean:
18         rm -f mkws-error.png mkws-error.html 
19         rm -f ${IMAGES}/*.png ${IMAGES}/*.png.tmp
20         rm -f ${IMAGES}/index.html
21
22 distclean: clean
23
24 test: check
25
26 screenshot:
27         file=$$(echo "${PHANTOMJS_URL}" | perl -npe 's,(\W),-,g'); \
28           ${PHANTOMJS} ${PROG} ${PHANTOMJS_URL} ${IMAGES}/tmp.$$file.png ${SCREENSHOT_WIDTH_HEIGHT} ${TIMEOUT}; \
29           mv -f  ${IMAGES}/tmp.$$file.png  ${IMAGES}/$$file.png
30
31 screenshots: clean
32         for i in $$(cat url.txt); do \
33           make PHANTOMJS_URL="$$i" TIMEOUT=4 screenshot; \
34         done; wait
35         ${MAKE} index
36
37 index:
38         cd ${IMAGES}; ls -tr *.png | perl -ne 'chomp; print qq{<h2>$$_</h2><img src="$$_"/><br/><br/><p/>\n}' > index.html
39
40 help:
41         @echo "make [ all | clean | distclean ]"
42         @echo "     [ screenshots ]"
43         @echo "     [ screenshot | index ]"
44         @echo ""
45