Script to generate API documentation and send it to sf.net.
[synfig.git] / autobuild / api.sh
1 #!/bin/sh
2 #
3 # Script to generate API documentation and send it to sf.net
4 #
5 # Copyright 2009 Konstantin Dmitriev
6 #
7 # This program is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU General Public License as
9 # published by the Free Software Foundation; either version 2 of
10 # the License, or (at your option) any later version.
11
12 USERNAME=your_username #set this to your sf.net username to publish api 
13                                            #(you need privilegies for that)
14
15 export HTMLDIR=~/synfig/api/html
16 export SOURCEDIR=~/synfig/api/source
17
18 set -e
19
20 if [ ! -d $SOURCEDIR ]; then
21         mkdir -p `dirname $SOURCEDIR`
22         cd `dirname $SOURCEDIR`
23         git clone git://synfig.git.sourceforge.net/gitroot/synfig `basename $SOURCEDIR`
24 fi
25
26 getversion(){
27         VERSION=`cat configure| egrep PACKAGE_VERSION=\'`
28         VERSION=${VERSION#*\'}
29         VERSION=${VERSION%\'}
30 }
31
32 mkdir -p $HTMLDIR
33
34 cd $SOURCEDIR
35 git fetch
36 git checkout remotes/origin/master
37
38 for module in ETL synfig-core synfig-studio; do
39 cd $module/trunk
40 autoreconf --install --force || sed -i 's/^AC_CONFIG_SUBDIRS/# AC_CONFIG_SUBDIRS/' && autoreconf --install --force
41 getversion
42 cp -f doxygen.cfg.in doxygen.cfg
43 sed -i "s/@VERSION@/$VERSION/" doxygen.cfg
44 sed -i "s/@PACKAGE@/$module/" doxygen.cfg
45 doxygen doxygen.cfg
46 rm -rf $HTMLDIR/$module
47 mv doc/html $HTMLDIR/$module
48 cp $SOURCEDIR/$module/trunk/doxygen.cfg $HTMLDIR/$module
49 cd ../..
50 done
51
52 #index.html
53 DATE=`date -R`
54 cat > $HTMLDIR/index.html <<EOF
55 <html><head><title>ETL, synfig, synfigstudio API docs</title></head>
56 <body>
57 <h1>ETL, synfig, synfigstudio API docs</h1>
58 <ul>
59 <li><a href="ETL/">ETL</a></li>
60 <li><a href="synfig/">synfig</a></li>
61 <li><a href="synfigstudio/">synfigstudio</a></li>
62 </ul>
63 <p>Generated on: $DATE.</p>
64 </body></html>
65 EOF
66
67 #beep (because we asking password)
68 echo -e "\a"; sleep 0.2; echo -e "\a"; sleep 0.2; echo -e "\a"
69
70 #push to sf.net
71 rsync -avP -e ssh $HTMLDIR/ $USERNAME,synfig@web.sourceforge.net:htdocs/api/
72