diff --git a/examples/lib/bld/bld-wrapper.properties b/examples/lib/bld/bld-wrapper.properties index 1b2f976..f98d857 100644 --- a/examples/lib/bld/bld-wrapper.properties +++ b/examples/lib/bld/bld-wrapper.properties @@ -1,6 +1,6 @@ #Sun Apr 02 10:32:44 PDT 2023 bld.downloadExtensionSources=true bld.downloadLocation= -bld.extension=com.uwyn.rife2:bld-property-file:0.9.6 +bld.extension=com.uwyn.rife2:bld-property-file:0.9.7-SNAPSHOT bld.repositories=MAVEN_LOCAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES bld.version=2.0.1 diff --git a/examples/version.properties b/examples/version.properties index 8a1539b..1a586ce 100644 --- a/examples/version.properties +++ b/examples/version.properties @@ -1,7 +1,7 @@ # -#Sun Jul 28 22:07:37 PDT 2024 -build.date=2024-07-28 +#Wed Aug 28 14:44:44 PDT 2024 +build.date=2024-08-28 release=beta.20240728220737 -version.major=1 +version.major=3 version.minor=1 -version.patch=20 +version.patch=10 diff --git a/src/bld/java/rife/bld/extension/propertyfile/PropertyFileBuild.java b/src/bld/java/rife/bld/extension/propertyfile/PropertyFileBuild.java index 231957f..da8b063 100644 --- a/src/bld/java/rife/bld/extension/propertyfile/PropertyFileBuild.java +++ b/src/bld/java/rife/bld/extension/propertyfile/PropertyFileBuild.java @@ -34,7 +34,7 @@ public class PropertyFileBuild extends Project { public PropertyFileBuild() { pkg = "rife.bld.extension"; name = "bld-property-file"; - version = version(0, 9, 6); + version = version(0, 9, 7, "SNAPSHOT"); javaRelease = 17; downloadSources = true; diff --git a/src/main/java/rife/bld/extension/propertyfile/PropertyFileOperation.java b/src/main/java/rife/bld/extension/propertyfile/PropertyFileOperation.java index c86204e..ec5df99 100644 --- a/src/main/java/rife/bld/extension/propertyfile/PropertyFileOperation.java +++ b/src/main/java/rife/bld/extension/propertyfile/PropertyFileOperation.java @@ -21,6 +21,7 @@ import rife.bld.operations.exceptions.ExitStatusException; import java.io.File; +import java.nio.file.Path; import java.util.ArrayList; import java.util.List; import java.util.Properties; @@ -152,8 +153,26 @@ public PropertyFileOperation file(File file) { * @return this instance */ public PropertyFileOperation file(String file) { - file_ = new File(file); - return this; + return file(new File(file)); + } + + /** + * Retrieves the location of the {@link java.util.Properties} file to be edited. + * + * @return the properties file + */ + public File file() { + return file_; + } + + /** + * Sets the location of the {@link java.util.Properties} file to be edited. + * + * @param file the file to be edited + * @return this instance + */ + public PropertyFileOperation file(Path file) { + return file(file.toFile()); } /** diff --git a/src/test/java/rife/bld/extension/propertyfile/PropertyFileOperationTest.java b/src/test/java/rife/bld/extension/propertyfile/PropertyFileOperationTest.java index 6314fbc..8fba1d0 100644 --- a/src/test/java/rife/bld/extension/propertyfile/PropertyFileOperationTest.java +++ b/src/test/java/rife/bld/extension/propertyfile/PropertyFileOperationTest.java @@ -84,4 +84,18 @@ void testExecuteNoProject() { var op = new PropertyFileOperation(); assertThatCode(op::execute).isInstanceOf(ExitStatusException.class); } + + @Test + void testFile() { + var foo = new File("foo"); + + var op = new PropertyFileOperation().file("foo"); + assertThat(op.file()).as("as string").isEqualTo(foo); + + op = new PropertyFileOperation().file(foo); + assertThat(op.file()).as("as file").isEqualTo(foo); + + op = new PropertyFileOperation().file(foo.toPath()); + assertThat(op.file()).as("as path").isEqualTo(foo); + } }