More examples testing.

This commit is contained in:
Erik C. Thauvin 2018-07-03 19:24:30 -07:00
parent c7d46bfd7a
commit f4f0ce42ae
12 changed files with 50 additions and 38 deletions

View file

@ -3,8 +3,9 @@
**/.idea/libraries
**/.idea/tasks.xml
**/.idea/workspace.xml
*.sublime-*
*.iws
*.properties
*.sublime-*
.classpath
.DS_Store
.gradle

View file

@ -1,9 +1,14 @@
// plugins {
// id 'java'
// id 'application'
// id "net.thauvin.erik.gradle.semver" version "0.9.4-beta"
// }
buildscript {
repositories {
mavenLocal()
}
dependencies {
classpath "net.thauvin.erik.gradle:semver:0.9.4-beta"
classpath "net.thauvin.erik.gradle:semver:0.9.5-beta"
}
}
@ -15,6 +20,8 @@ mainClassName = 'App'
version = 1.0
def f = new File("test.properties")
dependencies {
}
@ -23,21 +30,26 @@ repositories {
jcenter()
}
task cleanVersion {
delete "test.properties"
clean {
delete fileTree(dir: "$projectDir", include: "*.properties")
}
clean.dependsOn("cleanVersion")
incrementPatch {
doFirst {
println("[Gradle] exists: " + f.exists() + ", canRead: " + f.canRead())
}
}
run {
//dependsOn("incrementPatch")
//dependsOn("incrementPatch")
doFirst {
println("Version: $version")
args = [f.name]
}
}
semver {
properties = "$projectDir/example.properties"
keysPrefix = "example."
properties = "$projectDir/${f.name}"
keysPrefix = f.name.substring(0, f.name.indexOf(".") + 1)
buildMetaKey = "meta"
}

View file

@ -1,7 +0,0 @@
#Generated by the Semver Plugin for Gradle
#Tue Jul 03 13:33:49 PDT 2018
example.major=2
example.meta=007
example.prerelease=beta
example.minor=1
example.patch=12

View file

@ -1,12 +1,21 @@
/*
* This Java source file was generated by the Gradle 'init' task.
*/
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
public class App {
public String getGreeting() {
return "Hello world.";
public static void main(String[] args) {
new App().cat(args[0]);
}
public static void main(String[] args) {
System.out.println(new App().getGreeting());
public void cat(String name) {
try {
final List<String> content = Files.readAllLines(Paths.get(name));
for (String line : content) {
if (!line.startsWith("#")) System.out.println(line);
}
} catch (IOException e) {
System.out.println(e);
}
}
}
}

View file

@ -1,11 +1,14 @@
/*
* This Java source file was generated by the Gradle 'init' task.
*/
import org.junit.Test;
import static org.junit.Assert.*;
public class AppTest {
@Test public void testAppHasAGreeting() {
@Test
public void testAppHasAGreeting() {
App classUnderTest = new App();
assertNotNull("app should have a greeting", classUnderTest.getGreeting());
}

View file

@ -0,0 +1,4 @@
f = new File("K:\\kotlin\\semver-gradle\\examples\\test\\examples.properties")
println(f.absoluteFile)
println(f.exists())
println(f.canRead())

View file

@ -1,7 +0,0 @@
#Generated by the Semver Plugin for Gradle
#Mon Jul 02 22:37:14 PDT 2018
version.prerelease=
version.buildmeta=
version.patch=3
version.major=1
version.minor=0