Compare commits

...

2 Commits

Author SHA1 Message Date
124b39c96d Merge pull request 'Fix document generation on Windows (using Git Bash)' (#3) from Skye/OC-PsychOS2:git-windows-bash-fixes into master
Windows is infinitely cursed.

Greatly appreciated.
2020-05-14 14:11:23 +10:00
56af6d1ade Fix document generation on Windows (using Git Bash)
* Made finddesc.lua execute commands using `sh -c 'command'`, which ensures that Unix-like shell is used instead of cmd.exe
* Made finddesc.lua avoid a situation where it would end up with a double '/' in `outpath`
* Redirect output of deleting the document to null to avoid pointless "No such file or directory" errors.
2020-05-12 16:29:44 +01:00
2 changed files with 4 additions and 3 deletions

View File

@ -8,7 +8,7 @@ cat target/version.lua target/init.lua > target/tinit.lua
mv target/tinit.lua target/init.lua mv target/tinit.lua target/init.lua
cp -r service/ lib/ cfg/ target/ cp -r service/ lib/ cfg/ target/
rm target/version.lua rm target/version.lua
rm -r doc/ rm -r doc/ &>/dev/null
$LUA finddesc.lua doc/ $(find lib/ module/ -type f|sort) $LUA finddesc.lua doc/ $(find lib/ module/ -type f|sort)
$LUA gendoc.lua target/doc/kernel.dict $(find module/ -type f|sort) $LUA gendoc.lua target/doc/kernel.dict $(find module/ -type f|sort)
pandoc doc/apidoc.md docs-metadata.yml --template=template.tex -o doc/apidoc.pdf pandoc doc/apidoc.md docs-metadata.yml --template=template.tex -o doc/apidoc.pdf

View File

@ -36,7 +36,8 @@ local function formatDocs(fd)
return rs return rs
end end
os.execute("mkdir -p "..outpath) os.execute("sh -c 'mkdir -p "..outpath .. "'")
if outpath:sub(#outpath) == "/" then outpath = outpath:sub(1, #outpath - 1) end
local ad = io.open(outpath.."/apidoc.md","w") local ad = io.open(outpath.."/apidoc.md","w")
for k,v in pairs(tA) do for k,v in pairs(tA) do
@ -44,7 +45,7 @@ for k,v in pairs(tA) do
local ds = formatDocs(fd) local ds = formatDocs(fd)
print(string.format("%s: %i",v,ds:len())) print(string.format("%s: %i",v,ds:len()))
if ds and ds:len() > 0 then if ds and ds:len() > 0 then
os.execute("mkdir -p $(dirname \""..outpath.."/"..v.."\")") os.execute("sh -c 'mkdir -p $(dirname \""..outpath.."/"..v.."\")'")
local f = io.open(outpath.."/"..v:gsub("%.lua$",".md"),"wb") local f = io.open(outpath.."/"..v:gsub("%.lua$",".md"),"wb")
f:write(string.format("# %s\n\n",v)) f:write(string.format("# %s\n\n",v))
f:write(ds) f:write(ds)