#!/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 log() { echo "$@" 1>&2 } _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 _quick-ref() { build/quick_ref.py "$@" } x-quick-ref() { local prog=$1 local out_dir=$2 local html_out=$out_dir/doc/$prog-quick-ref.html local text_out_dir=_build/$prog-quick-ref local py_out=_devbuild/gen/${prog}_help.py mkdir -p _build/doc $text_out_dir { cat <

NOTE: This document is a work in progress!

EOF _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 < EOF } > $html_out log "Wrote $html_out" } osh-quick-ref() { local out_dir=${1:-_build} x-quick-ref osh $out_dir } oil-quick-ref() { local out_dir=${1:-_build} x-quick-ref oil $out_dir } markdown2html() { local src=$1 local out=$2 local monospace=${3:-} mkdir -p _build/doc { cat < EOF markdown < $src # TODO: CommonMark _build-timestamp cat < EOF } > $out } readonly MONOSPACE='font-family: monospace;' install() { markdown2html INSTALL.txt _release/VERSION/doc/INSTALL.html "$MONOSPACE" } 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 _sed-ext() { sed --regexp-extended -i "$@" } 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 } "$@"