Skip to content

Instantly share code, notes, and snippets.

View willis7's full-sized avatar
🏠
Working from home

Sion Williams willis7

🏠
Working from home
View GitHub Profile
@willis7
willis7 / utplsql-build.gradle
Created August 23, 2013 12:31
This Gist shows how to run the utplsql project using Gradle
ext{
dbun = "SCOTT"
dbpw = "oracle"
dbinst = "orcl"
}
task deployUnitTests << {
def sqlplusCmd = "sqlplus -s $dbun/$dbpw @../src/test/sql/run.sql".execute()
sqlplusCmd.in.eachLine { line -> println line }
}
task runUnitTests << {
@willis7
willis7 / tsamp.groovy
Created September 25, 2013 12:42
Groovy Timestamps
def tstamp = new Date().format('yyyy-MM-dd_HH-mm-ss')
task updateWar << {
ant.zip(destfile: 'path/to/my.war',
update: 'true') {
mappedresources(){
fileset(dir: "path/to/config/$env/",
includes: 'ws.properties')
globmapper( from: 'ws.properties',
to: 'WEB-INF/spring/appServlet/ws.properties')
}
}
@willis7
willis7 / logging.gradle
Created October 1, 2013 12:02
Add Standard Output/Error listeners and pipe their output to a build log
def tstamp = new Date().format('yyyy-MM-dd_HH-mm-ss')
def buildLogDir = "${rootDir}/build/logs"
mkdir("${buildLogDir}")
def buildLog = new File("${buildLogDir}/${tstamp}_buildLog.log")
import org.gradle.logging.internal.*
System.setProperty('org.gradle.color.error', 'RED')
gradle.services.get(LoggingOutputInternal).addStandardOutputListener (new StandardOutputListener () {
void onOutput(CharSequence output) {
@willis7
willis7 / good_selenium_task.gradle
Created October 2, 2013 17:13
This is a better implementation of the selenium test task which can now take any browser we wish.
tasks.addRule('Rule Usage: intTest<Browser>') { String taskName ->
if(taskName.startsWith('intTest')) {
task(taskName, type: Test) {
ext.browser = taskName - 'intTest'
systemProperties['LOCAL_DRIVER'] = false
systemProperties['REMOTE_DRIVER'] = true
systemProperties['SAUCE_DRIVER'] = false
systemProperties['BROWSER'] = ext.browser
systemProperties['GRID_HOST'] = 'localhost'
@willis7
willis7 / runWLST.gradle
Created November 1, 2013 12:00
Running a wlst script from gradle.
configurations {
weblogic
}
dependencies {
weblogic "com.oracle.weblogic:wlfullclient:10.3"
}
task runWLST << {
@willis7
willis7 / runWLST.gradle
Created November 1, 2013 12:00
Running a wlst script from gradle
configurations {
weblogic
}
dependencies {
weblogic "com.oracle.weblogic:wlfullclient:10.3"
}
task runWLST << {
@willis7
willis7 / JenkinsHUD.groovy
Created December 17, 2013 13:49
A simple script for collecting the latest Jenkins build information, parsing it and writing it to the console in HTML format. Requires commons-codec-1.8.jar and commons-httpclient-3.1.jar on the classpath.
import org.apache.commons.httpclient.*
import org.apache.commons.httpclient.auth.*
import org.apache.commons.httpclient.methods.*
import groovy.xml.MarkupBuilder
def server = "localhost"
def port = 8093
def jenkinsHost = "https://${server}:${port}"
@willis7
willis7 / JenkinsHUD.groovy
Created December 17, 2013 13:50
A simple script for collecting the latest Jenkins build information, parsing it and writing it to the console in HTML format. Requires commons-codec-1.8.jar and commons-httpclient-3.1.jar on the classpath.
import org.apache.commons.httpclient.*
import org.apache.commons.httpclient.auth.*
import org.apache.commons.httpclient.methods.*
import groovy.xml.MarkupBuilder
def server = "localhost"
def port = 8093
def jenkinsHost = "https://${server}:${port}"
@willis7
willis7 / distZip.gradle
Created January 28, 2014 17:18
This gist will produce a zip archive including the release artifacts of any subprojects
task distributionZip(type: Zip) {
archiveName = "${project.name}.zip"
subprojects.each { subproject ->
inputs.dir subproject.buildDir
into(subproject.name) {
from subproject.buildDir
include 'docs/**'
include 'libs/**'
include 'reports/**'