-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprecommit.lua
43 lines (31 loc) · 1.25 KB
/
precommit.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/lua
-- Svof (c) 2011-2015 by Vadim Peretokin
-- Svof is licensed under a
-- Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
-- You should have received a copy of the license along with this
-- work. If not, see <http://creativecommons.org/licenses/by-nc-sa/4.0/>.
-- get release version from command line
local args = {...}
local systemversion = args[1]
-- copy to template
os.execute([[cp 'svo (install the zip, not me).xml' 'svo template/svo (install the zip, not me).xml']])
-- update version in docs
io.input("doc/conf.py")
t = io.read("*all")
t = string.gsub(t, [[version = '.-']], string.format("version = '%s'", systemversion))
t = string.gsub(t, [[release = '.-']], string.format("release = '%s'", systemversion))
io.output("doc/conf.py")
io.write(t)
-- make
os.execute([[cd doc && sphinx-build -b html -d _build/doctrees . _build/html]])
-- update ndb cache listing
package.path = package.path .. ";./doc/?.lua"
gl = require"parse_glossary"
pretty = require"pl.pretty"
local data = gl.striptrailinglines(gl.readfile("doc/namedb.rst"))
local f = io.open([[svo template/ndb-help.lua]], "w+")
f:write(pretty.write(data))
f:close()
local f = io.open([[own svo/ndb-help.lua]], "w+")
f:write(pretty.write(data))
f:close()