Comparison

prosodyctl @ 6588:93423244dc5b

Merge 0.10->trunk
author Matthew Wild <mwild1@gmail.com>
date Tue, 24 Mar 2015 13:41:18 +0000
parent 6587:54306208f30b
child 6611:65dd3770bcb0
comparison
equal deleted inserted replaced
6581:f2a7ad099e01 6588:93423244dc5b
249 249
250 -- FIXME: Duplicate code waiting for util.startup 250 -- FIXME: Duplicate code waiting for util.startup
251 function read_version() 251 function read_version()
252 -- Try to determine version 252 -- Try to determine version
253 local version_file = io.open((CFG_SOURCEDIR or ".").."/prosody.version"); 253 local version_file = io.open((CFG_SOURCEDIR or ".").."/prosody.version");
254 prosody.version = "unknown";
254 if version_file then 255 if version_file then
255 prosody.version = version_file:read("*a"):gsub("%s*$", ""); 256 prosody.version = version_file:read("*a"):gsub("%s*$", "");
256 version_file:close(); 257 version_file:close();
257 if #prosody.version == 12 and prosody.version:match("^[a-f0-9]+$") then 258 if #prosody.version == 12 and prosody.version:match("^[a-f0-9]+$") then
258 prosody.version = "hg:"..prosody.version; 259 prosody.version = "hg:"..prosody.version;
259 end 260 end
260 else 261 else
261 prosody.version = "unknown"; 262 local hg = require"util.mercurial";
263 local hgid = hg.check_id(CFG_SOURCEDIR or ".");
264 if hgid then prosody.version = "hg:" .. hgid; end
262 end 265 end
263 end 266 end
264 267
265 local show_message, show_warning = prosodyctl.show_message, prosodyctl.show_warning; 268 local show_message, show_warning = prosodyctl.show_message, prosodyctl.show_warning;
266 local show_usage = prosodyctl.show_usage; 269 local show_usage = prosodyctl.show_usage;
526 if arg[1] == "--help" then 529 if arg[1] == "--help" then
527 show_usage([[about]], [[Show information about this Prosody installation]]); 530 show_usage([[about]], [[Show information about this Prosody installation]]);
528 return 1; 531 return 1;
529 end 532 end
530 533
534 local pwd = ".";
535 local lfs = require "lfs";
531 local array = require "util.array"; 536 local array = require "util.array";
532 local keys = require "util.iterators".keys; 537 local keys = require "util.iterators".keys;
538 local hg = require"util.mercurial";
539 local relpath = config.resolve_relative_path;
533 540
534 print("Prosody "..(prosody.version or "(unknown version)")); 541 print("Prosody "..(prosody.version or "(unknown version)"));
535 print(""); 542 print("");
536 print("# Prosody directories"); 543 print("# Prosody directories");
537 print("Data directory: ", CFG_DATADIR or "./"); 544 print("Data directory: "..relpath(pwd, data_path));
538 print("Plugin directory:", CFG_PLUGINDIR or "./"); 545 print("Config directory: "..relpath(pwd, CFG_CONFIGDIR or "."));
539 print("Config directory:", CFG_CONFIGDIR or "./"); 546 print("Source directory: "..relpath(pwd, CFG_SOURCEDIR or "."));
540 print("Source directory:", CFG_SOURCEDIR or "./"); 547 print("Plugin directories:")
548 print(" "..(prosody.paths.plugins:gsub("([^;]+);?", function(path)
549 local opath = path;
550 path = config.resolve_relative_path(pwd, path);
551 local hgid, hgrepo = hg.check_id(path);
552 if not hgid and hgrepo then
553 return path.." - "..hgrepo .."!\n ";
554 end
555 hgrepo = hgrepo == "010452cfaf53" and "prosody-modules";
556 return path..(hgid and " - "..(hgrepo or "HG").." rev: "..hgid or "")
557 .."\n ";
558 end)));
541 print(""); 559 print("");
542 print("# Lua environment"); 560 print("# Lua environment");
543 print("Lua version: ", _G._VERSION); 561 print("Lua version: ", _G._VERSION);
544 print(""); 562 print("");
545 print("Lua module search paths:"); 563 print("Lua module search paths:");