Skip to content

Instantly share code, notes, and snippets.

Avatar

Schalk W. Cronjé ysb33r

  • Andorra
View GitHub Profile
View build.gradle
// This is a workaround for the Grain plugin for Gradle
// It generates the Grain build into a subproject if one runs grainInstall
// It also elimnates the current way Grain drops stuff all over your build area.
// IN reality the Grain plugin needs a rewrite, but this is a workaround for now.
plugins {
id "com.sysgears.grain" version "0.2.3"
}
grain {
@ysb33r
ysb33r / CopyTaskAsAsGenerator.gradle
Last active Feb 28, 2016
Using a Gradle Task as a data-driven file generator
View CopyTaskAsAsGenerator.gradle
// Uses a single Groovy template and multiple sets of text input files.
// It generates a set of Groovy source files using the content of the text input files to set tokens within the
// template file.
task generateGroovySources( type : Copy ) {
from 'examples', {
include '*.txt'
}
into "${buildDir}/generated-src"
@ysb33r
ysb33r / xinlude-xmlsluper.groovy
Created Oct 13, 2015
Processing XInclude with XmlSlurper
View xinlude-xmlsluper.groovy
// Not quite sure if this will work as expected, but probably
// worth a trying if you want xi:include documents to be inlucdd.
def spf = javax.xml.parsers.SAXParserFactory.newInstance()
spf.namespaceAware = true
spf.setXIncludeAware ( true )
def parser = new XmlSlurper(spf.newSAXParser())
@ysb33r
ysb33r / build.gradle
Created Dec 9, 2014
Asciidoctor-packt with Gradle
View build.gradle
// A minimum Gradle file to get you started with asciidoctor-packt
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.ysb33r.gradle:vfs-gradle-plugin:1.0-beta1'
classpath 'commons-httpclient:commons-httpclient:3.1'
@ysb33r
ysb33r / asciidoctor-pdf-with-gradle.gradle
Created Aug 30, 2014
A brute-force way to run asciidoctor-pdf under Gradle
View asciidoctor-pdf-with-gradle.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'
@ysb33r
ysb33r / gist:3fd93c4253e8775d5571
Last active Aug 29, 2015
Is it possible to convert asciidoctorj from maven to gradle?
View gist:3fd93c4253e8775d5571
// This is a first stab at trying to convert the asciidoctorj pom.xml to build.gradle
// Note the WORKAROUND. These are to work around problems with erubis. Gradle is much stricter
// about broken POMs that Maven.
//
// This had been done using some code which is is based on the current version of jruby-gradle-plugin,
// but with updates to fix shortcomings in the release 2.2.0
//
// This requires Gradle 2.0 or better.
//
buildscript {
@ysb33r
ysb33r / build-snippet.gradle
Created Aug 19, 2014
HOWTO control logging running tests from Gradle
View build-snippet.gradle
// IN the build.gradle file
test {
systemProperties 'logback.configurationFile' : new File(projectDir,'src/test/resources/logback-test.xml').absolutePath
}
@ysb33r
ysb33r / gist:0c534d165863628a07cc
Last active Aug 29, 2015
HOWTO add deck.js to an Asciidoctor project without resorting to git submodules
View gist:0c534d165863628a07cc
// You will need the VFS plugin
buildscript {
repositories {
jcenter()
}
dependencies {
// Set your
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:0.7.0'
classpath 'org.ysb33r.gradle:vfs-gradle-plugin:0.5'
@ysb33r
ysb33r / jruby-support.gradle
Created Jun 20, 2014
Gradle concept - Supporting JRuby + Gems
View jruby-support.gradle
// This is just a concept - this code does not exist !!
// I have placed it here in order to facilitate discussion
// let's assume that we have specified the lcoation of the jruby
// plugin in buildscript {} block
apply plugin : 'jruby'
repositories {
jcenter()
}
@ysb33r
ysb33r / build.gradle
Created May 17, 2014
HOWTO ignore spock tests when gradle is run offline
View build.gradle
// Check whether --offline was passed to gradle and set it in the test configuration's system properties
test {
if(gradle.startParameter.isOffline()) {
systemProperties 'TESTS.ARE.OFFLINE' : '1'
}
}