Skip to content

Commit

Permalink
display version
Browse files Browse the repository at this point in the history
  • Loading branch information
xonixx committed Jun 11, 2016
1 parent b68cd92 commit 4191b41
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 0 deletions.
34 changes: 34 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
<groupId>info.xonix.gae-pass-manager</groupId>
<artifactId>gae-pass-manager</artifactId>

<scm>
<connection>scm:git:[email protected]:xonixx/gae-pass-manager.git</connection>
</scm>

<prerequisites>
<maven>3.1.0</maven>
</prerequisites>
Expand Down Expand Up @@ -73,6 +77,17 @@
</dependencies>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<!--maven fills varibales-->
<filtering>true</filtering>
<includes>
<include>version.properties</include>
</includes>
</resource>
</resources>

<!-- for hot reload of the web application-->
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
<plugins>
Expand Down Expand Up @@ -141,6 +156,25 @@
<set_default>true</set_default>
</configuration>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
<shortRevisionLength>7</shortRevisionLength>
</configuration>
</plugin>
</plugins>
</build>
</project>
1 change: 1 addition & 0 deletions src/main/java/info/xonix/passmanager/Logic.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public static String renderGlobals(boolean offline) {
Map<String, Object> globals = new LinkedHashMap<>();

globals.put("email", getCurrentUser().getEmail());
globals.put("version", VersionManager.getApplicationVersion());

if (offline)
globals.put("offlineData", AppLogic.getEncyptedPassData());
Expand Down
28 changes: 28 additions & 0 deletions src/main/java/info/xonix/passmanager/VersionManager.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package info.xonix.passmanager;

import java.io.IOException;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;

public class VersionManager {
private final static Logger log = Logger.getLogger(VersionManager.class.getName());

private static final Properties versionProps = new Properties();
public static final String UNKNOWN = "UNKNOWN";

public static final String VERSION_FILE = "version.properties";

static {
try {
versionProps.load(VersionManager.class.getClassLoader().getResourceAsStream(VERSION_FILE));
} catch (IOException e) {
log.log(Level.SEVERE, "Can't read project version", e);
}
}

public static String getApplicationVersion() {
return versionProps.getProperty("pom", UNKNOWN) +
"r" + versionProps.getProperty("revision", UNKNOWN);
}
}
3 changes: 3 additions & 0 deletions src/main/resources/version.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pom=${pom.version}
revision=${buildNumber}
timestamp=${timestamp}
1 change: 1 addition & 0 deletions src/main/webapp/ng-tpl/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<div class="row" id="header">
<div class="col-xs-4">
<h3>Passwords</h3>
<i style="position: absolute;font-size:.7em;top:27px">version: {{::global.version}}</i>
</div>
<div class="col-xs-4" style="padding-top: 5px">
<div ng-if="!readonly">
Expand Down

0 comments on commit 4191b41

Please sign in to comment.