Merge pull request #577 from bbirand/patch-1
[dygraphs.git] / scripts / 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 and dygraph-combined-dev.js
14 ./generate-combined.sh
15 ./generate-combined.sh cat-dev > dygraph-combined-dev.js
16
17 # Generate documentation.
18 ./generate-documentation.py > docs/options.html
19 chmod a+r docs/options.html
20 if [ -s docs/options.html ] ; then
21 ./generate-jsdoc.sh
22 ./generate-download.py > docs/download.html
23
24 temp_dir=$(mktemp -d /tmp/dygraphs-docs.XXXX)
25 cd docs
26 ./ssi_expander.py $temp_dir
27 cd ..
28
29 # Make sure everything will be readable on the web.
30 # This is like "chmod -R a+rX", but excludes the .git directory.
31 find . -path ./.git -prune -o -print | xargs chmod a+rX
32
33 # Copy everything to the site.
34 rsync -avzr gallery common tests jsdoc experimental plugins datahandler polyfills extras $site \
35 && \
36 rsync -avzr --copy-links dashed-canvas.js dygraph*.js gadget.xml thumbnail.png screenshot.png $temp_dir/* $site/
37 else
38 echo "generate-documentation.py failed"
39 fi
40
41 # Revert changes to dygraph-combined.js and docs.
42 make clean-combined-test
43 rm dygraph-combined-dev.js
44 git checkout docs/download.html
45 rm docs/options.html
46 rm -rf $temp_dir