Added test.
This commit is contained in:
parent
f9dd17da1f
commit
ac2088aa54
10 changed files with 274 additions and 211 deletions
10
README.html
10
README.html
|
@ -244,13 +244,13 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
|
||||||
<div class="sourceCode"><pre class="sourceCode xml"><code class="sourceCode xml"><span class="kw"><dependency></span>
|
<div class="sourceCode"><pre class="sourceCode xml"><code class="sourceCode xml"><span class="kw"><dependency></span>
|
||||||
<span class="kw"><groupId></span>net.thauvin.erik<span class="kw"></groupId></span>
|
<span class="kw"><groupId></span>net.thauvin.erik<span class="kw"></groupId></span>
|
||||||
<span class="kw"><artifactId></span>semver<span class="kw"></artifactId></span>
|
<span class="kw"><artifactId></span>semver<span class="kw"></artifactId></span>
|
||||||
<span class="kw"><version></span>0.9.4-beta<span class="kw"></version></span>
|
<span class="kw"><version></span>0.9.5-beta<span class="kw"></version></span>
|
||||||
<span class="kw"></dependency></span></code></pre></div>
|
<span class="kw"></dependency></span></code></pre></div>
|
||||||
<h3 id="gradle">Gradle</h3>
|
<h3 id="gradle">Gradle</h3>
|
||||||
<h4 id="class-generation">Class Generation</h4>
|
<h4 id="class-generation">Class Generation</h4>
|
||||||
<p>To install and run from <a href="https://gradle.org/">Gradle</a>, add the following to the <code>build.gradle</code> file:</p>
|
<p>To install and run from <a href="https://gradle.org/">Gradle</a>, add the following to the <code>build.gradle</code> file:</p>
|
||||||
<pre class="gradle"><code>dependencies {
|
<pre class="gradle"><code>dependencies {
|
||||||
compile 'net.thauvin.erik:semver:0.9.4-beta'
|
compile 'net.thauvin.erik:semver:0.9.5-beta'
|
||||||
}</code></pre>
|
}</code></pre>
|
||||||
<p>The <code>GeneratedVersion</code> class will be automatically created in the <code>build</code> directory upon compiling.</p>
|
<p>The <code>GeneratedVersion</code> class will be automatically created in the <code>build</code> directory upon compiling.</p>
|
||||||
<h4 id="class-source-generation">Class & Source Generation</h4>
|
<h4 id="class-source-generation">Class & Source Generation</h4>
|
||||||
|
@ -260,11 +260,11 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
|
||||||
}</code></pre>
|
}</code></pre>
|
||||||
<p>Then add the following to the <code>build.gradle</code> file:</p>
|
<p>Then add the following to the <code>build.gradle</code> file:</p>
|
||||||
<pre class="gradle"><code>dependencies {
|
<pre class="gradle"><code>dependencies {
|
||||||
compile 'net.thauvin.erik:semver:0.9.4-beta'
|
compile 'net.thauvin.erik:semver:0.9.5-beta'
|
||||||
}
|
}
|
||||||
|
|
||||||
annotationProcessor {
|
annotationProcessor {
|
||||||
library 'net.thauvin.erik:semver:0.9.4-beta'
|
library 'net.thauvin.erik:semver:0.9.5-beta'
|
||||||
processor 'net.thauvin.erik.semver.VersionProcessor'
|
processor 'net.thauvin.erik.semver.VersionProcessor'
|
||||||
// sourcesDir 'src/generated/java'
|
// sourcesDir 'src/generated/java'
|
||||||
}
|
}
|
||||||
|
@ -278,7 +278,7 @@ compileJava {
|
||||||
<h3 id="kobalt">Kobalt</h3>
|
<h3 id="kobalt">Kobalt</h3>
|
||||||
<p>To install and run from <a href="http://beust.com/kobalt/">Kobalt</a>, add the following to the <code>Build.kt</code> file:</p>
|
<p>To install and run from <a href="http://beust.com/kobalt/">Kobalt</a>, add the following to the <code>Build.kt</code> file:</p>
|
||||||
<pre class="gradle"><code>dependencies {
|
<pre class="gradle"><code>dependencies {
|
||||||
apt("net.thauvin.erik:semver:0.9.4-beta")
|
apt("net.thauvin.erik:semver:0.9.5-beta")
|
||||||
}</code></pre>
|
}</code></pre>
|
||||||
<h3 id="auto-increment">Auto-Increment</h3>
|
<h3 id="auto-increment">Auto-Increment</h3>
|
||||||
<p>Incrementing the version is best left to your favorite build system.</p>
|
<p>Incrementing the version is best left to your favorite build system.</p>
|
||||||
|
|
10
README.md
10
README.md
|
@ -129,7 +129,7 @@ To install and run from [Maven](http://maven.apache.org/), configure an artifact
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.thauvin.erik</groupId>
|
<groupId>net.thauvin.erik</groupId>
|
||||||
<artifactId>semver</artifactId>
|
<artifactId>semver</artifactId>
|
||||||
<version>0.9.4-beta</version>
|
<version>0.9.5-beta</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ To install and run from [Gradle](https://gradle.org/), add the following to the
|
||||||
|
|
||||||
```gradle
|
```gradle
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'net.thauvin.erik:semver:0.9.4-beta'
|
compile 'net.thauvin.erik:semver:0.9.5-beta'
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -161,11 +161,11 @@ Then add the following to the `build.gradle` file:
|
||||||
|
|
||||||
```gradle
|
```gradle
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'net.thauvin.erik:semver:0.9.4-beta'
|
compile 'net.thauvin.erik:semver:0.9.5-beta'
|
||||||
}
|
}
|
||||||
|
|
||||||
annotationProcessor {
|
annotationProcessor {
|
||||||
library 'net.thauvin.erik:semver:0.9.4-beta'
|
library 'net.thauvin.erik:semver:0.9.5-beta'
|
||||||
processor 'net.thauvin.erik.semver.VersionProcessor'
|
processor 'net.thauvin.erik.semver.VersionProcessor'
|
||||||
// sourcesDir 'src/generated/java'
|
// sourcesDir 'src/generated/java'
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ To install and run from [Kobalt](http://beust.com/kobalt/), add the following to
|
||||||
|
|
||||||
```gradle
|
```gradle
|
||||||
dependencies {
|
dependencies {
|
||||||
apt("net.thauvin.erik:semver:0.9.4-beta")
|
apt("net.thauvin.erik:semver:0.9.5-beta")
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
10
build.gradle
10
build.gradle
|
@ -158,8 +158,7 @@ javadoc {
|
||||||
options.author = true
|
options.author = true
|
||||||
options.addStringOption('link', 'http://docs.oracle.com/javase/8/docs/api/')
|
options.addStringOption('link', 'http://docs.oracle.com/javase/8/docs/api/')
|
||||||
options.addStringOption('sourcepath', project.hasProperty('jdkSrc') ? jdkSrc : "$System.env.JAVA_HOME/src.zip")
|
options.addStringOption('sourcepath', project.hasProperty('jdkSrc') ? jdkSrc : "$System.env.JAVA_HOME/src.zip")
|
||||||
if (JavaVersion.current().isJava8Compatible())
|
if (JavaVersion.current().isJava8Compatible()) {
|
||||||
{
|
|
||||||
options.addStringOption('Xdoclint:none', '-quiet')
|
options.addStringOption('Xdoclint:none', '-quiet')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -204,12 +203,9 @@ task release(dependsOn: ['deploy', 'wrapper']) << {
|
||||||
task pandoc(type: Exec) {
|
task pandoc(type: Exec) {
|
||||||
group = 'Documentation'
|
group = 'Documentation'
|
||||||
def pandoc_args = ['--from', 'markdown_github', '--to', 'html5', '-s', '-o', 'README.html', 'README.md']
|
def pandoc_args = ['--from', 'markdown_github', '--to', 'html5', '-s', '-o', 'README.html', 'README.md']
|
||||||
if (Os.isFamily(Os.FAMILY_WINDOWS))
|
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
||||||
{
|
|
||||||
commandLine(['cmd', '/c', 'pandoc'] + pandoc_args)
|
commandLine(['cmd', '/c', 'pandoc'] + pandoc_args)
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
executable '/usr/local/bin/pandoc'
|
executable '/usr/local/bin/pandoc'
|
||||||
args pandoc_args
|
args pandoc_args
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,13 +45,13 @@ repositories {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'net.thauvin.erik:semver:0.9.4-beta'
|
compile 'net.thauvin.erik:semver:0.9.5-beta'
|
||||||
}
|
}
|
||||||
|
|
||||||
annotationProcessor {
|
annotationProcessor {
|
||||||
// Update version, increment on release.
|
// Update version, increment on release.
|
||||||
project.version = getVersion(isRelease)
|
project.version = getVersion(isRelease)
|
||||||
library 'net.thauvin.erik:semver:0.9.4-beta'
|
library 'net.thauvin.erik:semver:0.9.5-beta'
|
||||||
processor 'net.thauvin.erik.semver.VersionProcessor'
|
processor 'net.thauvin.erik.semver.VersionProcessor'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<module external.linked.project.id="example" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="3.1.37-beta" type="JAVA_MODULE" version="4">
|
<module external.linked.project.id="example" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="3.1.38-beta" type="JAVA_MODULE" version="4">
|
||||||
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
||||||
<output url="file://$MODULE_DIR$/build/classes/main" />
|
<output url="file://$MODULE_DIR$/build/classes/main" />
|
||||||
<output-test url="file://$MODULE_DIR$/build/classes/test" />
|
<output-test url="file://$MODULE_DIR$/build/classes/test" />
|
||||||
|
@ -16,10 +16,6 @@
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="library" name="Gradle: org.apache.velocity:velocity:1.7" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: commons-collections:commons-collections:3.2.1" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: commons-lang:commons-lang:2.4" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: net.thauvin.erik:semver:0.9.4-beta" level="project" />
|
|
||||||
</component>
|
</component>
|
||||||
<component name="org.twodividedbyzero.idea.findbugs">
|
<component name="org.twodividedbyzero.idea.findbugs">
|
||||||
<option name="_basePreferences">
|
<option name="_basePreferences">
|
||||||
|
|
|
@ -1,22 +1,23 @@
|
||||||
/*
|
/*
|
||||||
* This file is automatically generated by the Semantic Version Annotation Processor.
|
* This file is automatically generated.
|
||||||
* Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
* Do not modify! -- ALL CHANGES WILL BE ERASED!
|
||||||
*/
|
*/
|
||||||
package net.thauvin.erik.semver.example;
|
package net.thauvin.erik.semver.example;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This <code>GeneratedVersion</code> class provides semantic version information.
|
* Provides semantic version information.
|
||||||
*
|
*
|
||||||
* @author Semantic Version Annotation Processor
|
* @author <a href="https://github.com/ethauvin/semver">Semantic Version
|
||||||
|
* Annotation Processor</a>
|
||||||
*/
|
*/
|
||||||
public final class GeneratedVersion {
|
public final class GeneratedVersion {
|
||||||
private final static String buildmeta = "";
|
private final static String buildmeta = "";
|
||||||
private final static Date date = new Date(1454031375359L);
|
private final static Date date = new Date(1454533811647L);
|
||||||
private final static int major = 3;
|
private final static int major = 3;
|
||||||
private final static int minor = 1;
|
private final static int minor = 1;
|
||||||
private final static int patch = 37;
|
private final static int patch = 39;
|
||||||
private final static String prerelease = "beta";
|
private final static String prerelease = "beta";
|
||||||
private final static String project = "Example";
|
private final static String project = "Example";
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#Sat, 23 Jan 2016 18:16:26 -0800
|
#Wed, 03 Feb 2016 13:10:11 -0800
|
||||||
version.project=Example
|
version.project=Example
|
||||||
version.major=3
|
version.major=3
|
||||||
version.minor=1
|
version.minor=1
|
||||||
version.patch=37
|
version.patch=39
|
||||||
version.buildmeta=
|
version.buildmeta=
|
||||||
version.prerelease=beta
|
version.prerelease=beta
|
||||||
|
|
13
semver.ipr
13
semver.ipr
|
@ -72,7 +72,7 @@
|
||||||
</LanguageOptions>
|
</LanguageOptions>
|
||||||
</component>
|
</component>
|
||||||
<component name="DependencyValidationManager">
|
<component name="DependencyValidationManager">
|
||||||
<scope name="Source" pattern="file[example]:src/main/java/*.java||file[semver]:src/main/java/*.java" />
|
<scope name="Source" pattern="file[example]:src/main/java/*.java||file[semver]:src/main/java/*.java||file[semver]:src/test/java/*.java" />
|
||||||
</component>
|
</component>
|
||||||
<component name="Encoding">
|
<component name="Encoding">
|
||||||
<file url="PROJECT" charset="UTF-8" />
|
<file url="PROJECT" charset="UTF-8" />
|
||||||
|
@ -305,7 +305,7 @@
|
||||||
</XML>
|
</XML>
|
||||||
</value>
|
</value>
|
||||||
</option>
|
</option>
|
||||||
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Erik's Code Style" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
||||||
<OptionsSetting value="true" id="Add" />
|
<OptionsSetting value="true" id="Add" />
|
||||||
|
@ -357,15 +357,6 @@
|
||||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/commons-lang/commons-lang/2.4/2b8c4b3035e45520ef42033e823c7d33e4b4402c/commons-lang-2.4-sources.jar!/" />
|
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/commons-lang/commons-lang/2.4/2b8c4b3035e45520ef42033e823c7d33e4b4402c/commons-lang-2.4-sources.jar!/" />
|
||||||
</SOURCES>
|
</SOURCES>
|
||||||
</library>
|
</library>
|
||||||
<library name="Gradle: net.thauvin.erik:semver:0.9.4-beta">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/net/thauvin/erik/semver/0.9.4-beta/semver-0.9.4-beta.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC />
|
|
||||||
<SOURCES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/net/thauvin/erik/semver/0.9.4-beta/semver-0.9.4-beta-sources.jar!/" />
|
|
||||||
</SOURCES>
|
|
||||||
</library>
|
|
||||||
<library name="Gradle: org.apache.velocity:velocity:1.7">
|
<library name="Gradle: org.apache.velocity:velocity:1.7">
|
||||||
<CLASSES>
|
<CLASSES>
|
||||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.velocity/velocity/1.7/2ceb567b8f3f21118ecdec129fe1271dbc09aa7a/velocity-1.7.jar!/" />
|
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.velocity/velocity/1.7/2ceb567b8f3f21118ecdec129fe1271dbc09aa7a/velocity-1.7.jar!/" />
|
||||||
|
|
79
src/test/java/net/thauvin/erik/semver/VersionInfoTest.java
Normal file
79
src/test/java/net/thauvin/erik/semver/VersionInfoTest.java
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
/*
|
||||||
|
* VersionInfoTest.java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2016, Erik C. Thauvin (erik@thauvin.net)
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* Neither the name of this project nor the names of its contributors may be
|
||||||
|
* used to endorse or promote products derived from this software without
|
||||||
|
* specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package net.thauvin.erik.semver;
|
||||||
|
|
||||||
|
import org.testng.Assert;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The <code>VersionInfoTest</code> class.
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
|
||||||
|
* @created 2016-02-03
|
||||||
|
* @since 1.0
|
||||||
|
*/
|
||||||
|
public class VersionInfoTest
|
||||||
|
{
|
||||||
|
@Test
|
||||||
|
public void testGetVersion()
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
|
||||||
|
final VersionInfo version = new VersionInfo();
|
||||||
|
|
||||||
|
Assert.assertEquals(version.getVersion(), "1.0.0");
|
||||||
|
|
||||||
|
version.setMajor(3);
|
||||||
|
|
||||||
|
Assert.assertEquals(version.getVersion(), "3.0.0");
|
||||||
|
|
||||||
|
version.setMinor(2);
|
||||||
|
|
||||||
|
Assert.assertEquals(version.getVersion(), "3.2.0");
|
||||||
|
|
||||||
|
version.setPatch(1);
|
||||||
|
|
||||||
|
Assert.assertEquals(version.getVersion(), "3.2.1");
|
||||||
|
|
||||||
|
version.setPreRelease("beta");
|
||||||
|
|
||||||
|
Assert.assertEquals(version.getVersion(), "3.2.1-beta");
|
||||||
|
|
||||||
|
version.setBuildMetadata("001");
|
||||||
|
|
||||||
|
Assert.assertEquals(version.getVersion(), "3.2.1-beta+001");
|
||||||
|
|
||||||
|
version.setPreRelease("");
|
||||||
|
|
||||||
|
Assert.assertEquals(version.getVersion(), "3.2.1+001");
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
#Thu, 28 Jan 2016 17:33:17 -0800
|
#Thu, 28 Jan 2016 17:33:17 -0800
|
||||||
version.major=0
|
version.major=0
|
||||||
version.minor=9
|
version.minor=9
|
||||||
version.patch=4
|
version.patch=5
|
||||||
version.buildmeta=
|
version.buildmeta=
|
||||||
version.prerelease=beta
|
version.prerelease=beta
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue