OLD | NEW |
---|---|
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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
123 # ex. | 123 # ex. |
124 # CATEGORY TOOLS | 124 # CATEGORY TOOLS |
125 # -------------- | 125 # -------------- |
126 BANNER=$(echo $category tools | awk '{print toupper($0)}') | 126 BANNER=$(echo $category tools | awk '{print toupper($0)}') |
127 echo $BANNER | 127 echo $BANNER |
128 for i in $(seq 1 ${#BANNER}) | 128 for i in $(seq 1 ${#BANNER}) |
129 do | 129 do |
130 echo -n - | 130 echo -n - |
131 done | 131 done |
132 echo | 132 echo |
133 cat _${category}_prefix.txt 2> /dev/null || true | |
133 echo | 134 echo |
134 fi | 135 fi |
135 | 136 |
136 # ex. | 137 # ex. |
137 # linkgit:git-tool[1]:: | 138 # linkgit:git-tool[1]:: |
138 # \tinclude::_git-tool_desc.category.txt[] | 139 # \tinclude::_git-tool_desc.category.txt[] |
139 PLAIN_PATH=${x%%_desc.*.txt} | 140 PLAIN_PATH=${x%%_desc.*.txt} |
140 PLAIN_PATH=${PLAIN_PATH:1} | 141 PLAIN_PATH=${PLAIN_PATH:1} |
141 echo "linkgit:$PLAIN_PATH[1]::" | 142 echo "linkgit:$PLAIN_PATH[1]::" |
142 echo -e "include::${x}[]" | 143 echo -e "include::${x}[]" |
143 echo | 144 echo |
144 done | 145 done |
145 } > __${category}.txt | 146 } > __${category}.txt |
146 done | 147 done |
147 | 148 |
148 JOBS=0 | 149 JOBS=1 |
149 HTML_TARGETS=() | 150 HTML_TARGETS=() |
150 MAN_TARGETS=() | 151 MAN_TARGETS=() |
151 for x in *.txt *.css | 152 for x in *.txt *.css |
152 do | 153 do |
153 TO="git/Documentation/$x" | 154 TO="git/Documentation/$x" |
154 if [[ ! -f "$TO" ]] || ! cmp --silent "$x" "$TO" | 155 if [[ ! -f "$TO" ]] || ! cmp --silent "$x" "$TO" |
155 then | 156 then |
156 echo \'$x\' differs | 157 echo \'$x\' differs |
157 cp $x "$TO" | 158 cp $x "$TO" |
158 fi | 159 # Exclude files beginning with _ from the target list. This is useful to hav e |
Ryan Tseng
2014/04/05 00:51:20
80 char
iannucci
2014/04/05 01:31:13
Done.
iannucci
2014/04/05 01:31:13
Done.
| |
159 # Exclude files beginning with _ from the target list. This is useful to have | 160 # includable snippet files. |
160 # includable snippet files. | 161 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 | 162 then |
166 MAN1_TARGETS+=("${x%%.txt}.1") | 163 HTML_TARGETS+=("${x%%.txt}.html") |
167 else | 164 if [[ ${x:0:3} == git ]] |
168 MAN7_TARGETS+=("${x%%.txt}.7") | 165 then |
166 MAN1_TARGETS+=("${x%%.txt}.1") | |
167 else | |
168 MAN7_TARGETS+=("${x%%.txt}.7") | |
169 fi | |
170 JOBS=$[$JOBS + 2] | |
169 fi | 171 fi |
170 JOBS=$[$JOBS + 2] | |
171 fi | 172 fi |
172 done | 173 done |
173 | 174 |
175 if [[ ${#HTML_TARGETS} == 0 && ${#MAN_TARGETS} == 0 ]] | |
176 then | |
177 exit | |
178 fi | |
179 | |
174 VER="v$(git rev-parse --short HEAD)" | 180 VER="v$(git rev-parse --short HEAD)" |
175 if [[ ! -f git/version ]] || ! cmp --silent git/version <(echo "$VER") | 181 if [[ ! -f git/version ]] || ! cmp --silent git/version <(echo "$VER") |
176 then | 182 then |
177 echo Version changed, cleaning. | 183 echo Version changed, cleaning. |
178 echo "$VER" > git/version | 184 echo "$VER" > git/version |
179 (cd git/Documentation && make clean) | 185 (cd git/Documentation && make clean) |
180 fi | 186 fi |
181 | 187 |
182 # This export is so that asciidoc sys snippets which invoke git run relative to | 188 # This export is so that asciidoc sys snippets which invoke git run relative to |
183 # depot_tools instead of the git clone. | 189 # depot_tools instead of the git clone. |
(...skipping 13 matching lines...) Expand all Loading... | |
197 do | 203 do |
198 echo Copying ../man1/$x | 204 echo Copying ../man1/$x |
199 cp "git/Documentation/$x" ../man1 | 205 cp "git/Documentation/$x" ../man1 |
200 done | 206 done |
201 | 207 |
202 for x in "${MAN7_TARGETS[@]}" | 208 for x in "${MAN7_TARGETS[@]}" |
203 do | 209 do |
204 echo Copying ../man7/$x | 210 echo Copying ../man7/$x |
205 cp "git/Documentation/$x" ../man7 | 211 cp "git/Documentation/$x" ../man7 |
206 done | 212 done |
OLD | NEW |