Merge pull request #736 from danvk/issue-pr-templates
[dygraphs.git] / scripts / push-to-web.sh
CommitLineData
ff533c10
DV
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.
5f303314
RK
4
5if [ "$1" == "" ] ; then
cf88e0ec 6 echo "usage: $0 destination"
5f303314
RK
7 exit 1
8fi
9
11a25550 10set -x
ff533c10 11site=$1
c9093b7b 12
d85ec732 13# Produce dygraph-combined.js and dygraph-combined-dev.js
ff533c10 14./generate-combined.sh
d85ec732 15./generate-combined.sh cat-dev > dygraph-combined-dev.js
ff533c10 16
d3454ce4 17# Generate documentation.
817b08dd 18./generate-documentation.py > docs/options.html
b7d36956 19chmod a+r docs/options.html
aade5c60
RK
20if [ -s docs/options.html ] ; then
21 ./generate-jsdoc.sh
5c364f57 22 ./generate-download.py > docs/download.html
d3454ce4 23
14403441
DV
24 temp_dir=$(mktemp -d /tmp/dygraphs-docs.XXXX)
25 cd docs
26 ./ssi_expander.py $temp_dir
27 cd ..
28
c9093b7b
DV
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
aade5c60 33 # Copy everything to the site.
6f5f0b2b 34 rsync -avzr gallery common tests jsdoc experimental plugins datahandler polyfills extras $site \
aade5c60 35 && \
9901b0c1 36 rsync -avzr --copy-links dashed-canvas.js dygraph*.js gadget.xml thumbnail.png screenshot.png $temp_dir/* $site/
aade5c60
RK
37else
38 echo "generate-documentation.py failed"
39fi
ff533c10 40
5c364f57 41# Revert changes to dygraph-combined.js and docs.
a81eeb1f 42make clean-combined-test
d85ec732 43rm dygraph-combined-dev.js
5c364f57 44git checkout docs/download.html
d3454ce4 45rm docs/options.html
14403441 46rm -rf $temp_dir