Skip to content

Commit

Permalink
add support for day-based invalidation; update version
Browse files Browse the repository at this point in the history
  • Loading branch information
FriedrichFroebel committed Aug 5, 2020
1 parent 2b3884c commit 9339fcd
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 14 deletions.
16 changes: 9 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Development version

# Version 0.5.3 - 2020-08-05

* Consider the date for event caches during comparison.

# Version 0.5.2 - 2020-07-08
Expand Down Expand Up @@ -31,7 +33,7 @@
# Version 0.4.0 - 2020-05-22

* Add fallback methods for opening an URL in the web browser.
* View logs as plaintext instead of HTML. This should finally provide correct linebreaks in the text.
* View logs as plaintext instead of HTML. This should finally provide correct line breaks in the text.
* Allow sending modified logs.
* Add support for Travis CI for automated `master` builds.
* Fix log type for webcam caches.
Expand Down Expand Up @@ -84,7 +86,7 @@
# Version 0.2.43 - 2017-05-02

* Perform some refactoring.
* Store information about HTTP responses witout code 200.
* Store information about HTTP responses without code 200.
* Handle OKAPI error responses for the username and cache getter.
* Switch OKAPI responses to JSON.
* Split OKAPI result caching and cache lookup.
Expand Down Expand Up @@ -174,8 +176,8 @@

# Version 0.2z - 2016-02-25

* Only enable undo menu if undo action are available.
* Allow restarting the program to update used heap size.
* Only enable undo menu if undo actions are available.
* Allow restarting the program to update the used heap size.
* Add OC username to settings.

# Version 0.2y - 2016-02-24
Expand All @@ -192,7 +194,7 @@
# Version 0.2w - 2016-02-21

* Move filters to main menu.
* Allow to set cache coordinates as location using a right click.
* Allow setting cache coordinates as location using a right click.
* Display number of selected caches.
* Switch to HTTPS.
* Add undo support.
Expand Down Expand Up @@ -228,7 +230,7 @@
* Unify found log definition.
* Add cache name filter.
* Ignore caches ignored on OC.
* Use multithreaded filtering.
* Use multi-threaded filtering.

# Version 0.2q - 2016-01-28

Expand All @@ -240,7 +242,7 @@

# Version 0.2o - 2016-01-26

* Bugfix for multithreading.
* Bugfix for multi-threading.
* Allow reduced GPX files.

# Version 0.2n - 2016-01-19
Expand Down
16 changes: 9 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
plugins {
// Apply the versions plugin to check for module dependency updates.
id 'com.github.ben-manes.versions' version '0.28.0'
id 'com.github.ben-manes.versions' version '0.29.0'

// Apply the Google Java formatter plugin for automatically reformatting files.
id 'com.github.sherter.google-java-format' version '0.9'

// Create runtime images.
id 'org.beryx.runtime' version '1.10.0'
id 'org.beryx.runtime' version '1.11.2'
}

// Apply the java plugin to add support for Java.
Expand Down Expand Up @@ -40,7 +40,7 @@ repositories {

dependencies {
implementation group: 'commons-codec', name: 'commons-codec', version: '1.14'
implementation group: 'org.apache.commons', name: 'commons-text', version: '1.8'
implementation group: 'org.apache.commons', name: 'commons-text', version: '1.9'
implementation group: 'com.github.scribejava', name: 'scribejava-core', version: '6.9.0'
implementation group: 'org.openstreetmap.jmapviewer', name: 'jmapviewer', version: '2.14'
implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.6'
Expand All @@ -58,7 +58,7 @@ project.ext.ocOkapiPropertiesFile = projectDir.getPath() + "${File.separator}oc_
sourceCompatibility = 1.8
targetCompatibility = 1.8

version = '0.5.2'
version = '0.5.3'

wrapper {
gradleVersion = '6.5.1'
Expand Down Expand Up @@ -124,11 +124,13 @@ clean.doFirst {

jar {
archiveBaseName = 'cm'
if (project.isTravis()) version = 'ci'
if (project.isTravis()) {
archiveVersion = 'ci'
}
manifest {
attributes 'Main-Class': mainClassName
}
duplicatesStrategy = DuplicatesStrategy.INCLUDE // allow duplicates
duplicatesStrategy = DuplicatesStrategy.INCLUDE // Allow duplicates.

from {
configurations.compileClasspath.collect {
Expand Down Expand Up @@ -183,7 +185,7 @@ task jpackageImageZip(type: Zip) {
description = 'Bundles the jpackage image as a ZIP file.'
from "${buildDir}/jpackage/cmanager"
include '**/*'
archiveName "cmanager-${version}_${project.getSystemString()}.zip"
archiveName "cmanager-${archiveVersion}_${project.getSystemString()}.zip"
destinationDir file("${buildDir}/jpackage/")
}
jpackageImageZip.dependsOn jpackageImage
28 changes: 28 additions & 0 deletions src/main/java/cmanager/util/DateTimeUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,34 @@ public static boolean isTooOldWithMonths(final File file, int maximumAgeInMonths
return DateTimeUtil.isTooOldWithMonths(fileModifiedDate, maximumAgeInMonths);
}

/**
* Check if the given datetime is older than the given number of days.
*
* @param oldTime The datetime to check the invalidation for.
* @param maximumAgeInDays The maximum age in days allowed.
* @return Whether the given datetime is too old.
*/
public static boolean isTooOldWithDays(final LocalDateTime oldTime, int maximumAgeInDays) {
final LocalDateTime invalidationTime = oldTime.plusDays(maximumAgeInDays);
final LocalDateTime now = LocalDateTime.now();

return invalidationTime.isBefore(now);
}

/**
* Check if the given file is older than the given number of days.
*
* @param file The file to check the modification time for.
* @param maximumAgeInDays The maximum age in days allowed.
* @return Whether the file is too old.
*/
public static boolean isTooOldWithDays(final File file, int maximumAgeInDays) {
final LocalDateTime fileModifiedDate =
LocalDateTime.ofInstant(
Instant.ofEpochMilli(file.lastModified()), ZoneId.systemDefault());
return DateTimeUtil.isTooOldWithDays(fileModifiedDate, maximumAgeInDays);
}

/**
* Check if the given file is too old.
*
Expand Down

0 comments on commit 9339fcd

Please sign in to comment.