tests: fixes lunit test to work with Lua 5.2 environment management
[luajson.git] / util / createRock.lua
blob6549cbc65b485f8d33d52bda96f8fc44771f17e9
1 local version = assert((...), "Requires rock version on command-line")
3 local template = [=[
4 package = "luajson"
5 version = %VERSION%
6 source = {
7 url = "git://github.com/harningt/luajson.git"
9 description = {
10 summary = "customizable JSON decoder/encoder",
11 detailed = [[
12 LuaJSON is a customizable JSON decoder/encoder using
13 LPEG for parsing.
14 ]],
15 homepage = "http://github.com/harningt/luajson",
16 maintainer = "Thomas Harning <harningt@gmail.com>",
17 license = "MIT/X11"
19 dependencies = {
20 "lua >= 5.1",
21 "lunit >= 0.4",
22 "lpeg >= 0.8.1"
24 build = {
25 type = "module",
26 modules = {
27 %MODULES%
30 ]=]
32 local in_modules = io.popen("find lua -type f -name '*.lua' -not -iname '.*' | sort", "r")
33 local modules = in_modules:read("*a")
34 in_modules:close()
36 modules = modules:gsub("lua/([^\n]*)%.lua", function(module)
37 return "\t\t[" .. ("%q"):format(module:gsub("/",".")) .. "] = " .. ("%q"):format("lua/" .. module .. ".lua") .. ","
38 end)
39 local out = template:gsub("%%(.-)%%", {
40 VERSION = ("%q"):format(version),
41 MODULES = modules
43 print(out)