2023-02-11 11:21:00 +00:00
|
|
|
if [ -z "$LUAROCKS" ]; then
|
|
|
|
echo "Requires the LUAROCKS variable to be set to the luarocks/bin directory, e. g. `~/.luarocks/bin`"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
echo "Takes an absolute path to the output directory as the argument"
|
|
|
|
exit
|
|
|
|
fi
|
2023-01-27 18:53:10 +00:00
|
|
|
|
2023-01-26 22:31:27 +00:00
|
|
|
DOCS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
|
|
|
FILES_DIR=$(realpath $DOCS_DIR/../files)
|
2023-01-27 18:53:10 +00:00
|
|
|
OUTPUT_DIR=$1
|
|
|
|
DOCUMENTOR_PATH=$LUAROCKS/openmwluadocumentor
|
|
|
|
TEAL_PATH=$LUAROCKS/cyan
|
2023-01-26 22:31:27 +00:00
|
|
|
|
|
|
|
rm -rf $OUTPUT_DIR
|
|
|
|
mkdir $OUTPUT_DIR
|
|
|
|
cp "$DOCS_DIR/tlconfig.lua" "$OUTPUT_DIR/tlconfig.lua"
|
|
|
|
|
|
|
|
build_path() {
|
|
|
|
for file in $1
|
|
|
|
do
|
|
|
|
mkdir -p $OUTPUT_DIR/$(dirname $file)
|
|
|
|
$DOCUMENTOR_PATH -f teal -d "$OUTPUT_DIR" $file
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
cd $FILES_DIR
|
2023-01-27 18:53:10 +00:00
|
|
|
build_path "lua_api/openmw/*lua"
|
2023-01-26 22:31:27 +00:00
|
|
|
|
|
|
|
data_paths=$($DOCS_DIR/source/luadoc_data_paths.sh)
|
|
|
|
for path in $data_paths
|
|
|
|
do
|
2023-01-27 18:53:10 +00:00
|
|
|
build_path "data/$path"
|
2023-01-26 22:31:27 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
cd $OUTPUT_DIR
|
|
|
|
|
|
|
|
mv lua_api/openmw ./
|
|
|
|
rm -r lua_api
|
|
|
|
|
|
|
|
mv data/* ./
|
|
|
|
rm -r data
|
|
|
|
|
|
|
|
"$TEAL_PATH" check **/*.d.tl
|