Mercurial > hg > soundsoftware-site
comparison extra/soundsoftware/extract-docs.sh @ 203:1e55195bca45 feature_20
Pull doc extractor script out into separate javadoc, doxygen, and controller scripts
author | Chris Cannam <chris.cannam@soundsoftware.ac.uk> |
---|---|
date | Mon, 07 Feb 2011 16:46:28 +0000 |
parents | |
children | 292cde42265a |
comparison
equal
deleted
inserted
replaced
191:0d1c6fa50d3a | 203:1e55195bca45 |
---|---|
1 #!/bin/bash | |
2 | |
3 # Run this script from anywhere | |
4 | |
5 # Enumerate Hg repos; make sure they're up to date; extract docs for | |
6 # each | |
7 | |
8 hgdir="/var/hg" | |
9 docdir="/var/doc" | |
10 | |
11 progdir=$(dirname $0) | |
12 case "$progdir" in | |
13 /*) ;; | |
14 *) progdir="$(pwd)/$progdir" ;; | |
15 esac | |
16 | |
17 types="javadoc doxygen" | |
18 | |
19 for x in $types; do | |
20 if [ ! -x "$progdir/extract-$x.sh" ]; then | |
21 echo "Helper script not available: $progdir/extract-$x.sh" | |
22 exit 1 | |
23 fi | |
24 done | |
25 | |
26 for projectdir in "$hgdir"/* ; do | |
27 | |
28 if [ -d "$projectdir" ] && [ -d "$projectdir/.hg" ]; then | |
29 | |
30 project=$(basename "$projectdir") | |
31 echo "Found Hg repo: $projectdir for project $project" | |
32 | |
33 ##!!! do as www-data: | |
34 ( cd "$projectdir" ; sudo -u www-data hg -q update ) || exit 1 | |
35 | |
36 tmpdir=$(mktemp -d "$docdir/tmp_XXXXXX") | |
37 | |
38 case "$tmpdir" in | |
39 /*) ;; | |
40 *) echo "Temporary directory creation failed"; exit 1;; | |
41 esac | |
42 | |
43 targetdir="$docdir/$project" | |
44 | |
45 echo "Temporary dir is $tmpdir, eventual target is $targetdir" | |
46 | |
47 ##!!! do as docs user: | |
48 for x in $types; do | |
49 if "$progdir/extract-$x.sh" "$project" "$tmpdir"; then | |
50 break | |
51 else | |
52 echo "Failed to extract via type $x" | |
53 fi | |
54 done | |
55 | |
56 if [ -f "$tmpdir/index.html" ]; then | |
57 echo "Processing resulted in an index.html being created, looks good!" | |
58 if [ ! -d "$targetdir" ] || [ ! -f "$targetdir/index.html" ]; then | |
59 # # If we have just written something to a doc directory that was | |
60 # # previously empty, we should switch on Embedded for this project | |
61 echo "This project hasn't had doc extracted before -- I should switch on Embedded for it at this point" | |
62 fi | |
63 | |
64 if [ -d "$targetdir" ]; then | |
65 mv "$targetdir" "$targetdir"_"$$" && \ | |
66 mv "$tmpdir" "$targetdir" && \ | |
67 rm -rf "$targetdir"_"$$" | |
68 else | |
69 echo "Processing resulted in no index.html, skipping" | |
70 mv "$tmpdir" "$targetdir" | |
71 fi | |
72 | |
73 else | |
74 # generated nothing (useful) | |
75 rm -rf "$tmpdir" | |
76 fi | |
77 fi | |
78 done | |
79 |