Compare commits

...

2 commits

6 changed files with 45 additions and 12 deletions

View file

@ -1,6 +1,6 @@
#Sun Apr 02 10:32:44 PDT 2023 #Sun Apr 02 10:32:44 PDT 2023
bld.downloadExtensionSources=true bld.downloadExtensionSources=true
bld.downloadLocation= 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.repositories=MAVEN_LOCAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
bld.version=2.0.1 bld.version=2.0.1

View file

@ -42,8 +42,8 @@ public class PropertyFileExampleBuild extends Project {
repositories = List.of(MAVEN_CENTRAL, RIFE2_RELEASES); repositories = List.of(MAVEN_CENTRAL, RIFE2_RELEASES);
scope(test) scope(test)
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 3))) .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 11, 0)))
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 3))); .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 11, 0)));
} }
public static void main(String[] args) { public static void main(String[] args) {

View file

@ -1,7 +1,7 @@
# #
#Sun Jul 28 22:07:37 PDT 2024 #Wed Aug 28 14:44:44 PDT 2024
build.date=2024-07-28 build.date=2024-08-28
release=beta.20240728220737 release=beta.20240728220737
version.major=1 version.major=3
version.minor=1 version.minor=1
version.patch=20 version.patch=10

View file

@ -34,7 +34,7 @@ public class PropertyFileBuild extends Project {
public PropertyFileBuild() { public PropertyFileBuild() {
pkg = "rife.bld.extension"; pkg = "rife.bld.extension";
name = "bld-property-file"; name = "bld-property-file";
version = version(0, 9, 6); version = version(0, 9, 7, "SNAPSHOT");
javaRelease = 17; javaRelease = 17;
downloadSources = true; downloadSources = true;
@ -45,8 +45,8 @@ public class PropertyFileBuild extends Project {
.include(dependency("com.uwyn.rife2", "bld", version(2, 0, 1))); .include(dependency("com.uwyn.rife2", "bld", version(2, 0, 1)));
scope(test) scope(test)
.include(dependency("org.jsoup", "jsoup", version(1, 18, 1))) .include(dependency("org.jsoup", "jsoup", version(1, 18, 1)))
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 3))) .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 11, 0)))
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 3))) .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 11, 0)))
.include(dependency("org.assertj:assertj-joda-time:2.2.0")); .include(dependency("org.assertj:assertj-joda-time:2.2.0"));
javadocOperation() javadocOperation()

View file

@ -21,6 +21,7 @@ import rife.bld.operations.AbstractOperation;
import rife.bld.operations.exceptions.ExitStatusException; import rife.bld.operations.exceptions.ExitStatusException;
import java.io.File; import java.io.File;
import java.nio.file.Path;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Properties; import java.util.Properties;
@ -152,8 +153,26 @@ public class PropertyFileOperation extends AbstractOperation<PropertyFileOperati
* @return this instance * @return this instance
*/ */
public PropertyFileOperation file(String file) { public PropertyFileOperation file(String file) {
file_ = new File(file); return file(new File(file));
return this; }
/**
* 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());
} }
/** /**

View file

@ -84,4 +84,18 @@ class PropertyFileOperationTest {
var op = new PropertyFileOperation(); var op = new PropertyFileOperation();
assertThatCode(op::execute).isInstanceOf(ExitStatusException.class); 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);
}
} }