Upaded default template.

This commit is contained in:
Erik C. Thauvin 2016-01-27 19:01:23 -08:00
parent 0d37a19c63
commit 703362c2b3
6 changed files with 103 additions and 103 deletions

View file

@ -76,7 +76,7 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
<span class="kw">public</span> <span class="kw">class</span> A { <span class="kw">public</span> <span class="kw">class</span> A {
<span class="co">// ...</span></code></pre></div> <span class="co">// ...</span></code></pre></div>
<h3 id="default-template">Default Template</h3> <h3 id="default-template">Default Template</h3>
<p>The default template implements the following static methods:</p> <p>The <a href="https://github.com/ethauvin/semver/blob/master/src/main/resources/version.vm">default template</a> implements the following static methods:</p>
<table style="width:101%;"> <table style="width:101%;">
<colgroup> <colgroup>
<col style="width: 26%" /> <col style="width: 26%" />
@ -274,7 +274,7 @@ compileJava {
options.compilerArgs &lt;&lt; &#39;-proc:none&#39; options.compilerArgs &lt;&lt; &#39;-proc:none&#39;
}</code></pre> }</code></pre>
<p>The plugin implements a separate compile task that only runs the annotation processor and is executed during the build phase.</p> <p>The plugin implements a separate compile task that only runs the annotation processor and is executed during the build phase.</p>
<p>Please look at the <code>build.gradle</code> file in the <code>example</code> module directory for a sample.</p> <p>Please look at the <code>build.gradle</code> file in the <a href="https://github.com/ethauvin/semver/tree/master/example">example</a> module directory for a sample.</p>
<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 {
@ -282,7 +282,7 @@ compileJava {
}</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>
<p>For a solution using <a href="https://gradle.org/">Gradle</a>, please have a look at the <code>build.gradle</code> file in the <code>example</code> module directory. To run the example with patch version auto-incrementing, issue the following command:</p> <p>For a solution using <a href="https://gradle.org/">Gradle</a>, please have a look at the <a href="https://github.com/ethauvin/semver/blob/master/example/build.gradle">build.gradle</a> file in the <a href="https://github.com/ethauvin/semver/tree/master/example">example</a> module directory. To run the example with patch version auto-incrementing, issue the following command:</p>
<pre><code>gradle clean release run</code></pre> <pre><code>gradle clean release run</code></pre>
</body> </body>
</html> </html>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="semver" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="0.9.1-beta" type="JAVA_MODULE" version="4"> <module external.linked.project.id="semver" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="0.9.2-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" />

View file

@ -305,7 +305,7 @@
</XML> </XML>
</value> </value>
</option> </option>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Erik's Code Style" /> <option name="USE_PER_PROJECT_SETTINGS" value="true" />
</component> </component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false"> <component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" /> <OptionsSetting value="true" id="Add" />

View file

@ -20,109 +20,109 @@ public final class ${className} {
private final static String prerelease = "${prerelease}"; private final static String prerelease = "${prerelease}";
private final static String project = "${project}"; private final static String project = "${project}";
/** /**
* Returns the build date. * Disables the default constructor.
* *
* @return The build date. * @throws UnsupportedOperationException if the constructor is called.
*/ */
public static Date getBuildDate() { private GeneratedVersion()
return date; throws UnsupportedOperationException {
} throw new UnsupportedOperationException("Illegal constructor call.");
}
/** /**
* Returns the full version string. * Returns the build date.
* <p> *
* Formatted as: * @return The build date.
* <blockquote> */
* <code>MAJOR.MINOR.PATCH[-PRERELEASE][+BUILDMETADATA]</code> public static Date getBuildDate() {
* </blockquote> return date;
* <p> }
* For example:
* <ul>
* <li><code>1.0.0</code></li>
* <li><code>1.0.0-beta</code></li>
* <li><code>1.0.0+20160124144700</code></li>
* <li><code>1.0.0-alpha+001</code></li>
* </ul>
*
* @return The version string.
*/
public static String getVersion() {
return Integer.toString(getMajor()) + '.'
+ Integer.toString(getMinor()) + '.'
+ Integer.toString(getPatch())
+ getPreRelease() + getBuildMetadata();
}
/** /**
* Returns the major version. * Returns the project name.
* *
* @return The major version. * @return The project name, if any.
*/ */
public static int getMajor() { public static String getProject() {
return major; return project;
} }
/** /**
* Returns the minor version. * Returns the full version string.
* * <p>
* @return The minor version. * Formatted as:
*/ * <blockquote>
public static int getMinor() { * <code>MAJOR.MINOR.PATCH[-PRERELEASE][+BUILDMETADATA]</code>
return minor; * </blockquote>
} * <p>
* For example:
* <ul>
* <li><code>1.0.0</code></li>
* <li><code>1.0.0-beta</code></li>
* <li><code>1.0.0+20160124144700</code></li>
* <li><code>1.0.0-alpha+001</code></li>
* </ul>
*
* @return The version string.
*/
public static String getVersion() {
return Integer.toString(getMajor()) + '.'
+ Integer.toString(getMinor()) + '.'
+ Integer.toString(getPatch())
+ getPreRelease() + getBuildMetadata();
}
/** /**
* Returns the patch version. * Returns the major version.
* *
* @return The patch version. * @return The major version.
*/ */
public static int getPatch() { public static int getMajor() {
return patch; return major;
} }
/** /**
* Returns the pre-release version. * Returns the minor version.
* *
* @return The pre-release version, if any. * @return The minor version.
*/ */
public static String getPreRelease() { public static int getMinor() {
if (prerelease.length() > 0) { return minor;
return '-' + prerelease; }
}
return ""; /**
} * Returns the patch version.
*
* @return The patch version.
*/
public static int getPatch() {
return patch;
}
/** /**
* Returns the project name. * Returns the pre-release version.
* *
* @return The project name, if any. * @return The pre-release version, if any.
*/ */
public static String getProject() { public static String getPreRelease() {
return project; if (prerelease.length() > 0) {
} return '-' + prerelease;
}
/** return "";
* Returns the build metadata. }
*
* @return The build metadata, if any.
*/
public static String getBuildMetadata() {
if (buildmeta.length() > 0) {
return '+' + buildmeta;
}
return ""; /**
} * Returns the build metadata.
*
* @return The build metadata, if any.
*/
public static String getBuildMetadata() {
if (buildmeta.length() > 0) {
return '+' + buildmeta;
}
/** return "";
* Disables the default constructor. }
*
* @throws UnsupportedOperationException if the constructor is called.
*/
private ${className}()
throws UnsupportedOperationException {
throw new UnsupportedOperationException("Illegal constructor call.");
}
} }