diff --git a/.gitignore b/.gitignore index 068863fc..333ebb78 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,4 @@ user.gradle .settings *.classpath *.project - +gradle.properties diff --git a/README.adoc b/README.adoc index 83f1fe54..89bbd7bd 100644 --- a/README.adoc +++ b/README.adoc @@ -22,14 +22,14 @@ buildscript { } dependencies { - classpath 'me.champeau.gradle:jbake-gradle-plugin:0.2' + classpath 'me.champeau.gradle:jbake-gradle-plugin:0.2.1' } } apply plugin: 'me.champeau.jbake' ---- -This will add a `jbake` task to your build, which will search for a standard http://www.jbake.org[JBake] source tree in +This will add a `bake` task to your build, which will search for a standard http://www.jbake.org[JBake] source tree in `src/jbake` and generate content into `$buildDir/jbake` (typically `build/jbake`). == Configuration diff --git a/atlassian-ide-plugin.xml b/atlassian-ide-plugin.xml new file mode 100644 index 00000000..b68e35d1 --- /dev/null +++ b/atlassian-ide-plugin.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/build.gradle b/build.gradle index 039558db..e5704dfe 100644 --- a/build.gradle +++ b/build.gradle @@ -23,6 +23,7 @@ repositories { dependencies { compile gradleApi() compile localGroovy() + compile 'com.github.zafarkhaja:java-semver:0.8.0' provided 'org.jbake:jbake-core:2.3.2' testCompile('org.spockframework:spock-core:0.7-groovy-2.0') { exclude group:'org.codehaus.groovy' diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 3d0dee6e..085a1cdc 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b18954d6..fd286ef4 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Oct 03 18:00:04 CEST 2014 +#Sun May 03 12:39:37 CEST 2015 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.3-bin.zip diff --git a/src/main/groovy/me/champeau/gradle/JBakePlugin.groovy b/src/main/groovy/me/champeau/gradle/JBakePlugin.groovy index efa469e7..1a5515f0 100644 --- a/src/main/groovy/me/champeau/gradle/JBakePlugin.groovy +++ b/src/main/groovy/me/champeau/gradle/JBakePlugin.groovy @@ -15,6 +15,7 @@ */ package me.champeau.gradle +import com.github.zafarkhaja.semver.Version import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.api.artifacts.Configuration @@ -39,7 +40,7 @@ class JBakePlugin implements Plugin { addDependenciesAfterEvaluate() - project.task('jbake', type: JBakeTask, group: 'Documentation', description: 'Bake a jbake project'){ + project.task('bake', type: JBakeTask, group: 'Documentation', description: 'Bake a jbake project'){ classpath = configuration conventionMapping.input = { project.file("$project.projectDir/$project.jbake.srcDirName") } @@ -60,7 +61,9 @@ class JBakePlugin implements Plugin { project.dependencies { jbake("org.jbake:jbake-core:${extension.version}") - if ( new Version(extension.version) > new Version("2.3.0") ){ + Version currentVersion = Version.valueOf(extension.version) + Version jbake2_3_0 = Version.valueOf("2.3.0") + if ( currentVersion.greaterThan( jbake2_3_0 ) ){ jbake("org.asciidoctor:asciidoctorj:${extension.asciidoctorjVersion}") } else { diff --git a/src/main/groovy/me/champeau/gradle/Version.groovy b/src/main/groovy/me/champeau/gradle/Version.groovy deleted file mode 100644 index 6b9c8729..00000000 --- a/src/main/groovy/me/champeau/gradle/Version.groovy +++ /dev/null @@ -1,51 +0,0 @@ -package me.champeau.gradle - -/** - * Created by frank on 13.10.14. - */ -class Version implements Comparable { - - Integer major - Integer minor - Integer bugfix - - Version(String version) { - def tokens = version.tokenize('.') - - this.major = (tokens.size>=1)?tokens.get(0).toInteger():0 - this.minor = (tokens.size>=2)?tokens.get(1)?.toInteger():0 - this.bugfix = (tokens.size>=3)?tokens.get(2)?.toInteger():0 - } - - @Override - int compareTo(Object other) { - - def ret = 0 - - if ( this.major == other.major && this.minor == other.minor && this.bugfix == other.bugfix ){ - return 0 - } - - if ( this.major <= other.major ) { - if ( this.minor < other.minor ) { - ret = -1 - } - if ( this.bugfix < other.bugfix ) { - ret = -1 - } - } - - if ( this.major >= other.major ) { - if ( this.minor > other.minor ) { - ret = 1 - } - if ( this.bugfix > other.bugfix ) { - ret = 1 - } - } - - return ret - - } - -} diff --git a/src/test/groovy/me/champeau/gradle/JBakePluginSpec.groovy b/src/test/groovy/me/champeau/gradle/JBakePluginSpec.groovy index 2fc72d0b..eb5ca9e9 100644 --- a/src/test/groovy/me/champeau/gradle/JBakePluginSpec.groovy +++ b/src/test/groovy/me/champeau/gradle/JBakePluginSpec.groovy @@ -22,7 +22,7 @@ class JBakePluginSpec extends Specification { def "should add a JBakeTask"(){ expect: - project.tasks.jbake instanceof JBakeTask + project.tasks.bake instanceof JBakeTask } def "should add jbake configuration"(){ @@ -114,7 +114,7 @@ class JBakePluginSpec extends Specification { project.jbake.srcDirName = srcDirName then: - project.tasks.jbake.input == expectedFile + project.tasks.bake.input == expectedFile } def "output dir should be configured by extension"(){ @@ -126,7 +126,7 @@ class JBakePluginSpec extends Specification { project.jbake.destDirName = destDirName then: - project.tasks.jbake.output == expectedFile + project.tasks.bake.output == expectedFile } def "clearcache should be configured by extension"(){ @@ -137,7 +137,7 @@ class JBakePluginSpec extends Specification { project.jbake.clearCache = clearCache then: - project.tasks.jbake.clearCache == clearCache + project.tasks.bake.clearCache == clearCache } def "should be configurable by extension"(){ @@ -149,7 +149,7 @@ class JBakePluginSpec extends Specification { project.jbake.configuration = configuration then: - project.tasks.jbake.configuration['render.tags'] == false + project.tasks.bake.configuration['render.tags'] == false } } diff --git a/src/test/groovy/me/champeau/gradle/VersionTest.groovy b/src/test/groovy/me/champeau/gradle/VersionTest.groovy deleted file mode 100644 index 977c1d0d..00000000 --- a/src/test/groovy/me/champeau/gradle/VersionTest.groovy +++ /dev/null @@ -1,84 +0,0 @@ -package me.champeau.gradle - -import spock.lang.Specification -import spock.lang.Unroll - -/** - * Created by frank on 13.10.14. - */ -class VersionTest extends Specification { - - def "fill by string"(){ - given: - Version version = new Version("2.3.0") - - expect: - version.major == 2 - version.minor == 3 - version.bugfix == 0 - } - - def "ignore bugfix if not present"(){ - given: - Version version = new Version("2.0") - - expect: - version.major == 2 - version.minor == 0 - version.bugfix == 0 - } - - - def "should be equal"(){ - given: - Version one = new Version("1.1.1") - Version two = new Version("1.1.1") - - expect: - two == one - - } - - @Unroll - def "#versionOne should be less than #versionTwo"(){ - - given: - Version one = new Version(versionOne) - Version two = new Version(versionTwo) - - expect: - - one < two - - where: - versionOne | versionTwo - "1.0.0" | "1.0.1" - "1.0.0" | "1.1.0" - "1.0.0" | "1.1.1" - "0.0.0" | "0.0.1" - "10.0.12" | "11.11.11" - "10.11.10" | "10.12.10" - } - - @Unroll - def "#versionTwo should be bigger than #versionOne"(){ - - given: - Version one = new Version(versionTwo) - Version two = new Version(versionOne) - - expect: - - one > two - - where: - versionOne | versionTwo - "1.0.0" | "1.0.1" - "1.0.0" | "1.1.0" - "1.0.0" | "1.1.1" - "0.0.0" | "0.0.1" - "10.0.12" | "11.11.11" - "10.11.10" | "10.12.10" - } - -}