Skip to content

Commit a23ce7e

Browse files
authored
release v0.6.0 (#38)
1 parent 06a5e1c commit a23ce7e

File tree

3 files changed

+122
-14
lines changed

3 files changed

+122
-14
lines changed

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,9 @@ bench:
2626
ldoc:
2727
@rm -rf docs/*
2828
@ldoc .
29+
30+
31+
FILE=
32+
API_KEY=
33+
upload:
34+
luarocks upload $(FILE) --api-key=$(API_KEY)

radix-router-dev-1.rockspec

Lines changed: 43 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,53 @@
1-
local package_name = "radix-router"
2-
local package_version = "dev"
3-
local rockspec_revision = "1"
4-
local github_account_name = "vm-001"
5-
local github_repo_name = "lua-radix-router"
6-
local git_checkout = package_version == "dev" and "main" or ("version_"..package_version)
7-
8-
package = package_name
9-
version = package_version .. "-" .. rockspec_revision
1+
package = "radix-router"
2+
version = "dev-1"
103

114
source = {
12-
url = "git+https://github.com/"..github_account_name.."/"..github_repo_name..".git",
13-
branch = git_checkout
5+
url = "git+https://github.com/vm-001/lua-radix-router.git",
6+
branch = "main"
147
}
158

169
description = {
17-
summary = "radix-router",
10+
summary = "Fast API Router for Lua/LuaJIT",
1811
detailed = [[
12+
A lightweight high-performance and radix tree based router for Lua/LuaJIT/OpenResty.
13+
14+
local Router = require "radix-router"
15+
local router, err = Router.new({
16+
{ -- static path
17+
paths = { "/foo", "/foo/bar", "/html/index.html" },
18+
handler = "1" -- handler can be any non-nil value. (e.g. boolean, table, function)
19+
},
20+
{ -- variable path
21+
paths = { "/users/{id}/profile-{year}.{format}" },
22+
handler = "2"
23+
},
24+
{ -- prefix path
25+
paths = { "/api/authn/{*path}" },
26+
handler = "3"
27+
},
28+
{ -- methods condition
29+
paths = { "/users/{id}" },
30+
methods = { "POST" },
31+
handler = "4"
32+
}
33+
})
34+
if not router then
35+
error("failed to create router: " .. err)
36+
end
37+
38+
assert("1" == router:match("/html/index.html"))
39+
assert("2" == router:match("/users/100/profile-2023.pdf"))
40+
assert("3" == router:match("/api/authn/token/genreate"))
41+
assert("4" == router:match("/users/100", { method = "POST" }))
42+
43+
-- variable binding
44+
local params = {}
45+
router:match("/users/100/profile-2023.pdf", nil, params)
46+
assert(params.year == "2023")
47+
assert(params.format == "pdf")
1948
]],
20-
license = "MIT",
21-
homepage = "https://github.com/"..github_account_name.."/"..github_repo_name,
49+
homepage = "https://github.com/vm-001/lua-radix-router",
50+
license = "BSD-2-Clause license"
2251
}
2352

2453
dependencies = {
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
package = "radix-router"
2+
version = "0.6.0-1"
3+
4+
source = {
5+
url = "git://github.com/vm-001/lua-radix-router",
6+
tag = "v0.6.0",
7+
}
8+
9+
description = {
10+
summary = "Fast API Router for Lua/LuaJIT",
11+
detailed = [[
12+
A lightweight high-performance and radix tree based router for Lua/LuaJIT/OpenResty.
13+
14+
local Router = require "radix-router"
15+
local router, err = Router.new({
16+
{ -- static path
17+
paths = { "/foo", "/foo/bar", "/html/index.html" },
18+
handler = "1" -- handler can be any non-nil value. (e.g. boolean, table, function)
19+
},
20+
{ -- variable path
21+
paths = { "/users/{id}/profile-{year}.{format}" },
22+
handler = "2"
23+
},
24+
{ -- prefix path
25+
paths = { "/api/authn/{*path}" },
26+
handler = "3"
27+
},
28+
{ -- methods condition
29+
paths = { "/users/{id}" },
30+
methods = { "POST" },
31+
handler = "4"
32+
}
33+
})
34+
if not router then
35+
error("failed to create router: " .. err)
36+
end
37+
38+
assert("1" == router:match("/html/index.html"))
39+
assert("2" == router:match("/users/100/profile-2023.pdf"))
40+
assert("3" == router:match("/api/authn/token/genreate"))
41+
assert("4" == router:match("/users/100", { method = "POST" }))
42+
43+
-- variable binding
44+
local params = {}
45+
router:match("/users/100/profile-2023.pdf", nil, params)
46+
assert(params.year == "2023")
47+
assert(params.format == "pdf")
48+
]],
49+
homepage = "https://github.com/vm-001/lua-radix-router",
50+
license = "BSD-2-Clause license"
51+
}
52+
53+
dependencies = {
54+
"lrexlib-pcre2",
55+
}
56+
57+
build = {
58+
type = "builtin",
59+
modules = {
60+
["radix-router"] = "src/router.lua",
61+
["radix-router.options"] = "src/options.lua",
62+
["radix-router.route"] = "src/route.lua",
63+
["radix-router.trie"] = "src/trie.lua",
64+
["radix-router.utils"] = "src/utils.lua",
65+
["radix-router.constants"] = "src/constants.lua",
66+
["radix-router.iterator"] = "src/iterator.lua",
67+
["radix-router.parser"] = "src/parser/parser.lua",
68+
["radix-router.parser.style.default"] = "src/parser/style/default.lua",
69+
["radix-router.matcher"] = "src/matcher/matcher.lua",
70+
["radix-router.matcher.host"] = "src/matcher/host.lua",
71+
["radix-router.matcher.method"] = "src/matcher/method.lua",
72+
},
73+
}

0 commit comments

Comments
 (0)