Initial commit
This commit is contained in:
commit
387d1a93e7
52 changed files with 1917 additions and 0 deletions
|
@ -0,0 +1,62 @@
|
|||
package com.example;
|
||||
|
||||
import rife.bld.BuildCommand;
|
||||
import rife.bld.Project;
|
||||
import rife.bld.extension.propertyFile.Entry;
|
||||
import rife.bld.extension.propertyFile.Entry.Operations;
|
||||
import rife.bld.extension.propertyFile.Entry.Types;
|
||||
import rife.bld.extension.propertyFile.PropertyFileOperation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static rife.bld.dependencies.Repository.MAVEN_CENTRAL;
|
||||
import static rife.bld.dependencies.Repository.SONATYPE_SNAPSHOTS;
|
||||
import static rife.bld.dependencies.Scope.test;
|
||||
|
||||
public class PropertyFileExampleBuild extends Project {
|
||||
|
||||
public PropertyFileExampleBuild() {
|
||||
pkg = "com.example";
|
||||
name = "PropertyFileExample";
|
||||
mainClass = "com.example.PropertyFileExampleMain";
|
||||
version = version(0, 1, 0);
|
||||
|
||||
downloadSources = true;
|
||||
repositories = List.of(MAVEN_CENTRAL, SONATYPE_SNAPSHOTS);
|
||||
scope(test)
|
||||
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 9, 2)))
|
||||
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 9, 2)));
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
new PropertyFileExampleBuild().start(args);
|
||||
}
|
||||
|
||||
@BuildCommand
|
||||
public void updateMajor() throws Exception {
|
||||
new PropertyFileOperation(this)
|
||||
.file("version.properties")
|
||||
.entry(new Entry("version.major").defaultValue(1).type(Types.INT).operation(Operations.ADD))
|
||||
.entry(new Entry("version.minor").value(0))
|
||||
.entry(new Entry("version.patch").value(0))
|
||||
.execute();
|
||||
}
|
||||
|
||||
@BuildCommand
|
||||
public void updateMinor() throws Exception {
|
||||
new PropertyFileOperation(this)
|
||||
.file("version.properties")
|
||||
.entry(new Entry("version.minor").defaultValue(0).type(Types.INT).operation(Operations.ADD))
|
||||
.entry(new Entry("version.patch").value(0))
|
||||
.execute();
|
||||
}
|
||||
|
||||
@BuildCommand
|
||||
public void updatePatch() throws Exception {
|
||||
new PropertyFileOperation(this)
|
||||
.file("version.properties")
|
||||
.entry(new Entry("version.patch").defaultValue(0).type(Types.INT).operation(Operations.ADD))
|
||||
.execute();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.example;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.List;
|
||||
|
||||
public class PropertyFileExampleMain {
|
||||
public static void main(String[] args) throws IOException {
|
||||
final Path path = Paths.get("version.properties");
|
||||
if (Files.exists(path)) {
|
||||
final List<String> content = Files.readAllLines(path);
|
||||
System.out.println("> cat " + path.getFileName());
|
||||
for (final String line : content) {
|
||||
System.out.println(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return "Hello World!";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package com.example;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
public class PropertyFileExampleTest {
|
||||
@Test
|
||||
void verifyHello() {
|
||||
assertEquals("Hello World!", new PropertyFileExampleMain().getMessage());
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue