Cleaned up API to match bld operations aand options APIs
This commit is contained in:
parent
15034b4363
commit
2600e74be7
5 changed files with 41 additions and 8 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -21,6 +21,7 @@ import rife.bld.operations.AbstractOperation;
|
|||
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 class PropertyFileOperation extends AbstractOperation<PropertyFileOperati
|
|||
* @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());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -84,4 +84,18 @@ class PropertyFileOperationTest {
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue