view extra/soundsoftware/extract-matlabdocs.sh @ 599:251b380117ce feature_227

Introduce a new latest_downloads plugin to manage active and shortcut for attachments. Add a table for attachment active/shortcut data. Move existing active-handler code into the new plugin (but still using the "old" active column in the attachments table). Note the files_controller stuff doesn't actually work here.
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Tue, 16 Aug 2011 17:01:19 +0100
parents e7ba81c8dc5a
children
line wrap: on
line source
#!/bin/bash

docdir="/var/doc"

progdir=$(dirname $0)
case "$progdir" in
    /*) ;;
    *) progdir="$(pwd)/$progdir" ;;
esac

project="$1"
projectdir="$2"
targetdir="$3"

if [ -z "$project" ] || [ -z "$targetdir" ] || [ -z "$projectdir" ]; then
    echo "Usage: $0 <project> <projectdir> <targetdir>"
    exit 2
fi

if [ ! -d "$projectdir" ]; then
    echo "Project directory $projectdir not found"
    exit 1
fi

if [ ! -d "$targetdir" ]; then
    echo "Target dir $targetdir not found"
    exit 1
fi

if [ -f "$targetdir/index.html" ]; then
    echo "Target dir $targetdir already contains index.html"
    exit 1
fi

mfile=$(find "$projectdir" -type f -name \*.m -print0 | xargs -0 grep -l '^% ' | head -1)

if [ -z "$mfile" ]; then
    echo "No MATLAB files with comments found for project $project"
    exit 1
fi

echo "Project $project contains at least one MATLAB file with comments"

cd "$projectdir" || exit 1

perl "$progdir/matlab-docs.pl" -c "$progdir/matlab-docs.conf" -d "$targetdir"