Move docs to luacs-docs/{lua,cs,landing-page}

luacs-docs/cs also has a proper http server for testing locally
This commit is contained in:
peelz
2022-08-03 21:34:42 -04:00
parent 53ea2b8973
commit 1bb7843811
136 changed files with 2208 additions and 2113 deletions

View File

@@ -0,0 +1,19 @@
Import-Module $PSScriptRoot/../../scripts/location.ps1
try {
Change-Location $PSScriptRoot/..
Remove-Item -Force -Recurse ./build | Out-Null
New-Item -ItemType Directory ./build | Out-Null
Copy-Item -Path ./css/. -Destination ./build -Recurse -Force | Out-Null
Copy-Item -Path ./js/. -Destination ./build -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 {
Restore-Location
}

19
luacs-docs/lua/scripts/build.sh Executable file
View File

@@ -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 ./build
mkdir ./build
cp -r ./js/. ./build
cp -r ./css/. ./build
"$ldoc_path" .

View File

@@ -0,0 +1,43 @@
Import-Module $PSScriptRoot/../../scripts/location.ps1
try {
Change-Location $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 {
Change-Location ./libs/ldoc
luarocks @luarocks_args make
} finally {
Restore-Location
}
} finally {
Restore-Location
}

View File

@@ -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
)

View File

@@ -0,0 +1,14 @@
Import-Module $PSScriptRoot/../../scripts/location.ps1
try {
Change-Location $PSScriptRoot/..
if ((Get-Command "python3" -ErrorAction SilentlyContinue) -eq $null) {
echo "python3 not found"
exit 1
}
python3 ../scripts/http_server.py ./build --port 8000
} finally {
Restore-Location
}

11
luacs-docs/lua/scripts/serve.sh Executable file
View File

@@ -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 ../scripts/http_server.py ./build --port 8000