New dygraphs home page
[dygraphs.git] / push-to-web.sh
1 #!/bin/bash
2 # This script generates the combined JS file, pushes all content to a web site
3 # and then reverts the combined file.
4
5 if [ "$1" == "" ] ; then
6 echo "usage: $0 destination"
7 exit 1
8 fi
9
10 set -x
11 site=$1
12
13 # Produce dygraph-combined.js.
14 ./generate-combined.sh
15
16 # Generate documentation.
17 ./generate-documentation.py > docs/options.html
18 chmod a+r docs/options.html
19 if [ -s docs/options.html ] ; then
20 ./generate-jsdoc.sh
21
22 temp_dir=$(mktemp -d /tmp/dygraphs-docs.XXXX)
23 cd docs
24 ./ssi_expander.py $temp_dir
25 cd ..
26
27 # Make sure everything will be readable on the web.
28 # This is like "chmod -R a+rX", but excludes the .git directory.
29 find . -path ./.git -prune -o -print | xargs chmod a+rX
30
31 # Copy everything to the site.
32 rsync -avzr gallery strftime rgbcolor common tests jsdoc experimental plugins $site \
33 && \
34 rsync -avzr --copy-links dashed-canvas.js stacktrace.js dygraph*.js gadget.xml excanvas.js thumbnail.png screenshot.png $temp_dir/* $site/
35 else
36 echo "generate-documentation.py failed"
37 fi
38
39 # Revert changes to dygraph-combined.js and docs/options.html
40 git checkout dygraph-combined.js
41 rm docs/options.html
42 rm -rf $temp_dir