Commit | Line | Data |
---|---|---|
ff533c10 | 1 | #!/bin/bash |
fd6b8dad | 2 | # This script generates the bundled JS files and pushes all content to a web site using rsync. |
5f303314 RK |
3 | |
4 | if [ "$1" == "" ] ; then | |
cf88e0ec | 5 | echo "usage: $0 destination" |
5f303314 RK |
6 | exit 1 |
7 | fi | |
8 | ||
11a25550 | 9 | set -x |
fd6b8dad | 10 | set -o errexit |
ff533c10 | 11 | site=$1 |
c9093b7b | 12 | |
fd6b8dad DV |
13 | # Produce dist/*.js |
14 | npm run build | |
ff533c10 | 15 | |
d3454ce4 | 16 | # Generate documentation. |
fd6b8dad | 17 | ./scripts/generate-documentation.py > docs/options.html |
b7d36956 | 18 | chmod a+r docs/options.html |
aade5c60 | 19 | if [ -s docs/options.html ] ; then |
fd6b8dad DV |
20 | ./scripts/generate-jsdoc.sh |
21 | ./scripts/generate-download.py > docs/download.html | |
d3454ce4 | 22 | |
14403441 DV |
23 | temp_dir=$(mktemp -d /tmp/dygraphs-docs.XXXX) |
24 | cd docs | |
25 | ./ssi_expander.py $temp_dir | |
26 | cd .. | |
27 | ||
c9093b7b | 28 | # Make sure everything will be readable on the web. |
fd6b8dad DV |
29 | # This is like "chmod -R a+rX", but excludes the .git and node_modules directories. |
30 | find . -print | egrep -v '\.git|node_modules' | xargs chmod a+rX | |
c9093b7b | 31 | |
aade5c60 | 32 | # Copy everything to the site. |
fd6b8dad | 33 | rsync -avzr src src/extras gallery common tests jsdoc dist $site \ |
aade5c60 | 34 | && \ |
fd6b8dad | 35 | rsync -avzr --copy-links dist/* thumbnail.png screenshot.png $temp_dir/* $site/ |
aade5c60 RK |
36 | else |
37 | echo "generate-documentation.py failed" | |
38 | fi | |
ff533c10 | 39 | |
fd6b8dad | 40 | # Revert changes to docs. |
5c364f57 | 41 | git checkout docs/download.html |
d3454ce4 | 42 | rm docs/options.html |
14403441 | 43 | rm -rf $temp_dir |