Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
102 lines (84 sloc) 2.63 KB
buildscript {
repositories {
mavenLocal()
mavenCentral()
jcenter()
}
dependencies {
classpath 'me.champeau.gradle:jbake-gradle-plugin:0.2'
classpath 'org.jbake:jbake-core:2.3.2'
classpath 'org.pegdown:pegdown:1.4.2'
classpath 'org.asciidoctor:asciidoctorj:1.5.2'
classpath 'com.bluepapa32:gradle-watch-plugin:0.1.5'
}
}
apply plugin: 'me.champeau.jbake'
apply plugin: 'idea'
apply plugin: 'java'
apply plugin: 'com.bluepapa32.watch'
jbake {
dependsOn 'cleanBuildDir','webjars resources extraction'
input = file 'jbake'
clearCache = true
configuration['template.documentation.file'] = 'documentation.gsp'
configuration['site.host'] = 'http://ajaxanywhere.com'
configuration['render.archive'] = false
configuration['render.examples'] = true
configuration['template.examples.file'] = 'examples.gsp'
}
configurations {
webjars
webjars.extendsFrom(compile)
}
repositories {
mavenLocal()
mavenCentral()
jcenter()
}
dependencies {
webjars 'org.webjars:jquery:2.1.3'
webjars 'org.webjars:bootstrap:3.3.4'
webjars 'org.webjars:highlightjs:8.4-4'
webjars 'org.webjars:font-awesome:4.3.0-1'
webjars 'org.webjars:jquery.tocify.js:1.9.0'
webjars 'org.webjars:Magnific-Popup:1.0.0'
}
task('webjars resources extraction', type: Copy) {
configurations.webjars.each {jar ->
def config = configurations.webjars.resolvedConfiguration
def artifact = config.resolvedArtifacts.find {
it.file.toString() == jar.absolutePath
}
def upStreamVersion = "${artifact.moduleVersion.id.version}"
upStreamVersion = upStreamVersion.replaceAll(/(-[\d.-]+)/, '')
copy {
from zipTree(jar)
into file("${buildDir}/webjars-content/${artifact.name}")
}
copy {
from "${buildDir}/webjars-content/${artifact.name}/META-INF/resources/webjars/${artifact.name}/${upStreamVersion}",
"${buildDir}/webjars-content/${artifact.name}/META-INF/resources/webjars/${artifact.name}/${artifact.moduleVersion.id.version}"
into "${jbake.input}/assets/vendor/${artifact.name}"
}
}
}
task('cname', type: Copy) {
copy {
from file("${jbake.input}/assets/CNAME")
into file("${buildDir}/jbake")
}
}
task publish(type: GradleBuild) {
dependsOn 'jbake', 'cname'
buildFile = 'publish.gradle'
tasks = ['publishGhPages']
}
task cleanBuildDir(type: Delete) {
delete "build"
}
watch {
resources {
files fileTree('jbake').exclude('assets/vendor/**/*')
tasks 'jbake'
}
}