Add support for versioning

When building znc-push with the makefile, it will modify the
PUSHVERSION define with version info from `git describe`, build the
module, and then reset PUSHVERSION back to "dev".  When building
directly from znc-buildmod, this will ensure the version is always just
"dev".

A matching command -- `version` -- has been added to the module which
will simply echo the value of PUSHVERSION at the time of compilation.
This commit is contained in:
John Reese 2013-07-31 17:35:53 +00:00
parent 080c767aae
commit f6e4801c93
3 changed files with 14 additions and 0 deletions

View File

@ -1,5 +1,9 @@
version := $(shell git describe)
push.so: push.cpp push.so: push.cpp
sed -i -e "s|PUSHVERSION \".*\"|PUSHVERSION \"$(version)\"|" push.cpp
znc-buildmod push.cpp znc-buildmod push.cpp
sed -i -e "s|PUSHVERSION \".*\"|PUSHVERSION \"dev\"|" push.cpp
install: push.so install: push.so
cp push.so $(HOME)/.znc/modules/push.so cp push.so $(HOME)/.znc/modules/push.so

View File

@ -99,6 +99,10 @@ Commands
Links you to this fine document. Links you to this fine document.
* `version`
Tells you the tagged build version currently running.
* `set <option> <value>` * `set <option> <value>`
Allows you to modify configuration values. Allows you to modify configuration values.

View File

@ -9,6 +9,7 @@
*/ */
#define REQUIRESSL #define REQUIRESSL
#define PUSHVERSION "dev"
#include <znc/znc.h> #include <znc/znc.h>
#include <znc/Chan.h> #include <znc/Chan.h>
@ -1425,6 +1426,11 @@ class CPushMod : public CModule
{ {
PutModule("View the detailed documentation at https://github.com/jreese/znc-push/blob/master/README.md"); PutModule("View the detailed documentation at https://github.com/jreese/znc-push/blob/master/README.md");
} }
// VERSION command
else if (action == "version")
{
PutModule("znc-push " + CString(PUSHVERSION));
}
// EVAL command // EVAL command
else if (action == "eval") else if (action == "eval")
{ {