Software /
code /
prosody
Comparison
prosodyctl @ 4881:eafed1728be3
prosodyctl: Add duplicate code for getting version of prosody
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 15 May 2012 20:15:52 +0200 |
parent | 4878:80ab7c50608d |
child | 4935:bc62abceef07 |
child | 5023:dcc8e789df36 |
comparison
equal
deleted
inserted
replaced
4880:6d96e2e717c1 | 4881:eafed1728be3 |
---|---|
230 require "core.modulemanager" | 230 require "core.modulemanager" |
231 | 231 |
232 require "util.prosodyctl" | 232 require "util.prosodyctl" |
233 require "socket" | 233 require "socket" |
234 ----------------------- | 234 ----------------------- |
235 | |
236 -- FIXME: Duplicate code waiting for util.startup | |
237 function read_version() | |
238 -- Try to determine version | |
239 local version_file = io.open((CFG_SOURCEDIR or ".").."/prosody.version"); | |
240 if version_file then | |
241 prosody.version = version_file:read("*a"):gsub("%s*$", ""); | |
242 version_file:close(); | |
243 if #prosody.version == 12 and prosody.version:match("^[a-f0-9]+$") then | |
244 prosody.version = "hg:"..prosody.version; | |
245 end | |
246 else | |
247 prosody.version = "unknown"; | |
248 end | |
249 end | |
235 | 250 |
236 local show_message, show_warning = prosodyctl.show_message, prosodyctl.show_warning; | 251 local show_message, show_warning = prosodyctl.show_message, prosodyctl.show_warning; |
237 local show_usage = prosodyctl.show_usage; | 252 local show_usage = prosodyctl.show_usage; |
238 local getchar, getpass = prosodyctl.getchar, prosodyctl.getpass; | 253 local getchar, getpass = prosodyctl.getchar, prosodyctl.getpass; |
239 local show_yesno = prosodyctl.show_yesno; | 254 local show_yesno = prosodyctl.show_yesno; |
486 commands.stop(arg); | 501 commands.stop(arg); |
487 return commands.start(arg); | 502 return commands.start(arg); |
488 end | 503 end |
489 | 504 |
490 function commands.about(arg) | 505 function commands.about(arg) |
506 read_version(); | |
491 if arg[1] == "--help" then | 507 if arg[1] == "--help" then |
492 show_usage([[about]], [[Show information about this Prosody installation]]); | 508 show_usage([[about]], [[Show information about this Prosody installation]]); |
493 return 1; | 509 return 1; |
494 end | 510 end |
495 | 511 |