better images names
[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
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}/$$file.png ${SCREENSHOT_WIDTH_HEIGHT} ${TIMEOUT}
29
30 screenshots:
31         for i in $$(cat url.txt); do \
32           make PHANTOMJS_URL="$$i" TIMEOUT=4 screenshot; \
33         done; wait
34         make index
35
36 index:
37         cd ${IMAGES}; ls *.png | perl -ne 'chomp; print qq{<h2>$$_</h2><img src="$$_"/><br/><br/><p/>\n}' > index.html
38
39 help:
40         @echo "make [ all | clean | distclean ]"
41         @echo "     [ screenshots ]"
42         @echo "     [ screenshot | index ]"
43         @echo ""
44