1#| 2Copyright 2004,2006 Vladimir Prus 3Copyright 2018 Rene Rivera 4Distributed under the Boost Software License, Version 1.0. 5(See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) 6|# 7 8#| 9Doc generation works in two modes: standalone embedded and website. 10 11For the standalone we just generate the local html for inclusion in a release 12archive. This is the default when no arguments are given. 13 14For the website we clone the website branch locally, generatate the docs in 15the website tree, commit, and push. The default for those arguments is to 16build as if we are doing "develop" branch docs. 17 18b2 --website-dir=website --website-doc-dir=manual/develop website 19 20Building documentation has only been tested on Posix systems and requires: 21 22* Ruby 23* Python 2 24* gem install asciidoctor 25* gem install pygments.rb 26* pip install --user Pygments 27* pip install --user https://github.com/bfgroup/jam_pygments/archive/master.zip 28|# 29 30import asciidoctor ; 31import modules ; 32import path ; 33 34project b2doc 35 ; 36 37path-constant PYGMENTS_DIR : src/pygments ; 38 39doc-dir = [ MATCH "--doc-dir=(.*)" : [ modules.peek : ARGV ] ] ; 40doc-dir ?= html ; 41 42website = [ MATCH "(website)" : [ modules.peek : ARGV ] ] ; 43website-dir = [ MATCH "--website-dir=(.*)" : [ modules.peek : ARGV ] ] ; 44website-dir ?= website ; 45website-doc-dir = [ MATCH "--website-doc-dir=(.*)" : [ modules.peek : ARGV ] ] ; 46website-doc-dir ?= manual/develop ; 47if $(website) 48{ 49 doc-dir = $(website-dir)/$(website-doc-dir) ; 50} 51# ECHO $(website) .. $(website-dir) .. $(website-doc-dir) .. $(doc-dir) ; 52 53html index : src/standalone.adoc : 54 : 55 <flags>--require=$(PYGMENTS_DIR)/pygments_init.rb 56 <flags>--trace 57 <flags>--verbose 58 <dependency>$(PYGMENTS_DIR)/pygments_init.rb 59 ; 60explicit index ; 61 62install html : index : <location>$(doc-dir) <dependency>website-html ; 63explicit html ; 64 65alias standalone-html : html ; 66 67if $(website) 68{ 69 make website-checkout : : @website-checkout ; 70 make website-publish : html : @website-publish ; 71 alias website-html : website-checkout ; 72 always website-checkout ; 73 always website-publish ; 74} 75else 76{ 77 alias website-checkout ; 78 alias website-publish ; 79 alias website-html ; 80} 81alias website : website-publish ; 82explicit website-checkout ; 83explicit website-publish ; 84explicit website-html ; 85explicit website ; 86 87############################################################################### 88 89actions website-checkout 90{ 91 rm -rf "$(website-dir)" 92 git clone --verbose --branch gh-pages --depth 1 "https://${GH_TOKEN}github.com/boostorg/build.git" "$(website-dir)" || exit 1 93 CD=${PWD} 94 cd "$(website-dir)" 95 git rm --ignore-unmatch -r "$(website-doc-dir)" || exit 1 96 mkdir -p "$(website-doc-dir)" || exit 1 97 cd ${CD} 98 echo "done" > "$(<)" 99} 100 101actions website-publish 102{ 103 CD=${PWD} 104 cd "$(website-dir)/$(website-doc-dir)" 105 git config user.email "b2-bot" 106 git config user.name "b2-bot" 107 git add --verbose . || exit 1 108 git commit -m "Update user manual." 109 git push || exit 1 110 cd ${CD} 111 rm -rf "$(website-dir)" 112 echo "done" > "$(<)" 113} 114 115############################################################################### 116 117alias boostdoc ; 118explicit boostdoc ; 119 120alias boostrelease : standalone-html ; 121explicit boostrelease ; 122