From e90927d17797257ea5905e1be0b95ed040f9e05e Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Wed, 29 Jun 2016 23:35:38 -0700 Subject: [PATCH] Updated pandoc task. --- README.html | 97 ++++++++++++++++++---------------------------------- build.gradle | 2 +- 2 files changed, 35 insertions(+), 64 deletions(-) diff --git a/README.html b/README.html index 1f56b8f..5aa8959 100644 --- a/README.html +++ b/README.html @@ -6,83 +6,60 @@ + -

Semantic Version Annotation Processor

-

License (3-Clause BSD) Dependency Status Build Status Build status Maven Central Download

+

Build status Maven Central Download

An annotation processor that automatically generates a GeneratedVersion class containing the semantic version (major, minor, patch, etc.) that is read from a Properties file or defined in the annotation.

This processor was inspired by Cédric Beust's version-processor.

Examples

-
@Version(major = 1, minor = 0, patch = 0, prerelease = "beta")
+
@Version(major = 1, minor = 0, patch = 0, prerelease = "beta")
 public class A {
-// ...
+// ... -
@Version(properties = "version.properties")
+
@Version(properties = "version.properties")
 public class A {
-// ...
-
# version.properties
+// ...
+
# version.properties
 version.major=1
 version.minor=0
 version.patch=0
-version.prerelease=beta
+version.prerelease=beta

Template

Upon running the annotator processor, a source file GeneratedVersion.java is automatically generated with static methods to access the semantic version data. The source is based on a fully customizable Velocity template.

-
@Version(template = "myversion.vm")
+
@Version(template = "myversion.vm")
 public class A {
-// ...
+// ...

Default Template

The default template implements the following static methods:

- ----- +
@@ -135,7 +112,7 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
Method

Custom Template

A very simple custom template might look something like:

-
/* myversion.vm */
+
/* myversion.vm */
 package ${packageName}
 
 import java.util.Date;
@@ -148,17 +125,11 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
     public final static int PATCH = ${patch};
     public final static String PRERELEASE = "${prerelease}";
     public final static String PROJECT = "${project}";
-}
+}

The Velocity variables are automatically filled in by the processor.

Elements & Properties

The following annotation elements and properties are available:

- ------ +
@@ -221,7 +192,7 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
Element

In order to easily incorporate with existing projects, the property keys may be assigned custom values:

-
@Version(
+
@Version(
   properties = "example.properties", 
   majorKey = "example.major",
   minorKey = "example.minor",
@@ -231,21 +202,21 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
   projectKey = "example.project"
 )
 public class Example {
-// ...
-
# example.properties
+// ...
+
# example.properties
 example.project=Example
 example.major=1
 example.minor=0
 example.patch=0
-# ...
+# ...

Usage with Maven, Grail and Kobalt

Maven

To install and run from Maven, configure an artifact as follows:

-
<dependency>
+
<dependency>
     <groupId>net.thauvin.erik</groupId>
     <artifactId>semver</artifactId>
     <version>0.9.5-beta</version>
-</dependency>
+</dependency>

Gradle

Class Generation

To install and run from Gradle, add the following to the build.gradle file:

diff --git a/build.gradle b/build.gradle index 2ed33a1..e1d209b 100644 --- a/build.gradle +++ b/build.gradle @@ -206,7 +206,7 @@ task pandoc(type: Exec) { if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine(['cmd', '/c', 'pandoc'] + pandoc_args) } else { - executable '/usr/local/bin/pandoc' + executable 'pandoc' args pandoc_args } standardOutput = new ByteArrayOutputStream()