use a variable for URL file
[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 URL_FILE=       koha.url
11 TIMEOUT=5
12
13 PHANTOMJS_URL=  http://cph.koha.indexdata.com/cgi-bin/koha/opac-search.pl?q=sushi
14 PHANTOMJS_URL=  http://www.indexdata.com/
15
16 all: help
17
18 clean:
19         rm -f mkws-error.png mkws-error.html 
20         rm -f ${IMAGES}/*.png ${IMAGES}/*.png.tmp
21         rm -f ${IMAGES}/index.html
22
23 distclean: clean
24
25 test: check
26
27 screenshot:
28         file=$$(echo "${PHANTOMJS_URL}" | perl -npe 's,(\W),-,g'); \
29           ${PHANTOMJS} ${PROG} ${PHANTOMJS_URL} ${IMAGES}/tmp.$$file.png ${SCREENSHOT_WIDTH_HEIGHT} ${TIMEOUT}; \
30           mv -f  ${IMAGES}/tmp.$$file.png  ${IMAGES}/$$file.png
31
32 screenshots: clean
33         for i in $$(cat ${URL_FILE}); do \
34           ${MAKE} PHANTOMJS_URL="$$i" TIMEOUT=4 screenshot; \
35         done; wait
36         ${MAKE} index
37
38 index:
39         cd ${IMAGES}; ls -tr *.png | perl -ne 'chomp; print qq{<h2>$$_</h2><img src="$$_"/><br/><br/><p/>\n}' > index.html
40
41 help:
42         @echo "make [ all | clean | distclean ]"
43         @echo "     [ screenshots ]"
44         @echo "     [ screenshot | index ]"
45         @echo ""
46