#!/usr/bin/env bash # # Usage: # ./run.sh set -o nounset set -o pipefail set -o errexit # http://oilshell.org/$VERSION/ # doc/ # INSTALL.txt -- for people who want to try it # osh-quick-ref.html -- A single page # osh-manual.html -- more stuff # Do we want: # - spec/unit/gold/wild test results? # - benchmarks? # maybe: # $VERSION/ # doc/ # test/ # benchmarks/ # # Just like the repo layout. # Another idea: # # http://oilshell.org/release/ # $VERSION/ # oil-0.0.0.tar.gz # This should probably go on a different host # doc/ # test/ # benchmarks/ readonly OIL_VERSION=$[head -n 1 oil-version.txt] export OIL_VERSION # for quick_ref.py proc log { echo @Argv !1 > !2 } proc _build-timestamp { echo '
' echo "Generated on $[date]" } # Places version is used # # - in --version # - in URL for every page? inside the binary # - in titles for index, install, osh-quick-ref TOC, etc. # - in deployment script # Run with environment variable proc _quick-ref { build/quick_ref.py @Argv } proc x-quick-ref { local prog=$1 local out_dir=$2 local html_out=$out_dir/doc/$prog-quick-ref.html local text_out_dir=_devbuild/$prog-quick-ref local py_out=_devbuild/gen/$(prog)_help.py mkdir -p _build/doc $text_out_dir do { cat << """

NOTE: This document is a work in progress!

""" _quick-ref toc doc/$(prog)-quick-ref-toc.txt # Also generate _build/osh-quick-ref/ dir _quick-ref pages doc/$(prog)-quick-ref-pages.txt $text_out_dir $py_out _build-timestamp cat << """ """ } > $html_out log "Wrote $html_out" } proc osh-quick-ref { local out_dir=$(1:-_build) x-quick-ref osh $out_dir } proc markdown2html { local src=$1 local out=$2 local monospace=$(3:-) mkdir -p _build/doc do { cat << """ """ markdown < $src # TODO: CommonMark _build-timestamp cat << """ """ } > $out } readonly MONOSPACE='font-family: monospace;' proc install { markdown2html INSTALL.txt _release/VERSION/doc/INSTALL.html $MONOSPACE } proc release-index { local out=$(1:-_build/doc/release-index.html) # Not monospace markdown2html doc/release-index.md $out '' } # I want to ship the INSTALL file literally, so just mutate things proc _sed-ext { sed --regexp-extended -i @Argv } proc update-src-versions { _sed-ext \ "s/Version [0-9]+.[0-9]+.[a-z0-9]+/Version $OIL_VERSION/g" \ doc/release-index.md _sed-ext \ "s/oil-[0-9]+.[0-9]+.[a-z0-9]+/oil-$OIL_VERSION/g" INSTALL.txt _sed-ext \ "s;/release/[0-9]+.[0-9]+.[a-z0-9]+/;/release/$OIL_VERSION/;g" doc/osh-quick-ref-toc.txt } @Argv