Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A brute-force way to run asciidoctor-pdf under Gradle
buildscript {
repositories {
jcenter()
mavenLocal()
}
dependencies {
classpath 'com.github.jruby-gradle:jruby-gradle-plugin:0.1.2-SNAPSHOT'
classpath 'org.ysb33r.gradle:vfs-gradle-plugin:0.5'
classpath 'commons-httpclient:commons-httpclient:3.1'
}
}
apply plugin: 'vfs'
apply plugin: 'com.github.jruby-gradle.base'
import com.github.jrubygradle.JRubyExec
ext {
downloadDir = new File(buildDir,'download')
apmDir = new File(downloadDir,'asciidoctor-pdf-master')
}
task download {
if(!apmDir.exists()) {
downloadDir.mkdirs()
vfs {
cp 'zip:https://github.com/asciidoctor/asciidoctor-pdf/archive/master.zip', downloadDir, overwrite:true, recursive:true
}
}
}
dependencies {
gems 'rubygems:asciidoctor:1.5.0'
gems 'rubygems:coderay:1.1.0'
gems 'rubygems:prawn:1.0.0'
gems 'rubygems:prawn-templates:0.0.3'
gems 'rubygems:prawn-svg:0.16.0'
gems 'rubygems:slim:2.0.0'
gems 'rubygems:thread_safe:0.3.4'
gems 'rubygems:treetop:1.5.3'
}
task cleanDownload( type : Delete ) {
delete downloadDir
}
task pdf( type: JRubyExec ) {
dependsOn download, jrubyPrepareGems
script new File(apmDir,'bin/asciidoctor-pdf')
configuration 'gems'
scriptArgs '-D',buildDir,'src/asciidoc/slides.adoc'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment