To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / extra / soundsoftware / extract-matlabdocs.sh @ 435:897979555864
History | View | Annotate | Download (998 Bytes)
| 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 |
|