• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#==============================================================================
2#   Copyright (c) 2017 Daniel James
3#
4#   Use, modification and distribution is subject to the Boost Software
5#   License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6#   http://www.boost.org/LICENSE_1_0.txt)
7#==============================================================================
8
9#!/usr/bin/env bash
10set -e
11
12# Change to the quickbook root directory
13cd $(dirname $0)
14cd ..
15
16# Git settings
17remote=git@github.com:boostorg/quickbook.git
18branch=gh-pages
19
20main() {
21    git fetch "$remote" "$branch:$branch"
22    b2 -aq doc//fully-standalone
23    write_fast_import gh-pages | git fast-import --date-format=now --quiet
24    git push "$remote" "$branch"
25}
26
27write_fast_import() {
28    committer="$(git config user.name) <$(git config user.email)>"
29    commit_message="Rebuild documentation"
30    branch=$1
31
32    # Start commit
33    echo "commit refs/heads/${branch}"
34    echo "committer ${committer} now"
35    echo "data ${#commit_message}"
36    echo $commit_message
37    echo "from ${branch}"
38    echo "merge HEAD"
39
40    # Delete everything and rebuild tree from scratch.
41    echo "deleteall"
42
43    # Copy all files from HEAD
44    git ls-tree -r HEAD |
45    while read mode type hash path ; do
46        echo "M $mode $hash $path"
47    done
48
49    # Preserve index.html from the github pages branch
50    git ls-tree $branch -- index.html |
51    while read mode type hash path ; do
52        echo "M $mode $hash $path"
53    done
54
55    # Check in documentation
56    find doc/html -type f | while read path; do
57        size=$(wc -c "$path")
58        echo "M 100644 inline $path"
59        echo "data $size"
60        cat "$path"
61        echo
62    done
63}
64
65main