comparison extra/soundsoftware/extract-matlabdocs.sh @ 411:e7ba81c8dc5a feature_113

Add the MATLAB doc extractor to the general doc extraction script
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Thu, 28 Apr 2011 13:29:15 +0100
parents
children
comparison
equal deleted inserted replaced
410:675de8e6becf 411:e7ba81c8dc5a
1 #!/bin/bash
2
3 docdir="/var/doc"
4
5 progdir=$(dirname $0)
6 case "$progdir" in
7 /*) ;;
8 *) progdir="$(pwd)/$progdir" ;;
9 esac
10
11 project="$1"
12 projectdir="$2"
13 targetdir="$3"
14
15 if [ -z "$project" ] || [ -z "$targetdir" ] || [ -z "$projectdir" ]; then
16 echo "Usage: $0 <project> <projectdir> <targetdir>"
17 exit 2
18 fi
19
20 if [ ! -d "$projectdir" ]; then
21 echo "Project directory $projectdir not found"
22 exit 1
23 fi
24
25 if [ ! -d "$targetdir" ]; then
26 echo "Target dir $targetdir not found"
27 exit 1
28 fi
29
30 if [ -f "$targetdir/index.html" ]; then
31 echo "Target dir $targetdir already contains index.html"
32 exit 1
33 fi
34
35 mfile=$(find "$projectdir" -type f -name \*.m -print0 | xargs -0 grep -l '^% ' | head -1)
36
37 if [ -z "$mfile" ]; then
38 echo "No MATLAB files with comments found for project $project"
39 exit 1
40 fi
41
42 echo "Project $project contains at least one MATLAB file with comments"
43
44 cd "$projectdir" || exit 1
45
46 perl "$progdir/matlab-docs.pl" -c "$progdir/matlab-docs.conf" -d "$targetdir"
47