This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
The following commit(s) were added to refs/heads/master by this push:
new 3ece449 Add plugin version to server
3ece449 is described below
commit 3ece449f88e4622c317204e7b571a334de8e82e8
Author: Sebb <[email protected]>
AuthorDate: Mon Nov 22 13:30:53 2021 +0000
Add plugin version to server
---
server/main.py | 6 ++++--
server/update_version.sh | 16 ++++++++++++++++
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/server/main.py b/server/main.py
index 0b6b535..003e191 100644
--- a/server/main.py
+++ b/server/main.py
@@ -39,6 +39,8 @@ import plugins.server
import plugins.session
PONYMAIL_FOAL_VERSION = "0.1.0"
+# The following version is generated by update_version.sh
+PONYMAIL_PLUGIN_VERSION = '86c2bf0' # Must use single quotes
# Certain environments such as MinGW-w64 will not register as a TTY and uses
buffered output.
@@ -53,7 +55,7 @@ class Server(plugins.server.BaseServer):
def __init__(self, args: argparse.Namespace):
print(
- "==== Apache Pony Mail (Foal v/%s) starting... ====" %
PONYMAIL_FOAL_VERSION
+ "==== Apache Pony Mail (Foal v/%s ~%s) starting... ====" %
(PONYMAIL_FOAL_VERSION, PONYMAIL_PLUGIN_VERSION)
)
# Load configuration
yml = yaml.safe_load(open(args.config))
@@ -102,7 +104,7 @@ class Server(plugins.server.BaseServer):
# Define response headers first...
headers = {
- "Server": "Apache Pony Mail (Foal/%s)" % PONYMAIL_FOAL_VERSION,
+ "Server": "Apache Pony Mail (Foal/%s ~%s)" %
(PONYMAIL_FOAL_VERSION, PONYMAIL_PLUGIN_VERSION),
}
# Figure out who is going to handle this request, if any
diff --git a/server/update_version.sh b/server/update_version.sh
new file mode 100755
index 0000000..71b1dca
--- /dev/null
+++ b/server/update_version.sh
@@ -0,0 +1,16 @@
+#!/usr/bin/env bash
+
+# Try to change to correct directory:
+cd $(dirname "$0") || exit 1
+
+FILE=main.py
+
+test -r $FILE || { echo "Must be run from the directory containing $FILE!";
exit 1; }
+
+# plugin revision (for updating HTML)
+PLUGINS_REV=$(git log -1 --pretty=%h -- plugins)
+
+echo $PLUGINS_REV
+
+perl -0pe "s/^PONYMAIL_PLUGIN_VERSION = '[^']*'/PONYMAIL_PLUGIN_VERSION =
'$PLUGINS_REV'/smg" \
+ ${FILE} > ${FILE}.tmp && mv ${FILE}.tmp ${FILE}