From 4bbcbcf290fa67c95c23af2b78014612e1906a34 Mon Sep 17 00:00:00 2001 From: Sandy Mossgrave Date: Mon, 8 May 2023 00:15:39 +0000 Subject: [PATCH] Added build number to version readout. --- .gitignore | 4 ++++ pom.xml | 2 +- src/main/java/com/tinyplantnews/priestess/Configuration.java | 5 ++++- src/main/java/com/tinyplantnews/priestess/Priestess.java | 3 ++- .../com/tinyplantnews/priestess/version/version.properties | 3 +++ 5 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 src/main/java/com/tinyplantnews/priestess/version/version.properties diff --git a/.gitignore b/.gitignore index 986cb2b..75a8b40 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,7 @@ /priestessconfig.txtbkup /target/ dependency-reduced-pom.xml +buildNumber.properties +.classpath +.project +.settings/ diff --git a/pom.xml b/pom.xml index 2a9acb9..78166da 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.tinyplantnews.priestess Priestess Priestesss of the Bean Goose Cult - 0.1 + 0.2 jar scm:git:https://tinyplantnews.com/git/Priestess.git diff --git a/src/main/java/com/tinyplantnews/priestess/Configuration.java b/src/main/java/com/tinyplantnews/priestess/Configuration.java index d8f24aa..6a9ce7a 100644 --- a/src/main/java/com/tinyplantnews/priestess/Configuration.java +++ b/src/main/java/com/tinyplantnews/priestess/Configuration.java @@ -209,7 +209,7 @@ public class Configuration { private static Properties getJarProperties() { Properties props = new Properties(); try { - props.load(Configuration.class.getClassLoader().getResourceAsStream("version/version.properties")); + props.load(Configuration.class.getClassLoader().getResourceAsStream("version.properties")); } catch (IOException e) { log.log(Level.SEVERE, "Problem encountered while loading basic jar properties: {0}", e); return null; @@ -219,15 +219,18 @@ public class Configuration { public static final String PROGNAME; public static final String VERSION; + public static final String BUILD; static { Properties props = getJarProperties(); if (props == null) { PROGNAME = "Priestess, probably"; VERSION = "(version unknown)"; + BUILD = "(unknown build number)"; } else { PROGNAME = props.getProperty("progname"); VERSION = props.getProperty("version"); + BUILD = props.getProperty("build"); } } diff --git a/src/main/java/com/tinyplantnews/priestess/Priestess.java b/src/main/java/com/tinyplantnews/priestess/Priestess.java index 0042324..3954388 100644 --- a/src/main/java/com/tinyplantnews/priestess/Priestess.java +++ b/src/main/java/com/tinyplantnews/priestess/Priestess.java @@ -41,6 +41,7 @@ import org.reactivestreams.Publisher; import reactor.core.publisher.Mono; import static com.tinyplantnews.priestess.Configuration.PROGNAME; import static com.tinyplantnews.priestess.Configuration.VERSION; +import static com.tinyplantnews.priestess.Configuration.BUILD; /** * @@ -863,7 +864,7 @@ public class Priestess { public final Callback listCommandsCommand = new Callback() { @Override public Publisher apply(CommandArgs o) { - o.replyWith(PROGNAME + " " + VERSION); + o.replyWith(PROGNAME + " " + VERSION + " build number " + BUILD); for (String name : Command.commands.keySet()) { o.replyWith(" Help for command " + name + ": " + Command.commands.get(name).getHelp()); } diff --git a/src/main/java/com/tinyplantnews/priestess/version/version.properties b/src/main/java/com/tinyplantnews/priestess/version/version.properties new file mode 100644 index 0000000..02b075b --- /dev/null +++ b/src/main/java/com/tinyplantnews/priestess/version/version.properties @@ -0,0 +1,3 @@ +progname=${name} +version=${version} +build=${buildNumber}