base: rockspec 1.3.1-1 base prep
[luajson.git] / util / createRock.lua
blobd4481c9c37583e1e2842f3f9423453c1284e958c
1 local io = require("io")
3 local version = assert((...), "Requires rock version on command-line")
5 local template = [=[
6 package = "luajson"
7 version = %VERSION%
8 source = {
9 url = "git://github.com/harningt/luajson.git"
11 description = {
12 summary = "customizable JSON decoder/encoder",
13 detailed = [[
14 LuaJSON is a customizable JSON decoder/encoder using
15 LPEG for parsing.
16 ]],
17 homepage = "http://github.com/harningt/luajson",
18 maintainer = "Thomas Harning <harningt@gmail.com>",
19 license = "MIT/X11"
21 dependencies = {
22 "lua >= 5.1",
23 "lunit >= 0.4",
24 "lpeg >= 0.8.1"
26 build = {
27 type = "module",
28 modules = {
29 %MODULES%
32 ]=]
34 local in_modules = io.popen("find lua -type f -name '*.lua' -not -iname '.*' | sort", "r")
35 local modules = in_modules:read("*a")
36 in_modules:close()
38 modules = modules:gsub("lua/([^\n]*)%.lua", function(module)
39 return "\t\t[" .. ("%q"):format(module:gsub("/",".")) .. "] = " .. ("%q"):format("lua/" .. module .. ".lua") .. ","
40 end)
41 local out = template:gsub("%%(.-)%%", {
42 VERSION = ("%q"):format(version),
43 MODULES = modules
45 print(out)