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