]> git.donarmstrong.com Git - neurodebian.git/blob - survey/Makefile
fb16ff3b4f7fc2678c816e167d86d79ddeefbebe
[neurodebian.git] / survey / Makefile
1 all: index.html
2
3 clean:
4         -rm *.html *.js *.txt
5
6 jquery.form.js:
7         wget --no-check-certificate http://github.com/malsup/form/raw/master/jquery.form.js
8
9 index.html: survey.rst
10         rst2html --link-stylesheet --stylesheet-path=survey.css survey.rst > $@
11
12 results.html: results.rst figures/stats.txt
13         rst2html --link-stylesheet --stylesheet-path=survey.css results.rst > $@
14
15 results_snippet.html: results.html
16         head -n$$(echo "$$(grep -n '</body>' < results.html | cut -d ':' -f 1,1) - 1" \
17                 | bc ) results.html \
18                 | tail -n$$(echo "$$(wc -l < results.html) - $$(grep -n '<body>' \
19                 < results.html | cut -d ':' -f 1,1) - 2" | bc ) > $@
20
21 figures/stats.txt: statfigures
22
23 statfigures: oslist.txt swlist.txt datamodlist.txt employer-dd-list.txt position-dd-list.txt ratingslist.txt vmlist.txt
24 # create "lockfile'
25         @touch $@
26         @[ "$$(cat nsubmissions.stamp 2>/dev/null || echo)" != "$$(ls -1 data |wc -l)" ] \
27                 && echo "I: Re-generating stats figures" \
28                 && ls -1 data |wc -l > nsubmissions.stamp \
29                 && MVPA_MATPLOTLIB_BACKEND=agg ./makestats data figures || true
30 # remove lockfile
31         @-rm $@
32
33 getdata:
34         rsync -rvzlhp --delete \
35                 neurodebian@www.pymvpa.org:/home/neurodebian/survey/data .
36         ./postprocdata
37
38 oslist.txt: select_os_options.inc
39         grep -v selected select_os_options.inc | sed -e 's/<option value="//' \
40                 -e 's/" label="/: "/' -e 's/">.*$$/"/' > $@
41
42 swlist.txt: survey.rst
43         grep '"sw.*" value' survey.rst | sed -e 's/.*name="sw.*" value="//' -e 's," />,: ",' \
44                 -e 's,</td>$$,",' -e 's/ "$$/ "Other"/' > $@
45
46 vmlist.txt: survey.rst
47         grep virt_prod survey.rst | sed -e 's/.*<input.*value="//' \
48                 -e 's," />,: ",' -e 's,<br />.*$$,,' -e 's/ "$$/ "Other VM"/' > $@
49
50 datamodlist.txt: survey.rst
51         grep '"bg_datamod"' survey.rst | sed -e 's/.*name="bg_datamod" value="//' \
52                 -e 's," />,: ",' -e 's,<br />$$,",' -e 's/ "$$/ "Other"/' > $@
53
54 # Generic rule to extract from drop-down selections
55 %-dd-list.txt: survey.rst
56         @echo "I: Extracting fields for $* into $@"
57         @sed -n -e '/bg_$*/,/\/tr/p' survey.rst \
58         | sed -ne '/option/s,.*value="\([^"]*\)" *label=\("[^"]*"\)>.*,\1: \2,gp' >| $@
59
60 ratingslist.txt: survey.rst
61         @echo "I: Extracting fields for ratings into $@"
62         @grep -B 6 -e 'radio.*_r.*value="3"' survey.rst \
63         | grep -v -e '^\.\. raw' -e '^[ -]*$$' -e '<td' \
64         | sed -e 's,.*name="\([^"]*\)" value.*,|\1#,g' \
65         | tr '\n' ' ' \
66         | sed -e 's,#,#\n,g' \
67         | sed -e 's,\(.*\)|\(.*\)#,\2: "\1",g' >| $@
68
69 upload: index.html results.html results_snippet.html jquery.form.js survey.css surveycollector.cgi
70         rsync -rvzlhp --delete  \
71         --exclude='*.txt' --exclude=data --exclude='*.cgi' --exclude=figures \
72                 --chmod=Dg+s,g+rw * neurodebian@www.pymvpa.org:/home/neurodebian/survey/
73         scp surveycollector.cgi neurodebian@www.pymvpa.org:/srv/neuro.debian.net/cgi-bin/
74
75 .PHONY: statfigures