Skip to content

Instantly share code, notes, and snippets.

def updateCompanySubscription(companyId,duration) {
if(duration <= 0) {
return deactivateCompany(companyId)
} else if(duration > 0) {
def company = Company.get(companyId)
company.isActive = true
def today = new Date()
if(company.endDate < today ) {
company.startDate = today
company.endDate = today
@stan229
stan229 / _Events.groovy
Created October 14, 2011 14:20
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