Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Side by Side Diff: git_docs/make_docs.sh

Issue 196133007: Add git_docs folder to depot_tools. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: more doc stuff, depot_tools can now go on manpath Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #!/bin/bash -e
2 shopt -s nullglob
3
4 cd $(dirname "$0")
5
6 # Script which takes all the asciidoc git-*.txt files in this directory, renders
7 # them to html + manpage format using git 1.9's doc toolchain, then installs
agable 2014/03/13 17:23:31 "... then puts them in depot_tools to be committed
iannucci 2014/03/13 18:17:43 Done.
8 # them in depot_tools.
9
10 ensure_in_path() {
11 local CMD=$1
12 local PTH=$(which "$CMD")
13 if [[ ! $PTH ]]
14 then
15 echo Must have "$CMD" on your PATH!
16 exit 1
17 else
18 echo Using \'$PTH\' for ${CMD}.
19 fi
20 }
21
22 ensure_in_path xmlto
23 ensure_in_path asciidoc
24
25 DFLT_CATALOG_PATH="/usr/local/etc/xml/catalog"
26 if [[ ! $XML_CATALOG_FILES && -f "$DFLT_CATALOG_PATH" ]]
27 then
28 # Default if you install doctools with homebrew on mac
29 export XML_CATALOG_FILES="$DFLT_CATALOG_PATH"
30 echo Using \'$DFLT_CATALOG_PATH\' for \$XML_CATALOG_FILES.
31 fi
32
33 # We pull git to get its documentation toolchain
34 BRANCH=v1.9.0
35 GITHASH=5f95c9f850b19b368c43ae399cc831b17a26a5ac
36 if [[ ! -d git || $(git -C git rev-parse HEAD) != $GITHASH ]]
37 then
38 echo Cloning git
39 rm -rf git
40 git clone --single-branch --branch $BRANCH --depth 1 \
41 https://kernel.googlesource.com/pub/scm/git/git.git 2> /dev/null
42
43 ed git/Documentation/asciidoc.conf <<EOF
agable 2014/03/13 17:23:31 aww yisss ed
iannucci 2014/03/13 18:17:43 :D
44 H
45 81
46 s/Git/depot_tools
47 +2
48 s/Git Manual/chromium depot_tools Manual
agable 2014/03/13 17:23:31 Chromium
iannucci 2014/03/13 18:17:43 Done.
49 wq
50 EOF
51 fi
52 echo Git up to date at $GITHASH \($BRANCH\)
53
54 HTML_TARGETS=()
55 MAN_TARGETS=()
56 for x in *.txt
57 do
58 TO="git/Documentation/$x"
59 if [[ ! -f "$TO" ]] || ! cmp --silent "$x" "$TO"
60 then
61 echo \'$x\' differs
62 cp $x "$TO"
63 fi
64 # Exclude files beginning with _ from the target list. This is useful to have
65 # includable snippet files.
66 if [[ ${x:0:1} != _ ]]
67 then
68 HTML_TARGETS+=("${x%%.txt}.html")
69 MAN_TARGETS+=("${x%%.txt}.1")
70 fi
71 done
72
73 VER="v$(git rev-parse --short HEAD)"
74 if [[ ! -f git/version ]] || ! cmp --silent git/version <(echo "$VER")
75 then
76 echo Version changed, cleaning.
77 echo "$VER" > git/version
78 (cd git/Documentation && make clean)
79 fi
80
81 # This export is so that asciidoc sys snippets which invoke git run relative to
82 # depot_tools instead of the git clone.
83 (
84 export GIT_DIR="$(git rev-parse --git-dir)" &&
85 cd git/Documentation &&
86 make -j"$[${#MAN_TARGETS} + ${#HTML_TARGETS}]" "${MAN_TARGETS[@]}" "${HTML_TAR GETS[@]}"
87 )
88
89 mkdir htmlout 2> /dev/null || true
90 for x in "${HTML_TARGETS[@]}"
91 do
92 echo Copying htmlout/$x
93 cp "git/Documentation/$x" htmlout
94 done
95
96 for x in "${MAN_TARGETS[@]}"
97 do
98 echo Copying ../man1/$x
99 cp "git/Documentation/$x" ../man1
100 done
OLDNEW
« git_docs/git-freeze.txt ('K') | « git_docs/git-thaw.txt ('k') | man1/git-freeze.1 » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698