annotate util/generate_docs.sh @ 634:14eec6faf10b 2.0.0b4

docs: Make FoodTruck screenshots the proper size.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 09 Feb 2016 21:37:12 -0800
parents 7b4f0687d9d9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
633
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
1 #!/bin/sh
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
2
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
3 set -e
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
4
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
5 VERSION=
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
6 ROOT_URL=
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
7 TEMP_DIR=
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
8 OUTPUT_DIR=
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
9
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
10 ShowUsage() {
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
11 echo "Usage:"
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
12 echo " $PROG_NAME <options>"
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
13 echo ""
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
14 echo " -v [version]"
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
15 echo " -r [root_url]"
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
16 echo " -t [tmp_dir]"
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
17 echo " -o [out_dir]"
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
18 echo ""
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
19 }
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
20
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
21 while getopts "h?v:r:t:o:" opt; do
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
22 case $opt in
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
23 h|\?)
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
24 ShowUsage
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
25 exit 0
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
26 ;;
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
27 v)
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
28 VERSION=$OPTARG
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
29 ;;
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
30 r)
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
31 ROOT_URL=$OPTARG
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
32 ;;
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
33 t)
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
34 TEMP_DIR=$OPTARG
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
35 ;;
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
36 o)
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
37 OUTPUT_DIR=$OPTARG
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
38 ;;
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
39 esac
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
40 done
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
41
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
42 if [ "$VERSION" = "" ]; then
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
43 echo "You need to specify a version number or label."
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
44 exit 1
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
45 fi
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
46 if [ "$OUTPUT_DIR" = "" ]; then
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
47 echo "You need to specify an output directory."
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
48 exit 1
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
49 fi
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
50 if [ "$TEMP_DIR" = "" ]; then
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
51 TEMP_DIR=_counter-docs
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
52 fi
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
53
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
54 echo "Updating virtual environment..."
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
55 venv/bin/pip install -r requirements.txt --upgrade
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
56
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
57 echo "Generate PieCrust version..."
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
58 venv/bin/python3 setup.py version
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
59
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
60 echo "Update Bower packages..."
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
61 bower update
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
62
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
63 echo "Baking documentation for version $VERSION..."
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
64 CHEF_ARGS="--root docs --config dist"
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
65 if [ ! "$ROOT_URL" = "" ]; then
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
66 CHEF_ARGS="$CHEF_ARGS --config-set site/root $ROOT_URL"
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
67 fi
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
68 venv/bin/python3 chef.py $CHEF_ARGS bake -o $TEMP_DIR
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
69
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
70 echo "Synchronizing $OUTPUT_DIR"
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
71 if [ ! -d $OUTPUT_DIR ]; then
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
72 mkdir -p $OUTPUT_DIR
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
73 fi
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
74 rsync -av --delete-after $TEMP_DIR/ $OUTPUT_DIR/
7b4f0687d9d9 cm: Add script to generate documentation.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
75