1 # Copyright (c) 2013-2014 Index Data ApS. http://indexdata.com
4 PHANTOMJS= perl ../bin/bomb.pl --timeout=${PHANTOMJS_TIMEOUT} ../node_modules/phantomjs/bin/phantomjs
6 SCREENSHOT_WIDTH_HEIGHT= 1000 1200
7 PERL_SCRIPTS= ../bin/bomb.pl
8 PROG= ../phantom/screenshot.js
9 MD5= $(shell which md5 md5sum)
10 TESTS= koha demos mike # koha.url
14 PHANTOMJS_URL= http://cph.koha.indexdata.com/cgi-bin/koha/opac-search.pl?q=sushi
15 PHANTOMJS_URL= http://www.indexdata.com/
25 rm -f ${IMAGES}/*.png.tmp
30 file=${PREFIX}.$$(echo "${PHANTOMJS_URL}" | perl -npe 's,(\W),-,g; s/-$$//;'); \
31 ${PHANTOMJS} ${PROG} "${PHANTOMJS_URL}" ${IMAGES}/tmp.$$file.png ${SCREENSHOT_WIDTH_HEIGHT} ${TIMEOUT}; \
32 mv -f ${IMAGES}/tmp.$$file.png ${IMAGES}/$$file.png
34 screenshots: clean estimate-time iframe
36 for t in ${TESTS}; do \
37 for i in $$(cat url.$$t); do \
38 ${MAKE} PHANTOMJS_URL="$$i" TIMEOUT=4 PREFIX=$$t screenshot & sleep 1; \
40 ${MAKE} PREFIX=$$t index; \
42 ${MAKE} index-widgets tidy help-url
46 @echo "Please check now: http://localhost/test/widgets/index.html"
49 @wc -l url.* | tail -n1 | awk '{print "Estimeate run time: " $$1 * (1 + '${TIMEOUT}') * 0.5, "seconds" }'
53 ( cd ${IMAGES}; ls -tr ${PREFIX}.*.png | perl -ne 'chomp; print qq{<h2>$$_</h2><img src="'${IMAGES}/'$$_"/><br/><br/><p/>\n}' ) > index-${PREFIX}.html
56 ls -t index-*html iframe-*.html | perl -ne 'chomp; print qq{<a href="$$_">$$_</a><br/>\n}' > index.html
58 iframe: index-iframe-demo
60 ( egrep example.indexdata.com url.demos | perl -ne 'chomp; print qq{<h2>$$_</h2><iframe width="900px" height="600px" src="$$_"></iframe>\n}' ) > iframe-demos-example.html
61 ( egrep -v example.indexdata.com url.demos | perl -ne 'chomp; print qq{<h2>$$_</h2><iframe width="900px" height="600px" src="$$_"></iframe>\n}' ) > iframe-demos-other.html
64 for i in iframe-demos*.html index*.html; do \
65 tidy -i -m $$i >/dev/null 2>&1; \
66 perl -i -npe 's,(^\s*</head>),<link type="text/css" rel="stylesheet" href="screenshots.css" /> $$1,' $$i; \
70 @echo "make [ all | clean | distclean ]"
71 @echo " [ screenshots ]"
72 @echo " [ screenshot | index | iframe | tidy ]"
76 @echo "make TESTS=mike screenshots"