Skip to content

Instantly share code, notes, and snippets.

@stan229
Created October 14, 2011 14:20
Show Gist options
  • Save stan229/1287244 to your computer and use it in GitHub Desktop.
Save stan229/1287244 to your computer and use it in GitHub Desktop.
Auto incrementing build
eventCompileStart = {
def buildNumber = metadata.'app.buildNumber'
if(!buildNumber) {
buildNumber = 1
} else {
buildNumber = Integer.valueOf(buildNumber) + 1
}
metadata.'app.buildNumber' = buildNumber.toString()
metadata.'app.buildDate' = new Date().format("MM/dd/yyyy HH:mm:ss")
metadata.'app.buildProfile' = grailsEnv
metadata.persist()
}
eventCreateWarStart = { fileName, stagingDir ->
def metadata = grails.util.Metadata.current
def appVersion = metadata.'app.version'
def buildNumber = metadata.'app.buildNumber'
def appName = metadata.'app.name'
fileName = "${appName}-${appVersion}-${buildNumber}.war"
}
#Grails Metadata file
#Fri Oct 14 10:17:22 EDT 2011
app.buildDate=10/14/2011 10\:17\:22
app.buildNumber=27
app.buildProfile=production
app.grails.version=1.3.7
app.name=MemberOutreachSurvey
app.servlet.version=2.4
app.version=0.1
plugins.csv=0.1
plugins.gwt=0.5.2
plugins.hibernate=1.3.7
plugins.rest=0.5
plugins.tomcat=1.3.6
plugins.xfire=0.8.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment