Software / code / prosody
Comparison
prosodyctl @ 11004:d175de07dd73
prosodyctl about: Substitute better names for some Lua modules
E.g. 'lxp' isn't that easy to guess that it's LuaExpat
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Fri, 10 Jul 2020 03:29:02 +0200 |
| parent | 11003:c82ede8892fc |
| child | 11005:cff243aafdce |
comparison
equal
deleted
inserted
replaced
| 11003:c82ede8892fc | 11004:d175de07dd73 |
|---|---|
| 439 print("# Lua module versions"); | 439 print("# Lua module versions"); |
| 440 local module_versions, longest_name = {}, 8; | 440 local module_versions, longest_name = {}, 8; |
| 441 local library_versions = {}; | 441 local library_versions = {}; |
| 442 dependencies.softreq"ssl"; | 442 dependencies.softreq"ssl"; |
| 443 dependencies.softreq"DBI"; | 443 dependencies.softreq"DBI"; |
| 444 local friendly_names = { | |
| 445 DBI = "LuaDBI"; | |
| 446 lfs = "LuaFileSystem"; | |
| 447 lunbound = "luaunbound"; | |
| 448 lxp = "LuaExpat"; | |
| 449 socket = "LuaSocket"; | |
| 450 ssl = "LuaSec"; | |
| 451 }; | |
| 444 local lunbound = dependencies.softreq"lunbound"; | 452 local lunbound = dependencies.softreq"lunbound"; |
| 445 for name, module in pairs(package.loaded) do | 453 for name, module in pairs(package.loaded) do |
| 446 if type(module) == "table" and rawget(module, "_VERSION") | 454 if type(module) == "table" and rawget(module, "_VERSION") |
| 447 and name ~= "_G" and not name:match("%.") then | 455 and name ~= "_G" and not name:match("%.") then |
| 456 name = friendly_names[name] or name; | |
| 448 if #name > longest_name then | 457 if #name > longest_name then |
| 449 longest_name = #name; | 458 longest_name = #name; |
| 450 end | 459 end |
| 451 module_versions[name] = module._VERSION; | 460 module_versions[name] = module._VERSION; |
| 452 end | 461 end |