From 352d71af23a1a59e028668c3843b6eb908bd2087 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Tue, 10 Mar 2015 16:26:25 +0100 Subject: statsmanager: Fire event at the start of collection to allow for polling --- core/statsmanager.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/core/statsmanager.lua b/core/statsmanager.lua index cddaba06..d6cbd2bc 100644 --- a/core/statsmanager.lua +++ b/core/statsmanager.lua @@ -28,6 +28,7 @@ if stats_interval then function collect() local mark_collection_done = mark_collection_start(); + fire_event("stats-update"); changed_stats, stats_extra = {}, {}; for stat_name, getter in pairs(stats.get_stats()) do local type, value, extra = getter(); -- cgit v1.2.3 From b1889326c4efeddbde16d83ee12fc9cb297ee63b Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 23 Mar 2015 18:42:11 +0100 Subject: Backed out 35ebcb733c4c --- plugins/mod_http.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/mod_http.lua b/plugins/mod_http.lua index 76ee151b..8bda1cac 100644 --- a/plugins/mod_http.lua +++ b/plugins/mod_http.lua @@ -84,7 +84,6 @@ function module.add_host(module) local app_name = event.item.name; local default_app_path = event.item.default_path or "/"..app_name; local app_path = get_base_path(module, app_name, default_app_path); - module:log("debug", "Serving '%s' at %s", app_name, module:http_url(app_name, app_path)); if not app_name then -- TODO: Link to docs module:log("error", "HTTP app has no 'name', add one or use module:provides('http', app)"); -- cgit v1.2.3 From ecf0dc01952f8e2c4013aa0964b70ac82b25ae04 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 4 Jul 2014 23:13:51 +0200 Subject: prosodyctl: Show relative paths in about --- prosodyctl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/prosodyctl b/prosodyctl index bfb118c3..60bc0c08 100755 --- a/prosodyctl +++ b/prosodyctl @@ -528,16 +528,18 @@ function commands.about(arg) return 1; end + local pwd = "."; local array = require "util.array"; local keys = require "util.iterators".keys; + local relpath = config.resolve_relative_path; print("Prosody "..(prosody.version or "(unknown version)")); print(""); print("# Prosody directories"); - print("Data directory: ", CFG_DATADIR or "./"); - print("Plugin directory:", CFG_PLUGINDIR or "./"); - print("Config directory:", CFG_CONFIGDIR or "./"); - print("Source directory:", CFG_SOURCEDIR or "./"); + print("Data directory: "..relpath(pwd, data_path)); + print("Plugin directory: "..relpath(pwd, CFG_PLUGINDIR or ".")); + print("Config directory: "..relpath(pwd, CFG_CONFIGDIR or ".")); + print("Source directory: "..relpath(pwd, CFG_SOURCEDIR or ".")); print(""); print("# Lua environment"); print("Lua version: ", _G._VERSION); -- cgit v1.2.3 From c5cd1e54288930596391572b857461a0ca69dd8f Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 21 Jan 2015 02:55:18 +0100 Subject: util.mercurial: Utility functions for Mercurial repositories --- util/mercurial.lua | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 util/mercurial.lua diff --git a/util/mercurial.lua b/util/mercurial.lua new file mode 100644 index 00000000..3f75c4c1 --- /dev/null +++ b/util/mercurial.lua @@ -0,0 +1,34 @@ + +local lfs = require"lfs"; + +local hg = { }; + +function hg.check_id(path) + if lfs.attributes(path, 'mode') ~= "directory" then + return nil, "not a directory"; + end + local hg_dirstate = io.open(path.."/.hg/dirstate"); + local hgid, hgrepo + if hg_dirstate then + hgid = ("%02x%02x%02x%02x%02x%02x"):format(hg_dirstate:read(6):byte(1, 6)); + hg_dirstate:close(); + local hg_changelog = io.open(path.."/.hg/store/00changelog.i"); + if hg_changelog then + hg_changelog:seek("set", 0x20); + hgrepo = ("%02x%02x%02x%02x%02x%02x"):format(hg_changelog:read(6):byte(1, 6)); + hg_changelog:close(); + end + else + local hg_archival,e = io.open(path.."/.hg_archival.txt"); + if hg_archival then + local repo = hg_archival:read("*l"); + local node = hg_archival:read("*l"); + hg_archival:close() + hgid = node and node:match("^node: (%x%x%x%x%x%x%x%x%x%x%x%x)") + hgrepo = repo and repo:match("^repo: (%x%x%x%x%x%x%x%x%x%x%x%x)") + end + end + return hgid, hgrepo; +end + +return hg; -- cgit v1.2.3 From 7193adf5d5cbc0a0bd0e49488b4590e3dff19ab2 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 21 Jan 2015 02:55:23 +0100 Subject: prosodyctl: Use util.mercurial to identify hg repository and revision --- prosodyctl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/prosodyctl b/prosodyctl index 60bc0c08..c7daceac 100755 --- a/prosodyctl +++ b/prosodyctl @@ -251,6 +251,7 @@ require "socket" function read_version() -- Try to determine version local version_file = io.open((CFG_SOURCEDIR or ".").."/prosody.version"); + prosody.version = "unknown"; if version_file then prosody.version = version_file:read("*a"):gsub("%s*$", ""); version_file:close(); @@ -258,7 +259,9 @@ function read_version() prosody.version = "hg:"..prosody.version; end else - prosody.version = "unknown"; + local hg = require"util.mercurial"; + local hgid = hg.check_id(CFG_SOURCEDIR or "."); + if hgid then prosody.version = "hg:" .. hgid; end end end -- cgit v1.2.3 From 13edf3e093fd656d5110b277eca4c9805f3d925c Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 21 Jan 2015 02:55:27 +0100 Subject: prosodyctl: Expand plugin paths and attempt to identify prosody-modules checkouts --- prosodyctl | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/prosodyctl b/prosodyctl index c7daceac..abf9bf95 100755 --- a/prosodyctl +++ b/prosodyctl @@ -532,17 +532,30 @@ function commands.about(arg) end local pwd = "."; + local lfs = require "lfs"; local array = require "util.array"; local keys = require "util.iterators".keys; + local hg = require"util.mercurial"; local relpath = config.resolve_relative_path; print("Prosody "..(prosody.version or "(unknown version)")); print(""); print("# Prosody directories"); print("Data directory: "..relpath(pwd, data_path)); - print("Plugin directory: "..relpath(pwd, CFG_PLUGINDIR or ".")); print("Config directory: "..relpath(pwd, CFG_CONFIGDIR or ".")); print("Source directory: "..relpath(pwd, CFG_SOURCEDIR or ".")); + print("Plugin directories:") + print(" "..(prosody.paths.plugins:gsub("([^;]+);?", function(path) + local opath = path; + path = config.resolve_relative_path(pwd, path); + local hgid, hgrepo = hg.check_id(path); + if not hgid and hgrepo then + return path.." - "..hgrepo .."!\n "; + end + hgrepo = hgrepo == "010452cfaf53" and "prosody-modules"; + return path..(hgid and " - "..(hgrepo or "HG").." rev: "..hgid or "") + .."\n "; + end))); print(""); print("# Lua environment"); print("Lua version: ", _G._VERSION); -- cgit v1.2.3