Crombie Tools
generatedocs.sh
Go to the documentation of this file.
1 #!/bin/bash
2 
3 ##
4 # @file generatedocs.sh
5 #
6 # Generates Doxygen files if doxygen is installed.
7 # If the user is me (dabercro), also has a subcommand `copy`
8 # to copy the resulting files to CERN's AFS space.
9 #
10 # @author Daniel Abercrombie
11 #
12 
13  copy=$1
14 where=$2
15 
16 if [ `which doxygen 2> /dev/null` != "" ]
17 then
18 
19  here=`pwd`
20  cd $CROMBIEPATH
21 
22  pdfName=CrombieToolsManual.pdf
23 
24  compareFile=docs/html/index.html
25 
26  echo "Comparing age to $compareFile"
27  echo "Newer files:"
28 
29  if [ ! -f $compareFile -o $(find `git ls-files` -newer $compareFile | wc -l) -ne 0 ]
30  then
31 
32  echo $(find `git ls-files` -newer $compareFile)
33  echo "Making documentation."
34 
35  doxygen docs/CrombieDocs.cfg &> /dev/null # If newer files exist, create the documentation
36 
37  if [ "$copy" != "test" ] # If testing, just make the html
38  then # otherwise, make the LaTeX manual too
39 
40  echo "Making .pdf reference"
41  cd docs/latex
42  make &> /dev/null && mv refman.pdf $pdfName
43  cd - &> /dev/null
44 
45  fi
46 
47  if [ `cat doxygen.log | wc -l` -eq 4 ] # If the doxygen.log only has image warnings, remove it.
48  then # Otherwise, leave it for reading warnings
49 
50  rm doxygen.log
51 
52  fi
53 
54  else
55 
56  echo "None found"
57 
58  fi
59 
60  if [ "$USER" = "dabercro" ] && [ "$copy" = "copy" ] # If I am me, can copy to the appropriate server
61  then
62 
63  case $where in
64  lxplus) # The official location linked to on GitHub
65  targetHost=lxplus.cern.ch
66  targetDir=/afs/cern.ch/user/d/dabercro/www/CrombieToolsDocs
67  ;;
68  athena)
69  targetHost=athena.dialup.mit.edu
70  targetDir=/afs/athena.mit.edu/user/d/a/dabercro/www/CrombieToolsDocs
71  ;;
72  *) # Default location, because passwordless
73  targetHost=t3desk003.mit.edu
74  targetDir=/home/dabercro/public_html/CrombieToolsDocs
75  ;;
76  esac
77 
78  if [ `which gtar 2> /dev/null` = "" ] # Macs use BSD tar by default, so I've installed gtar
79  then
80  useTar=tar
81  else
82  useTar=gtar
83  fi
84 
85  echo "Copying documentation to $targetHost." # Stream tar over ssh and untar at server
86  $useTar -czf - docs/html/* docs/latex/$pdfName test/docs/*.pdf |
87  ssh $targetHost "mkdir -p $targetDir 2> /dev/null ; cd $targetDir ; rm -rf search ; tar -xzf - ; mv docs/html/* . ; mv docs/latex/$pdfName . ; mv test/docs/*.pdf ."
88 
89  fi
90 
91  cd $here
92 
93 else # If doxygen is not installed on system,
94  # give user some info on doxygen installation
95  echo "You need the 'doxygen' package to"
96  echo "generate the documentation."
97  echo "See this page for more information:"
98  echo ""
99  echo "http://www.stack.nl/~dimitri/doxygen/"
100  echo ""
101  echo "You will also need the graphviz package"
102  echo "to use the configuration as is:"
103  echo ""
104  echo "http://www.graphviz.org/"
105  echo ""
106  echo "If you don't want to install these, check out the main page of my documentation here:"
107  echo ""
108  echo "http://t3serv001.mit.edu/~dabercro/CrombieToolsDocs/"
109  echo ""
110 
111 fi