-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpage.bash
executable file
·51 lines (41 loc) · 1.52 KB
/
webpage.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash -ex
#
# Update the webpage: https://dartslab.jpl.nasa.gov/internal/www/pyam/
if [ $# -eq 0 ]
then
readonly RAW_OUTPUT_DIRECTORY='/home/dlab3/FROM-DLAB/repo/www/pyam'
elif [ $# -eq 1 ]
then
readonly RAW_OUTPUT_DIRECTORY="$1"
else
echo 'Usage: ./webpage.bash <output_directory>'
exit 1
fi
# Get absolute path
readonly OUTPUT_DIRECTORY=$(readlink -f "$RAW_OUTPUT_DIRECTORY")
# Change directory so that we are in the root of pyam
readonly RESOLVED_FILE_PATH=$(readlink -f "$0")
readonly PYAM_DIRECTORY_PATH=$(dirname "$RESOLVED_FILE_PATH")
cd "$PYAM_DIRECTORY_PATH"
version=$(./pyam --version 2>&1 | sed -e 's/pyam //')
if [ ! -d "$OUTPUT_DIRECTORY" ]
then
mkdir "$OUTPUT_DIRECTORY"
fi
readonly TEMPORARY_RST="$OUTPUT_DIRECTORY/index.rst"
cat 'webpage/main.rst' > "$TEMPORARY_RST"
echo -e '\n' >> "$TEMPORARY_RST"
cat 'HISTORY.rst' >> "$TEMPORARY_RST"
rst2html --strict --stylesheet='webpage/bootstrap.css' "$TEMPORARY_RST" "$OUTPUT_DIRECTORY/index.html"
rm -f "$TEMPORARY_RST"
rst2pdf 'README.rst' --output="$OUTPUT_DIRECTORY/README.pdf"
rst2html --strict --stylesheet='webpage/bootstrap.css' 'README.rst' "$OUTPUT_DIRECTORY/README.html"
./distribute.bash "$OUTPUT_DIRECTORY"
# Point to the latest tarball on the webpage itself.
cd "$OUTPUT_DIRECTORY"
sed --in-place='' "s/pyam.tar.gz/pyam-$version.tar.gz/g" 'index.html'
# Check all URLs except for flaky tigris.
linkchecker \
--config="$PYAM_DIRECTORY_PATH/.linkcheckerrc" \
--ignore-url='http://pysvn.tigris.org/' \
"file://$OUTPUT_DIRECTORY/index.html"