jamfile.jam
3.92 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#|
Copyright 2004,2006 Vladimir Prus
Copyright 2018 Rene Rivera
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
|#
#|
Doc generation works in two modes: standalone embedded and website.
For the standalone we just generate the local html for inclusion in a release
archive. This is the default when no arguments are given.
For the website we clone the website branch locally, generatate the docs in
the website tree, commit, and push. The default for those arguments is to
build as if we are doing "develop" branch docs.
b2 --website-dir=website --website-doc-dir=manual/develop website
Building documentation has only been tested on Posix systems and requires:
* Ruby
* Python 2
* gem install asciidoctor
* gem install pygments.rb
* pip install --user Pygments
* pip install --user https://github.com/bfgroup/jam_pygments/archive/master.zip
|#
import asciidoctor ;
import modules ;
import path ;
project b2doc
;
path-constant PYGMENTS_DIR : src/pygments ;
path-constant STYLES_DIR : src/styles ;
doc-dir = [ MATCH "--doc-dir=(.*)" : [ modules.peek : ARGV ] ] ;
doc-dir ?= html ;
website = [ MATCH "(website)" : [ modules.peek : ARGV ] ] ;
website-dir = [ MATCH "--website-dir=(.*)" : [ modules.peek : ARGV ] ] ;
website-dir ?= website ;
website-doc-dir = [ MATCH "--website-doc-dir=(.*)" : [ modules.peek : ARGV ] ] ;
website-doc-dir ?= manual/develop ;
if $(website)
{
doc-dir = $(website-dir)/$(website-doc-dir) ;
}
# ECHO $(website) .. $(website-dir) .. $(website-doc-dir) .. $(doc-dir) ;
html index : src/standalone.adoc :
:
# <flags>--require=$(PYGMENTS_DIR)/pygments_init.rb
<flags>--trace
<flags>--verbose
# <dependency>$(PYGMENTS_DIR)/pygments_init.rb
# <flags>"-a stylesheet=amber.css"
# <flags>"-a stylesdir=$(STYLES_DIR)"
# <asciidoctor-attribute>linkcss
;
explicit index ;
install html : index : <location>$(doc-dir) <dependency>website-html ;
explicit html ;
make index.html : : @make_redir_html : <location>.. ;
REDIR_HTML = "
<html><head><meta http-equiv=\"refresh\" content=\"0; URL=doc/html/index.html\"></head><body>
Automatic redirection failed, please go to <a href=\"doc/html/index.html\">doc/html/index.html</a>.
<!-- Distributed under the Boost Software License, Version 1.0. \(See accompanying file LICENSE.txt or copy at https://www.bfgroup.xyz/b2/LICENSE.txt\) -->
</body></html>
" ;
actions make_redir_html
{
echo @($(<):O=F:E=$(REDIR_HTML))
}
explicit index.html ;
alias standalone-html : html ;
if $(website)
{
make website-checkout : : @website-checkout ;
make website-publish : html : @website-publish ;
alias website-html : website-checkout ;
always website-checkout ;
always website-publish ;
}
else
{
alias website-checkout ;
alias website-publish ;
alias website-html ;
}
alias website : website-publish ;
explicit website-checkout ;
explicit website-publish ;
explicit website-html ;
explicit website ;
###############################################################################
actions website-checkout
{
rm -rf "$(website-dir)"
git clone --verbose --branch gh-pages --depth 1 "https://${GH_TOKEN}github.com/bfgroup/b2.git" "$(website-dir)" || exit 1
CD=${PWD}
cd "$(website-dir)"
git rm --ignore-unmatch -r "$(website-doc-dir)" || exit 1
mkdir -p "$(website-doc-dir)" || exit 1
cd ${CD}
echo "done" > "$(<)"
}
actions website-publish
{
CD=${PWD}
cd "$(website-dir)/$(website-doc-dir)"
git config user.email "b2-bot"
git config user.name "b2-bot"
git add --verbose . || exit 1
git commit -m "Update user manual."
git push || exit 1
cd ${CD}
rm -rf "$(website-dir)"
echo "done" > "$(<)"
}
###############################################################################
alias boostdoc ;
explicit boostdoc ;
alias boostrelease : standalone-html index.html ;
explicit boostrelease ;