1 # Copyright (c) 2013-2014 Index Data ApS. http://indexdata.com
4 PHANTOMJS= ../bin/bomb --timeout=${PHANTOMJS_TIMEOUT} ../node_modules/phantomjs/bin/phantomjs
6 SCREENSHOT_WIDTH_HEIGHT= 1000 1200
7 PROG= ../phantom/screenshot.js
8 MD5= $(shell which md5 md5sum)
9 TESTS= koha demos mike # koha.url
13 PHANTOMJS_URL= http://cph.koha.indexdata.com/cgi-bin/koha/opac-search.pl?q=sushi
14 PHANTOMJS_URL= http://www.indexdata.com/
24 rm -f ${IMAGES}/*.png.tmp
29 file=${PREFIX}.$$(echo "${PHANTOMJS_URL}" | perl -npe 's,(\W),-,g; s/-$$//;'); \
30 ${PHANTOMJS} ${PROG} "${PHANTOMJS_URL}" ${IMAGES}/tmp.$$file.png ${SCREENSHOT_WIDTH_HEIGHT} ${TIMEOUT}; \
31 mv -f ${IMAGES}/tmp.$$file.png ${IMAGES}/$$file.png
33 screenshots: clean estimate-time iframe
35 for t in ${TESTS}; do \
36 for i in $$(cat url.$$t); do \
37 ${MAKE} PHANTOMJS_URL="$$i" TIMEOUT=4 PREFIX=$$t screenshot & sleep 1; \
39 ${MAKE} PREFIX=$$t index; \
41 ${MAKE} index-widgets tidy help-url
45 @echo "Please check now: http://localhost/test/widgets/index.html"
48 @wc -l url.* | tail -n1 | awk '{print "Estimeate run time: " $$1 * (1 + '${TIMEOUT}') * 0.5, "seconds" }'
52 ( cd ${IMAGES}; ls -tr ${PREFIX}.*.png | perl -ne 'chomp; print qq{<h2>$$_</h2><img src="'${IMAGES}/'$$_"/><br/><br/><p/>\n}' ) > index-${PREFIX}.html
55 ls -t index-*html iframe-*.html | perl -ne 'chomp; print qq{<a href="$$_">$$_</a><br/>\n}' > index.html
57 iframe: index-iframe-demo
59 ( 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
60 ( 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
63 for i in iframe-demos*.html index*.html; do \
64 tidy -i -m $$i >/dev/null 2>&1; \
65 perl -i -npe 's,(^\s*</head>),<link type="text/css" rel="stylesheet" href="screenshots.css" /> $$1,' $$i; \
69 @echo "make [ all | clean | distclean ]"
70 @echo " [ screenshots ]"
71 @echo " [ screenshot | index | iframe | tidy ]"
75 @echo "make TESTS=mike screenshots"