Added support for mustache instead of Velocity.

This commit is contained in:
Erik C. Thauvin 2017-04-14 22:27:07 -07:00
parent 13dec4f063
commit 5efb2a9e1d
10 changed files with 199 additions and 133 deletions

View file

@ -0,0 +1,46 @@
/*
* This file is automatically generated.
* Do not modify! -- ALL CHANGES WILL BE ERASED!
*/
package {{packageName}}
import java.util.*
/**
* Provides semantic version information.
*
* @author <a href="https://github.com/ethauvin/semver">Semantic Version
* Annotation Processor</a>
*/
open class {{className}}
private constructor() {
companion object {
val project = "{{project}}"
val buildDate = Date({{epoch}}L)
val major = {{major}}
val minor = {{minor}}
val patch = {{patch}}
val buildMeta = "{{buildMeta}}"
val preRelease = "{{preRelease}}"
val version: String
get() = ("$major.$minor.$patch" + preReleaseWithPrefix() + buildMetaWithPrefix())
fun preReleaseWithPrefix(prefix: String = "-"): String {
return if (preRelease.isNotEmpty() && prefix.isNotEmpty()) {
"$prefix$preRelease"
} else {
preRelease
}
}
fun buildMetaWithPrefix(prefix: String = "+"): String {
return if (buildMeta.isNotEmpty() && prefix.isNotEmpty()) {
"$prefix$buildMeta"
} else {
buildMeta
}
}
}
}