LEFT | RIGHT |
(no file at all) | |
1 #!/usr/bin/env bash | 1 #!/usr/bin/env bash |
2 | 2 |
3 # Copyright 2011 The Go Authors. All rights reserved. | 3 # Copyright 2011 The Go Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style | 4 # Use of this source code is governed by a BSD-style |
5 # license that can be found in the LICENSE file. | 5 # license that can be found in the LICENSE file. |
6 | 6 |
7 # This script creates the .zip, index, and configuration files for running | 7 # This script creates the .zip, index, and configuration files for running |
8 # godoc on app-engine. | 8 # godoc on app-engine. |
9 # | 9 # |
10 # If an argument is provided it is assumed to be the app-engine godoc directory. | 10 # If an argument is provided it is assumed to be the app-engine godoc directory. |
(...skipping 26 matching lines...) Expand all Loading... |
37 error "APPDIR not set, and no argument provided" | 37 error "APPDIR not set, and no argument provided" |
38 fi | 38 fi |
39 APPDIR=$1 | 39 APPDIR=$1 |
40 echo "APPDIR not set, using argument instead" | 40 echo "APPDIR not set, using argument instead" |
41 fi | 41 fi |
42 ········ | 42 ········ |
43 # safety checks | 43 # safety checks |
44 if [ ! -d $GOROOT ]; then | 44 if [ ! -d $GOROOT ]; then |
45 error "$GOROOT is not a directory" | 45 error "$GOROOT is not a directory" |
46 fi | 46 fi |
47 » if [ ! -x $GOROOT/src/cmd/godoc/godoc ]; then | 47 » if [ ! -x $GOROOT/bin/godoc ]; then |
48 » » error "$GOROOT/src/cmd/godoc/godoc does not exist or is not exec
utable" | 48 » » error "$GOROOT/bin/godoc does not exist or is not executable" |
49 fi | 49 fi |
50 if [ ! -d $APPDIR ]; then | 50 if [ ! -d $APPDIR ]; then |
51 error "$APPDIR is not a directory" | 51 error "$APPDIR is not a directory" |
52 fi | 52 fi |
53 if [ ! -e $APPDIR/app.yaml ]; then | 53 if [ ! -e $APPDIR/app.yaml ]; then |
54 error "$APPDIR is not an app-engine directory; missing file app.
yaml" | 54 error "$APPDIR is not an app-engine directory; missing file app.
yaml" |
55 fi | 55 fi |
56 if [ ! -d $APPDIR/godoc ]; then | 56 if [ ! -d $APPDIR/godoc ]; then |
57 error "$APPDIR is missing directory godoc" | 57 error "$APPDIR is missing directory godoc" |
58 fi | 58 fi |
59 | 59 |
60 # reporting | 60 # reporting |
61 echo "GOROOT = $GOROOT" | 61 echo "GOROOT = $GOROOT" |
62 echo "APPDIR = $APPDIR" | 62 echo "APPDIR = $APPDIR" |
63 } | 63 } |
64 | 64 |
65 cleanup() { | 65 cleanup() { |
66 echo "*** cleanup $APPDIR" | 66 echo "*** cleanup $APPDIR" |
67 rm $APPDIR/$ZIPFILE | 67 rm $APPDIR/$ZIPFILE |
68 rm $APPDIR/$INDEXFILE | 68 rm $APPDIR/$INDEXFILE |
69 rm $APPDIR/$SPLITFILES* | 69 rm $APPDIR/$SPLITFILES* |
70 rm $APPDIR/$CONFIGFILE | 70 rm $APPDIR/$CONFIGFILE |
71 } | 71 } |
72 | 72 |
73 makeZipfile() { | 73 makeZipfile() { |
74 echo "*** make $APPDIR/$ZIPFILE" | 74 echo "*** make $APPDIR/$ZIPFILE" |
75 » zip -q -r $APPDIR/$ZIPFILE $GOROOT -i \*.go -i \*.html -i \*.css -i \*.j
s -i \*.txt -i \*.c -i \*.h -i \*.s -i \*.png -i \*.jpg -i \*.sh -i \*.ico | 75 » zip -q -r $APPDIR/$ZIPFILE $GOROOT -i \*.go -i \*.html -i \*.xml -i \*.c
ss -i \*.js -i \*.txt -i \*.c -i \*.h -i \*.s -i \*.png -i \*.jpg -i \*.sh -i \*
.ico |
76 } | 76 } |
77 | 77 |
78 makeIndexfile() { | 78 makeIndexfile() { |
79 echo "*** make $APPDIR/$INDEXFILE" | 79 echo "*** make $APPDIR/$INDEXFILE" |
80 OUT=/tmp/godoc.out | 80 OUT=/tmp/godoc.out |
81 » $GOROOT/src/cmd/godoc/godoc -write_index -index_files=$APPDIR/$INDEXFILE
-zip=$APPDIR/$ZIPFILE 2> $OUT | 81 » $GOROOT/bin/godoc -write_index -index_files=$APPDIR/$INDEXFILE -zip=$APP
DIR/$ZIPFILE 2> $OUT |
82 if [ $? != 0 ]; then | 82 if [ $? != 0 ]; then |
83 » » error "$GOROOT/src/cmd/godoc/godoc failed - see $OUT for details
" | 83 » » error "$GOROOT/bin/godoc failed - see $OUT for details" |
84 fi | 84 fi |
85 } | 85 } |
86 | 86 |
87 splitIndexfile() { | 87 splitIndexfile() { |
88 echo "*** split $APPDIR/$INDEXFILE" | 88 echo "*** split $APPDIR/$INDEXFILE" |
89 split -b8m $APPDIR/$INDEXFILE $APPDIR/$SPLITFILES | 89 split -b8m $APPDIR/$INDEXFILE $APPDIR/$SPLITFILES |
90 } | 90 } |
91 | 91 |
92 makeConfigfile() { | 92 makeConfigfile() { |
93 echo "*** make $APPDIR/$CONFIGFILE" | 93 echo "*** make $APPDIR/$CONFIGFILE" |
(...skipping 18 matching lines...) Expand all Loading... |
112 } | 112 } |
113 | 113 |
114 getArgs "$@" | 114 getArgs "$@" |
115 cleanup | 115 cleanup |
116 makeZipfile | 116 makeZipfile |
117 makeIndexfile | 117 makeIndexfile |
118 splitIndexfile | 118 splitIndexfile |
119 makeConfigfile | 119 makeConfigfile |
120 | 120 |
121 echo "*** setup complete" | 121 echo "*** setup complete" |
LEFT | RIGHT |