mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-01 21:36:42 +00:00
Use single script to generate Lua doc
This commit is contained in:
parent
80adcf3c88
commit
0f95a303ef
6 changed files with 60 additions and 67 deletions
|
@ -24,3 +24,8 @@ RUN cd /tmp && \
|
||||||
luarocks pack openmwluadocumentor-0.1.1-1.rockspec && \
|
luarocks pack openmwluadocumentor-0.1.1-1.rockspec && \
|
||||||
luarocks install openmwluadocumentor-0.1.1-1.src.rock && \
|
luarocks install openmwluadocumentor-0.1.1-1.src.rock && \
|
||||||
rm /tmp/openmwluadocumentor-0.1.1-1.rockspec /tmp/openmwluadocumentor-0.1.1-1.src.rock
|
rm /tmp/openmwluadocumentor-0.1.1-1.rockspec /tmp/openmwluadocumentor-0.1.1-1.src.rock
|
||||||
|
|
||||||
|
VOLUME /openmw
|
||||||
|
|
||||||
|
ENV DOCS_SOURCE_DIR=/openmw/docs/source
|
||||||
|
ENV DOCUMENTOR_PATH=/usr/local/bin/openmwluadocumentor
|
||||||
|
|
|
@ -14,5 +14,5 @@ docker build -f docs/source/Dockerfile.luadoc -t openmw.luadoc docs/source
|
||||||
Run following command from OpenMW source directory to generate HTML pages:
|
Run following command from OpenMW source directory to generate HTML pages:
|
||||||
```bash
|
```bash
|
||||||
docker run --rm --tty --interactive --user "$(id -u)":"$(id -g)" \
|
docker run --rm --tty --interactive --user "$(id -u)":"$(id -g)" \
|
||||||
--volume "${PWD}":/openmw openmw.luadoc /openmw/docs/source/generate_luadoc_in_docker.sh
|
--volume "${PWD}":/openmw openmw.luadoc /openmw/docs/source/generate_luadoc.sh
|
||||||
```
|
```
|
||||||
|
|
|
@ -151,7 +151,11 @@ def setup(app):
|
||||||
app.add_stylesheet('figures.css')
|
app.add_stylesheet('figures.css')
|
||||||
app.add_stylesheet('luadoc.css')
|
app.add_stylesheet('luadoc.css')
|
||||||
try:
|
try:
|
||||||
subprocess.call(project_root + '/docs/source/generate_luadoc.sh')
|
# Assume we need to setup openmw-luadocumentor only when running this script in a Docker container because
|
||||||
|
# readthedocs pipeline runs there.
|
||||||
|
if os.path.exists('/.dockerenv'):
|
||||||
|
subprocess.check_call(os.path.join(project_root, 'docs/source/setup_openmw_luadocumentor.sh'))
|
||||||
|
subprocess.check_call(os.path.join(project_root, 'docs/source/generate_luadoc.sh'))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print('Can\'t generate Lua API documentation:', e)
|
print('Can\'t generate Lua API documentation:', e)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/bash -e
|
||||||
|
|
||||||
# How to install openmwluadocumentor:
|
# How to install openmwluadocumentor:
|
||||||
|
|
||||||
|
@ -20,52 +20,32 @@
|
||||||
# open "Git Bash" in the same directory and run script:
|
# open "Git Bash" in the same directory and run script:
|
||||||
# ./generate_luadoc.sh
|
# ./generate_luadoc.sh
|
||||||
|
|
||||||
if [ -f /.dockerenv ]; then
|
if [[ -z "${DOCS_SOURCE_DIR+x}" ]]; then
|
||||||
# We are inside readthedocs pipeline
|
DOCS_SOURCE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||||
echo "Install lua 5.1"
|
|
||||||
cd ~
|
|
||||||
curl -R -O https://www.lua.org/ftp/lua-5.1.5.tar.gz
|
|
||||||
tar -zxf lua-5.1.5.tar.gz
|
|
||||||
cd lua-5.1.5/
|
|
||||||
make linux
|
|
||||||
PATH=$PATH:~/lua-5.1.5/src
|
|
||||||
|
|
||||||
echo "Install luarocks"
|
|
||||||
cd ~
|
|
||||||
wget https://luarocks.org/releases/luarocks-2.4.2.tar.gz
|
|
||||||
tar zxpf luarocks-2.4.2.tar.gz
|
|
||||||
cd luarocks-2.4.2/
|
|
||||||
./configure --with-lua-bin=$HOME/lua-5.1.5/src --with-lua-include=$HOME/lua-5.1.5/src --prefix=$HOME/luarocks
|
|
||||||
make build
|
|
||||||
make install
|
|
||||||
PATH=$PATH:~/luarocks/bin
|
|
||||||
|
|
||||||
echo "Install openmwluadocumentor"
|
|
||||||
cd ~
|
|
||||||
git clone https://gitlab.com/ptmikheev/openmw-luadocumentor.git
|
|
||||||
cd openmw-luadocumentor/luarocks
|
|
||||||
luarocks --local pack openmwluadocumentor-0.1.1-1.rockspec
|
|
||||||
luarocks --local install openmwluadocumentor-0.1.1-1.src.rock
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
DOCS_SOURCE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
FILES_DIR="${DOCS_SOURCE_DIR:?}/../../files"
|
||||||
FILES_DIR=$DOCS_SOURCE_DIR/../../files
|
OUTPUT_DIR="${DOCS_SOURCE_DIR:?}/reference/lua-scripting/generated_html"
|
||||||
OUTPUT_DIR=$DOCS_SOURCE_DIR/reference/lua-scripting/generated_html
|
|
||||||
DOCUMENTOR_PATH=~/.luarocks/bin/openmwluadocumentor
|
|
||||||
|
|
||||||
if [ ! -x $DOCUMENTOR_PATH ]; then
|
if [[ -z "${DOCUMENTOR_PATH+x}" ]]; then
|
||||||
# running on Windows?
|
DOCUMENTOR_PATH=~/.luarocks/bin/openmwluadocumentor
|
||||||
DOCUMENTOR_PATH="$APPDATA/LuaRocks/bin/openmwluadocumentor.bat"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f $OUTPUT_DIR/*.html
|
if [ ! -x "${DOCUMENTOR_PATH:?}" ]; then
|
||||||
|
# running on Windows?
|
||||||
|
echo windows
|
||||||
|
DOCUMENTOR_PATH="${APPDATA:?}/LuaRocks/bin/openmwluadocumentor.bat"
|
||||||
|
fi
|
||||||
|
|
||||||
cd $FILES_DIR/lua_api
|
rm -rf "${OUTPUT_DIR:?}"
|
||||||
$DOCUMENTOR_PATH -f doc -d $OUTPUT_DIR openmw/*lua
|
mkdir "${OUTPUT_DIR:?}"
|
||||||
|
|
||||||
cd $FILES_DIR/data
|
cd "${FILES_DIR:?}/lua_api"
|
||||||
$DOCUMENTOR_PATH -f doc -d $OUTPUT_DIR openmw_aux/*lua
|
"${DOCUMENTOR_PATH:?}" -f doc -d "${OUTPUT_DIR:?}" openmw/*lua
|
||||||
$DOCUMENTOR_PATH -f doc -d $OUTPUT_DIR scripts/omw/ai.lua
|
|
||||||
$DOCUMENTOR_PATH -f doc -d $OUTPUT_DIR scripts/omw/camera/camera.lua
|
cd "${FILES_DIR:?}/data"
|
||||||
$DOCUMENTOR_PATH -f doc -d $OUTPUT_DIR scripts/omw/mwui/init.lua
|
"${DOCUMENTOR_PATH:?}" -f doc -d "${OUTPUT_DIR:?}" openmw_aux/*lua
|
||||||
$DOCUMENTOR_PATH -f doc -d $OUTPUT_DIR scripts/omw/settings/player.lua
|
"${DOCUMENTOR_PATH:?}" -f doc -d "${OUTPUT_DIR:?}" scripts/omw/ai.lua
|
||||||
|
"${DOCUMENTOR_PATH:?}" -f doc -d "${OUTPUT_DIR:?}" scripts/omw/camera/camera.lua
|
||||||
|
"${DOCUMENTOR_PATH:?}" -f doc -d "${OUTPUT_DIR:?}" scripts/omw/mwui/init.lua
|
||||||
|
"${DOCUMENTOR_PATH:?}" -f doc -d "${OUTPUT_DIR:?}" scripts/omw/settings/player.lua
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
#!/bin/bash -e
|
|
||||||
|
|
||||||
if ! [[ -f "/.dockerenv" ]]; then
|
|
||||||
echo "Run this script inside Docker container" >&2
|
|
||||||
exit -1
|
|
||||||
fi
|
|
||||||
|
|
||||||
FILES_DIR=/openmw/files
|
|
||||||
OUTPUT_DIR=/openmw/docs/source/reference/lua-scripting/generated_html
|
|
||||||
|
|
||||||
rm -rf "${OUTPUT_DIR}"
|
|
||||||
mkdir "${OUTPUT_DIR}"
|
|
||||||
|
|
||||||
cd "${FILES_DIR}/lua_api"
|
|
||||||
openmwluadocumentor -f doc -d "${OUTPUT_DIR}" openmw/*lua
|
|
||||||
|
|
||||||
cd "${FILES_DIR}/data"
|
|
||||||
openmwluadocumentor -f doc -d "${OUTPUT_DIR}" openmw_aux/*lua
|
|
||||||
openmwluadocumentor -f doc -d "${OUTPUT_DIR}" scripts/omw/ai.lua
|
|
||||||
openmwluadocumentor -f doc -d "${OUTPUT_DIR}" scripts/omw/camera/camera.lua
|
|
||||||
openmwluadocumentor -f doc -d "${OUTPUT_DIR}" scripts/omw/mwui/init.lua
|
|
||||||
openmwluadocumentor -f doc -d "${OUTPUT_DIR}" scripts/omw/settings/player.lua
|
|
26
docs/source/setup_openmw_luadocumentor.sh
Executable file
26
docs/source/setup_openmw_luadocumentor.sh
Executable file
|
@ -0,0 +1,26 @@
|
||||||
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
echo "Install lua 5.1"
|
||||||
|
cd ~
|
||||||
|
curl -R -O https://www.lua.org/ftp/lua-5.1.5.tar.gz
|
||||||
|
tar -zxf lua-5.1.5.tar.gz
|
||||||
|
cd lua-5.1.5/
|
||||||
|
make -j $(nproc) linux
|
||||||
|
PATH="${PATH:?}:~/lua-5.1.5/src"
|
||||||
|
|
||||||
|
echo "Install luarocks"
|
||||||
|
cd ~
|
||||||
|
wget https://luarocks.org/releases/luarocks-2.4.2.tar.gz
|
||||||
|
tar zxpf luarocks-2.4.2.tar.gz
|
||||||
|
cd luarocks-2.4.2/
|
||||||
|
./configure --with-lua-bin="${HOME:?}/lua-5.1.5/src" --with-lua-include="${HOME:?}/lua-5.1.5/src" --prefix="${HOME:?}/luarocks"
|
||||||
|
make -j $(nproc) build
|
||||||
|
make -j $(nproc) install
|
||||||
|
PATH="${PATH:?}:~/luarocks/bin"
|
||||||
|
|
||||||
|
echo "Install openmwluadocumentor"
|
||||||
|
cd ~
|
||||||
|
git clone --depth 1 https://gitlab.com/ptmikheev/openmw-luadocumentor.git
|
||||||
|
cd openmw-luadocumentor/luarocks
|
||||||
|
luarocks --local pack openmwluadocumentor-0.1.1-1.rockspec
|
||||||
|
luarocks --local install openmwluadocumentor-0.1.1-1.src.rock
|
Loading…
Reference in a new issue