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

Side by Side Diff: docs/src/make_docs.sh

Issue 225433003: Add a basic tutorial for the tools in depot_tools. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@git_map
Patch Set: pylint Created 6 years, 8 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
« no previous file with comments | « docs/src/git-squash-branch.demo.1.sh ('k') | docs/src/prep_demo_repo.sh » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash -e 1 #!/bin/bash -e
2 shopt -s nullglob 2 shopt -s nullglob
3 3
4 cd $(dirname "$0") 4 cd $(dirname "$0")
5 5
6 # Script which takes all the asciidoc git-*.txt files in this directory, renders 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 puts 7 # them to html + manpage format using git 1.9's doc toolchain, then puts
8 # them in depot_tools to be committed. 8 # them in depot_tools to be committed.
9 9
10 ensure_in_path() { 10 ensure_in_path() {
(...skipping 23 matching lines...) Expand all
34 ASCIIDOC_HASH=7fed0aff1b30 34 ASCIIDOC_HASH=7fed0aff1b30
35 if [[ ! -d asciidoc || $(cd asciidoc && hg id -i) != $ASCIIDOC_HASH ]] 35 if [[ ! -d asciidoc || $(cd asciidoc && hg id -i) != $ASCIIDOC_HASH ]]
36 then 36 then
37 echo Cloning asciidoc 37 echo Cloning asciidoc
38 rm -rf asciidoc 38 rm -rf asciidoc
39 hg clone -r $BRANCH https://asciidoc.googlecode.com/hg/ asciidoc 39 hg clone -r $BRANCH https://asciidoc.googlecode.com/hg/ asciidoc
40 (cd asciidoc && ln -s asciidoc.py asciidoc) 40 (cd asciidoc && ln -s asciidoc.py asciidoc)
41 fi 41 fi
42 echo Asciidoc up to date at $ASCIIDOC_HASH \($BRANCH\) 42 echo Asciidoc up to date at $ASCIIDOC_HASH \($BRANCH\)
43 43
44 export PATH=`pwd`/asciidoc:$PATH 44 # We pull ansi2hash to convert demo script output
45 BRANCH=1.0.6
46 ANSI2HTML_HASH=6282ab7a24a5a7eab2e0b23bb0055234c533a6e9
47 if [[ ! -d ansi2html || $(git -C ansi2html rev-parse HEAD) != $ANSI2HTML_HASH ]]
48 then
49 echo Cloning ansi2html
50 rm -rf ansi2html
51 git clone --single-branch --branch $BRANCH --depth 1 \
52 https://github.com/ralphbean/ansi2html.git 2> /dev/null
53 curl https://bitbucket.org/gutworth/six/raw/a875ac34c777fe801569c6c5299bf1a35a a578cd/six.py > \
54 ansi2html/ansi2html/six.py
55 ed ansi2html/ansi2html/converter.py <<EOF
56 /version_str
57 s/pkg.*$/'cool version bro'
58 wq
59 EOF
60 fi
61
62 echo ansi2html up to date at $ANSI2HTML_HASH \($BRANCH\)
45 63
46 # We pull git to get its documentation toolchain 64 # We pull git to get its documentation toolchain
47 BRANCH=v1.9.0 65 BRANCH=v1.9.0
48 GITHASH=5f95c9f850b19b368c43ae399cc831b17a26a5ac 66 GITHASH=5f95c9f850b19b368c43ae399cc831b17a26a5ac
49 if [[ ! -d git || $(git -C git rev-parse HEAD) != $GITHASH ]] 67 if [[ ! -d git || $(git -C git rev-parse HEAD) != $GITHASH ]]
50 then 68 then
51 echo Cloning git 69 echo Cloning git
52 rm -rf git 70 rm -rf git
53 git clone --single-branch --branch $BRANCH --depth 1 \ 71 git clone --single-branch --branch $BRANCH --depth 1 \
54 https://kernel.googlesource.com/pub/scm/git/git.git 2> /dev/null 72 https://kernel.googlesource.com/pub/scm/git/git.git 2> /dev/null
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 j 116 j
99 /^\$(MAN_HTML): 117 /^\$(MAN_HTML):
100 a 118 a
101 asciidoc-override.css 119 asciidoc-override.css
102 . 120 .
103 -1 121 -1
104 j 122 j
105 wq 123 wq
106 EOF 124 EOF
107 125
126 cat >> git/Documentation/asciidoc.conf <<EOF
127
128 [macros]
129 (?su)[\\\\]?(?P<name>demo):(?P<target>\S*?)\[\]=
130
131 [demo-inlinemacro]
132 {sys3:cd $(pwd); ./{docname}.demo.{target}.sh | python filter_demo_output.py {ba ckend} }
133 EOF
134
108 fi 135 fi
109 echo Git up to date at $GITHASH \($BRANCH\) 136 echo Git up to date at $GITHASH \($BRANCH\)
110 137
138 if [[ ! -d demo_repo ]]
139 then
140 ./prep_demo_repo.sh
141 fi
142
111 # build directory files for 'essential' and 'helper' sections of the depot_tools 143 # build directory files for 'essential' and 'helper' sections of the depot_tools
112 # manpage. 144 # manpage.
113 for category in helper essential 145 for category in helper essential
114 do 146 do
115 { 147 {
116 PRINTED_BANNER=0 148 PRINTED_BANNER=0
117 for x in *.${category}.txt 149 for x in *.${category}.txt
118 do 150 do
119 # If we actually have tools in the category, print the banner first. 151 # If we actually have tools in the category, print the banner first.
120 if [[ $PRINTED_BANNER != 1 ]] 152 if [[ $PRINTED_BANNER != 1 ]]
121 then 153 then
122 PRINTED_BANNER=1 154 PRINTED_BANNER=1
123 # ex. 155 # ex.
124 # CATEGORY TOOLS 156 # CATEGORY TOOLS
125 # -------------- 157 # --------------
126 BANNER=$(echo $category tools | awk '{print toupper($0)}') 158 BANNER=$(echo $category tools | awk '{print toupper($0)}')
127 echo $BANNER 159 echo $BANNER
128 for i in $(seq 1 ${#BANNER}) 160 for i in $(seq 1 ${#BANNER})
129 do 161 do
130 echo -n - 162 echo -n -
131 done 163 done
132 echo 164 echo
165 cat _${category}_prefix.txt 2> /dev/null || true
133 echo 166 echo
134 fi 167 fi
135 168
136 # ex. 169 # ex.
137 # linkgit:git-tool[1]:: 170 # linkgit:git-tool[1]::
138 # \tinclude::_git-tool_desc.category.txt[] 171 # \tinclude::_git-tool_desc.category.txt[]
139 PLAIN_PATH=${x%%_desc.*.txt} 172 PLAIN_PATH=${x%%_desc.*.txt}
140 PLAIN_PATH=${PLAIN_PATH:1} 173 PLAIN_PATH=${PLAIN_PATH:1}
141 echo "linkgit:$PLAIN_PATH[1]::" 174 echo "linkgit:$PLAIN_PATH[1]::"
142 echo -e "include::${x}[]" 175 echo -e "include::${x}[]"
143 echo 176 echo
144 done 177 done
145 } > __${category}.txt 178 } > __${category}.txt
146 done 179 done
147 180
148 JOBS=0 181 JOBS=1
149 HTML_TARGETS=() 182 HTML_TARGETS=()
150 MAN_TARGETS=() 183 MAN1_TARGETS=()
184 MAN7_TARGETS=()
151 for x in *.txt *.css 185 for x in *.txt *.css
152 do 186 do
153 TO="git/Documentation/$x" 187 TO="git/Documentation/$x"
154 if [[ ! -f "$TO" ]] || ! cmp --silent "$x" "$TO" 188 if [[ ! -f "$TO" ]] || ! cmp --silent "$x" "$TO"
155 then 189 then
156 echo \'$x\' differs 190 echo \'$x\' differs
157 cp $x "$TO" 191 cp $x "$TO"
158 fi 192 # Exclude files beginning with _ from the target list. This is useful to
159 # Exclude files beginning with _ from the target list. This is useful to have 193 # have includable snippet files.
160 # includable snippet files. 194 if [[ ${x:0:1} != _ && ${x:(-4)} == .txt ]]
161 if [[ ${x:0:1} != _ && ${x:(-4)} == .txt ]]
162 then
163 HTML_TARGETS+=("${x%%.txt}.html")
164 if [[ ${x:0:3} == git ]]
165 then 195 then
166 MAN1_TARGETS+=("${x%%.txt}.1") 196 HTML_TARGETS+=("${x%%.txt}.html")
167 else 197 if [[ ! "$NOMAN" ]]
168 MAN7_TARGETS+=("${x%%.txt}.7") 198 then
199 if [[ ${x:0:3} == git ]]
200 then
201 MAN1_TARGETS+=("${x%%.txt}.1")
202 else
203 MAN7_TARGETS+=("${x%%.txt}.7")
204 fi
205 fi
206 JOBS=$[$JOBS + 2]
169 fi 207 fi
170 JOBS=$[$JOBS + 2]
171 fi 208 fi
172 done 209 done
173 210
211 if [[ ${#HTML_TARGETS} == 0 && ${#MAN1_TARGETS} == 0 && ${#MAN7_TARGETS} == 0 ]]
212 then
213 exit
214 fi
215
174 VER="v$(git rev-parse --short HEAD)" 216 VER="v$(git rev-parse --short HEAD)"
175 if [[ ! -f git/version ]] || ! cmp --silent git/version <(echo "$VER") 217 if [[ ! -f git/version ]] || ! cmp --silent git/version <(echo "$VER")
176 then 218 then
177 echo Version changed, cleaning. 219 echo Version changed, cleaning.
178 echo "$VER" > git/version 220 echo "$VER" > git/version
179 (cd git/Documentation && make clean) 221 (cd git/Documentation && make clean)
180 fi 222 fi
181 223
182 # This export is so that asciidoc sys snippets which invoke git run relative to 224 # This export is so that asciidoc sys snippets which invoke git run relative to
183 # depot_tools instead of the git clone. 225 # depot_tools instead of the git clone.
(...skipping 12 matching lines...) Expand all
196 for x in "${MAN1_TARGETS[@]}" 238 for x in "${MAN1_TARGETS[@]}"
197 do 239 do
198 echo Copying ../man1/$x 240 echo Copying ../man1/$x
199 cp "git/Documentation/$x" ../man1 241 cp "git/Documentation/$x" ../man1
200 done 242 done
201 243
202 for x in "${MAN7_TARGETS[@]}" 244 for x in "${MAN7_TARGETS[@]}"
203 do 245 do
204 echo Copying ../man7/$x 246 echo Copying ../man7/$x
205 cp "git/Documentation/$x" ../man7 247 cp "git/Documentation/$x" ../man7
206 done 248 done
OLDNEW
« no previous file with comments | « docs/src/git-squash-branch.demo.1.sh ('k') | docs/src/prep_demo_repo.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698