Skip to content

Commit

Permalink
doc: update the update scripts (#1605)
Browse files Browse the repository at this point in the history
  • Loading branch information
cgay authored May 24, 2024
2 parents b2280c3 + 1ca987e commit 7d24b02
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 33 deletions.
19 changes: 10 additions & 9 deletions documentation/update-opendylan.org.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
#!/bin/bash -xe

# This script is intended to be run from cron.
# This script is intended to be run from a systemd timer. We use our own log
# file because there can be a lot of output and it seems better not to spam the
# systemd journal.

logfile=/var/log/update-opendylan.org.`date +%Y%m%d%H%M`.log
exec > $logfile 2>&1

exe_dir="$(realpath $(dirname $0))"
export PATH=/root/dylan/bin:/opt/opendylan/bin:/opt/python3-venv/bin:${PATH}

repo_dir=/root/deploy-opendylan.org
gendoc_exe=${repo_dir}/gendoc/_build/bin/gendoc
exe_dir="$(realpath $(dirname $0))"
opendylan_dir="$(dirname ${exe_dir})"
dest_dir=/var/www/opendylan.org

# Update opendylan and website submodule first so we get any changes
# to the update.sh script.
cd ${repo_dir}/opendylan
git pull --rebase origin master
# Pull changes to update.sh and the docs.
cd "${opendylan_dir}"
git pull --rebase --tags origin master
git submodule update --init --recursive

${exe_dir}/update.sh "${dest_dir}" "${repo_dir}" "${gendoc_exe}"
${exe_dir}/update.sh "${dest_dir}"

echo "Done updating opendylan.org"
bzip2 $logfile
Expand Down
29 changes: 5 additions & 24 deletions documentation/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
# Three directories in ${dest_dir} are special:
# 1. /downloads # copy files there by hand
# 2. /books/drm # the DRM is .html files, copied here separately
# 3. /package # package docs are generated here

echo ""

Expand All @@ -28,48 +27,30 @@ if [[ ! -d "$dest_dir" ]]; then
fi

set -e # die on any error
set -x # debug output

opendylan_dir=$(dirname $(dirname $(realpath "$0")))

# Get latest gendoc, DRM, etc, as specified in dylan-package.json.
echo "Updating the Dylan workspace to get latest package dependencies..."
cd "${opendylan_dir}/documentation"
dylan update
dylan build gendoc


# Build and install main docs

echo "Building Open Dylan docs in ${opendylan_dir}/documentation/_build/html/ ..."
make --directory ${opendylan_dir}/documentation html

echo "Copying main docs to ${dest_dir} ..."
rsync -avz ${opendylan_dir}/documentation/_build/html/ ${dest_dir}


# Build and install package docs.
#
# Copy the gendoc package first since we're about to modify its docs/source dir.

work_dir=$(mktemp -d)
cp -rp ${opendylan_dir}/_packages/gendoc/current/src ${work_dir}/gendoc
cd ${work_dir}/gendoc
dylan update # Install sphinx-extensions in the right relative location.

package_dir="${work_dir}/gendoc/docs/source/"
echo "Generating package docs in ${package_dir}..."
${opendylan_dir}/_build/bin/gendoc ${package_dir}/index.rst
make --directory ${work_dir}/gendoc/docs html

echo "Copying package docs to ${dest_dir}/package ..."
rsync -avz ${work_dir}/gendoc/docs/_build/html/ ${dest_dir}/package
rsync -a ${opendylan_dir}/documentation/_build/html/ ${dest_dir}


# Install the DRM docs.
#
# Note that the DRM docs depend on rewrite rules setup in nginx config in order
# to redirect Foo to Foo.html or Foo.png etc.
# to redirect Foo to Foo.html or Foo.png etc., so testing is difficult. But it
# also rarely changes so is unlikely to break.

echo "Copying DRM docs to ${dest_dir}/books/drm ..."
mkdir -p ${dest_dir}/books/drm
rsync -avz ${opendylan_dir}/_packages/dylan-reference-manual/current/src/source/ ${dest_dir}/books/drm
rsync -a ${opendylan_dir}/_packages/dylan-reference-manual/current/src/source/ ${dest_dir}/books/drm

0 comments on commit 7d24b02

Please sign in to comment.