Skip to content

Commit

Permalink
release v0.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
vm-001 committed Mar 1, 2024
1 parent 06a5e1c commit f46fdf8
Show file tree
Hide file tree
Showing 3 changed files with 122 additions and 14 deletions.
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,9 @@ bench:
ldoc:
@rm -rf docs/*
@ldoc .


FILE=
API_KEY=
upload:
luarocks upload $(FILE) --api-key=$(API_KEY)
57 changes: 43 additions & 14 deletions radix-router-dev-1.rockspec
Original file line number Diff line number Diff line change
@@ -1,24 +1,53 @@
local package_name = "radix-router"
local package_version = "dev"
local rockspec_revision = "1"
local github_account_name = "vm-001"
local github_repo_name = "lua-radix-router"
local git_checkout = package_version == "dev" and "main" or ("version_"..package_version)

package = package_name
version = package_version .. "-" .. rockspec_revision
package = "radix-router"
version = "dev-1"

source = {
url = "git+https://github.com/"..github_account_name.."/"..github_repo_name..".git",
branch = git_checkout
url = "git+https://github.com/vm-001/lua-radix-router.git",
branch = "main"
}

description = {
summary = "radix-router",
summary = "Fast API Router for Lua/LuaJIT",
detailed = [[
A lightweight high-performance and radix tree based router for Lua/LuaJIT/OpenResty.
local Router = require "radix-router"
local router, err = Router.new({
{ -- static path
paths = { "/foo", "/foo/bar", "/html/index.html" },
handler = "1" -- handler can be any non-nil value. (e.g. boolean, table, function)
},
{ -- variable path
paths = { "/users/{id}/profile-{year}.{format}" },
handler = "2"
},
{ -- prefix path
paths = { "/api/authn/{*path}" },
handler = "3"
},
{ -- methods condition
paths = { "/users/{id}" },
methods = { "POST" },
handler = "4"
}
})
if not router then
error("failed to create router: " .. err)
end
assert("1" == router:match("/html/index.html"))
assert("2" == router:match("/users/100/profile-2023.pdf"))
assert("3" == router:match("/api/authn/token/genreate"))
assert("4" == router:match("/users/100", { method = "POST" }))
-- variable binding
local params = {}
router:match("/users/100/profile-2023.pdf", nil, params)
assert(params.year == "2023")
assert(params.format == "pdf")
]],
license = "MIT",
homepage = "https://github.com/"..github_account_name.."/"..github_repo_name,
homepage = "https://github.com/vm-001/lua-radix-router",
license = "BSD-2-Clause license"
}

dependencies = {
Expand Down
73 changes: 73 additions & 0 deletions rockspecs/radix-router-0.6.0-1.rockspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package = "radix-router"
version = "0.6.0-1"

source = {
url = "git://github.com/vm-001/lua-radix-router",
tag = "v0.6.0",
}

description = {
summary = "Fast API Router for Lua/LuaJIT",
detailed = [[
A lightweight high-performance and radix tree based router for Lua/LuaJIT/OpenResty.
local Router = require "radix-router"
local router, err = Router.new({
{ -- static path
paths = { "/foo", "/foo/bar", "/html/index.html" },
handler = "1" -- handler can be any non-nil value. (e.g. boolean, table, function)
},
{ -- variable path
paths = { "/users/{id}/profile-{year}.{format}" },
handler = "2"
},
{ -- prefix path
paths = { "/api/authn/{*path}" },
handler = "3"
},
{ -- methods condition
paths = { "/users/{id}" },
methods = { "POST" },
handler = "4"
}
})
if not router then
error("failed to create router: " .. err)
end
assert("1" == router:match("/html/index.html"))
assert("2" == router:match("/users/100/profile-2023.pdf"))
assert("3" == router:match("/api/authn/token/genreate"))
assert("4" == router:match("/users/100", { method = "POST" }))
-- variable binding
local params = {}
router:match("/users/100/profile-2023.pdf", nil, params)
assert(params.year == "2023")
assert(params.format == "pdf")
]],
homepage = "https://github.com/vm-001/lua-radix-router",
license = "BSD-2-Clause license"
}

dependencies = {
"lrexlib-pcre2",
}

build = {
type = "builtin",
modules = {
["radix-router"] = "src/router.lua",
["radix-router.options"] = "src/options.lua",
["radix-router.route"] = "src/route.lua",
["radix-router.trie"] = "src/trie.lua",
["radix-router.utils"] = "src/utils.lua",
["radix-router.constants"] = "src/constants.lua",
["radix-router.iterator"] = "src/iterator.lua",
["radix-router.parser"] = "src/parser/parser.lua",
["radix-router.parser.style.default"] = "src/parser/style/default.lua",
["radix-router.matcher"] = "src/matcher/matcher.lua",
["radix-router.matcher.host"] = "src/matcher/host.lua",
["radix-router.matcher.method"] = "src/matcher/method.lua",
},
}

0 comments on commit f46fdf8

Please sign in to comment.