Clean up lua docs scripts
- ldoc is now a git submodule
- ldoc can be installed using scripts/install.{sh,ps1}
- lua docs can be build using scripts/build.{sh,ps1}
- all lua docs-related files now reside inside of the docs folder
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
try {
|
||||
cd $PSScriptRoot/..
|
||||
|
||||
Remove-Item -Force -Recurse ./html | Out-Null
|
||||
New-Item -ItemType Directory ./html | Out-Null
|
||||
Copy-Item -Path ./css/. -Destination ./html -Recurse -Force | Out-Null
|
||||
Copy-Item -Path ./js/. -Destination ./html -Recurse -Force | Out-Null
|
||||
|
||||
if ((Get-Command "lua_modules/bin/ldoc" -ErrorAction SilentlyContinue) -eq $null) {
|
||||
echo "ldoc not found; please run docs/scripts/install.ps1"
|
||||
exit 1
|
||||
}
|
||||
|
||||
lua_modules/bin/ldoc .
|
||||
} finally {
|
||||
popd
|
||||
}
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
|
||||
cd "$DIR/.."
|
||||
|
||||
ldoc_path=./lua_modules/bin/ldoc
|
||||
|
||||
if [[ ! -x "$ldoc_path" ]]; then
|
||||
echo "ldoc not found; please run docs/scripts/install.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -rf ./html
|
||||
mkdir ./html
|
||||
|
||||
cp -r ./js/. ./html
|
||||
cp -r ./css/. ./html
|
||||
|
||||
"$ldoc_path" .
|
||||
@@ -0,0 +1,41 @@
|
||||
try {
|
||||
cd $PSScriptRoot/..
|
||||
|
||||
$lua_binary = $env:LUA_BINARY
|
||||
if ($lua_binary -eq $null) {
|
||||
$lua_binary = "lua"
|
||||
}
|
||||
|
||||
if ((Get-Command "$lua_binary" -ErrorAction SilentlyContinue) -eq $null) {
|
||||
if ($env:LUA_BINARY -eq $null) {
|
||||
echo "lua binary not found; please set `$LUA_BINARY manually."
|
||||
} else {
|
||||
echo "lua binary not found: $lua_binary"
|
||||
}
|
||||
exit 1
|
||||
}
|
||||
|
||||
if ((Get-Command "luarocks" -ErrorAction SilentlyContinue) -eq $null) {
|
||||
echo "luarocks not found"
|
||||
exit 1
|
||||
}
|
||||
|
||||
$lua_version = (Invoke-Expression -Command "& $lua_binary -v 2>&1") -Replace '^Lua (\d+)\.(\d+).*$','$1.$2'
|
||||
echo "Detected lua version $lua_version"
|
||||
|
||||
$luarocks_args=@(
|
||||
"--tree",
|
||||
"$(Get-Location)/lua_modules",
|
||||
"--lua-version",
|
||||
"$lua_version"
|
||||
)
|
||||
|
||||
try {
|
||||
cd ./libs/ldoc
|
||||
luarocks @luarocks_args make
|
||||
} finally {
|
||||
popd
|
||||
}
|
||||
} finally {
|
||||
popd
|
||||
}
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
|
||||
cd "$DIR/.."
|
||||
|
||||
lua_binary="${LUA_BINARY:-lua}"
|
||||
|
||||
if ! command -v "$lua_binary" &> /dev/null; then
|
||||
if [[ -z "${LUA_BINARY+x}" ]]; then
|
||||
echo "lua binary not found; please set \$LUA_BINARY manually."
|
||||
else
|
||||
echo "lua binary not found: $lua_binary"
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! command -v "$lua_binary" &> /dev/null; then
|
||||
echo "luarocks not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
lua_version="$("$lua_binary" -v | grep -Po '^Lua \K(\d+)\.(\d+)')"
|
||||
echo "Detected lua version $lua_version"
|
||||
|
||||
# Install dependencies (npm style)
|
||||
# NOTE: you need to have lua header files installed.
|
||||
# On debian-based distros: apt install libluaX.X-dev
|
||||
|
||||
luarocks_args=(
|
||||
"--tree"
|
||||
"$PWD/lua_modules"
|
||||
"--lua-version"
|
||||
"$lua_version"
|
||||
)
|
||||
|
||||
(
|
||||
cd libs/ldoc
|
||||
luarocks ${luarocks_args[@]} make
|
||||
)
|
||||
@@ -0,0 +1,12 @@
|
||||
try {
|
||||
cd $PSScriptRoot/..
|
||||
|
||||
if ((Get-Command "python3" -ErrorAction SilentlyContinue) -eq $null) {
|
||||
echo "python3 not found"
|
||||
exit 1
|
||||
}
|
||||
|
||||
python3 -m http.server -d html
|
||||
} finally {
|
||||
popd
|
||||
}
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
|
||||
cd "$DIR/.."
|
||||
|
||||
if ! command -v "python3" &> /dev/null; then
|
||||
echo "python3 not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
python3 -m http.server -d html
|
||||
Reference in New Issue
Block a user