From daa2975fd68de7ab5ba6d5bb0eab012b2ad67b71 Mon Sep 17 00:00:00 2001 From: Skye M Date: Mon, 11 May 2020 20:09:41 +0100 Subject: [PATCH 1/2] Fix the build process so that it works on the Bash shell for Git on Windows 1. Made the Lua thing used be an optional variable, so it works for different Lua versions and locations 2. Made it work better with windows filesystems being weird with trailing dots. --- build.sh | 7 ++++--- luapreproc.lua | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index d8596eb..bd6815d 100755 --- a/build.sh +++ b/build.sh @@ -1,10 +1,11 @@ -#!/bin/sh +#!/bin/bash +LUA=${LUA:-lua} rm -r target/* mkdir target &>/dev/null -lua luapreproc.lua module/init.lua target/init.lua +$LUA luapreproc.lua module/init.lua target/init.lua echo _OSVERSION=\"PsychOS 2.0a2-$(git rev-parse --short HEAD)\" > target/version.lua cat target/version.lua target/init.lua > target/tinit.lua mv target/tinit.lua target/init.lua cp -r service/ lib/ cfg/ target/ -lua finddesc.lua $(find module/ -type f) $(find lib/ -type f) > apidoc.md +$LUA finddesc.lua $(find module/ -type f) $(find lib/ -type f) > apidoc.md rm target/version.lua diff --git a/luapreproc.lua b/luapreproc.lua index cf2e176..00b2a8b 100755 --- a/luapreproc.lua +++ b/luapreproc.lua @@ -179,6 +179,7 @@ local env = {code = ""} setmetatable(env, {__index=_env}) env:process(arg[1]) local tmpfile = os.tmpname() +if tmpfile:sub(#tmpfile) == "." then tmpfile = tmpfile:sub(1, #tmpfile - 1) end local tmpf = io.open(tmpfile, "wb") tmpf:write(env.code) tmpf:close() From e09650276a19bc3b02442fcdbfaab0c474368862 Mon Sep 17 00:00:00 2001 From: Skye M Date: Tue, 12 May 2020 01:49:51 +0100 Subject: [PATCH 2/2] Improve markdown output from finddesc.lua * It didn't add spaces after the ## or #, which made them not work as headings in some renderers, so I fixed this. * I then made it add newlines to make it look nicer without being rendered. --- finddesc.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/finddesc.lua b/finddesc.lua index 513a271..d2c4df4 100644 --- a/finddesc.lua +++ b/finddesc.lua @@ -12,14 +12,14 @@ for _,file in pairs(tA) do for k,v in pairs(lines) do local name, args, desc = v:match("function%s+(.+)%s*%((.*)%)%s*%-%-%s*(.+)") if name and args and desc then - docfiles[file][#docfiles[file]+1] = string.format("##%s(%s)\n%s",name,args,desc) + docfiles[file][#docfiles[file]+1] = string.format("## %s(%s)\n%s\n",name,args,desc) end end end for k,v in pairs(docfiles) do if #v > 0 then - print("#"..k) + print("\n# "..k) for l,m in pairs(v) do print(m) end