X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=build%2Fmakedocs.sh;h=955c58cf0e29780c2c0b90658c4ccbeccfe0c2b9;hp=2f7f5734506b1517c9abe8d4c3f49923d7de6592;hb=6c72dec7e520bf9bef18b5db8656532278bcac26;hpb=8c3ee6f9b7e5ab0b4edbf4838c7c1a9ee6d7df5d;ds=sidebyside diff --git a/build/makedocs.sh b/build/makedocs.sh index 2f7f57345..955c58cf0 100755 --- a/build/makedocs.sh +++ b/build/makedocs.sh @@ -1,2 +1,21 @@ -luadoc -d $2 --no-files $(for f in $(find $1 -name '*.lua' -type f); do if grep -q -- "@return" $f; then echo $f; fi; done) -echo API-Documentation was created in $2. +#!/bin/bash + +topdir=$(pwd) + +[ -f "$topdir/build/makedocs.sh" -a -n "$1" ] || { + echo "Please execute as ./build/makedocs.sh [output directory]" >&2 + exit 1 +} + +outdir=$(readlink -f "$1") + +mkdir -p "$outdir" || { + echo "Unable to mkdir '$outdir'" >&2 + exit 1 +} + +( + cd "$topdir/build/luadoc/" + find "$topdir/libs/" "$topdir/modules/" -type f -name '*.lua' -or -name '*.luadoc' | \ + xargs grep -l '@return' | xargs ./doc.lua --no-files -d "$outdir" +)