prosodyctl: Expand plugin paths and attempt to identify prosody-modules checkouts
authorKim Alvefur <zash@zash.se>
Wed, 21 Jan 2015 01:55:27 +0000 (02:55 +0100)
committerKim Alvefur <zash@zash.se>
Wed, 21 Jan 2015 01:55:27 +0000 (02:55 +0100)
prosodyctl

index c7daceac579184a4c3192f6e38ff7f54549d9d17..abf9bf95d1392a02f01c3d8f3eeaac616f73bfba 100755 (executable)
@@ -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);