Merge pull request #525 from danvk/this-formatter
[dygraphs.git] / push-to-web.sh
... / ...
CommitLineData
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
5if [ "$1" == "" ] ; then
6 echo "usage: $0 destination"
7 exit 1
8fi
9
10set -x
11site=$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
19chmod a+r docs/options.html
20if [ -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/
37else
38 echo "generate-documentation.py failed"
39fi
40
41# Revert changes to dygraph-combined.js and docs.
42make clean-combined-test
43rm dygraph-combined-dev.js
44git checkout docs/download.html
45rm docs/options.html
46rm -rf $temp_dir