Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 44685b0
Showing
78 changed files
with
6,438 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" path="src/java"/> | ||
<classpathentry kind="src" path="src/groovy"/> | ||
<classpathentry kind="src" path="grails-app/conf"/> | ||
<classpathentry kind="src" path="grails-app/controllers"/> | ||
<classpathentry kind="src" path="grails-app/domain"/> | ||
<classpathentry kind="src" path="grails-app/services"/> | ||
<classpathentry kind="src" path="grails-app/taglib"/> | ||
<classpathentry kind="src" path="test/integration"/> | ||
<classpathentry kind="src" path="test/unit"/> | ||
<classpathentry kind="src" path="test/projects"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> | ||
<classpathentry kind="con" path="com.springsource.sts.grails.core.CLASSPATH_CONTAINER"/> | ||
<classpathentry exported="true" kind="con" path="GROOVY_DSL_SUPPORT"/> | ||
<classpathentry kind="output" path="web-app/WEB-INF/classes"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.settings/ | ||
*.class | ||
target | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>build-info-tag</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>com.springsource.sts.grails.core.nature</nature> | ||
<nature>org.eclipse.jdt.groovy.core.groovyNature</nature> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
class BuildInfoTagGrailsPlugin { | ||
// the plugin version | ||
def version = "0.1" | ||
// the version or versions of Grails the plugin is designed for | ||
def grailsVersion = "2.0 > *" | ||
// the other plugins this plugin depends on | ||
def dependsOn = [:] | ||
// resources that are excluded from plugin packaging | ||
def pluginExcludes = [ | ||
"grails-app/views/error.gsp" | ||
] | ||
|
||
def title = "Build Info Tag Plugin" // Headline display name of the plugin | ||
def author = "François Terrier" | ||
def authorEmail = "fterrier@gmail.com" | ||
def description = '''\ | ||
Puts a build.info file in the generated WAR file and provides a GSP tag to display | ||
the information in it. For now, the build number is the date and the plugin also | ||
collects the GIT commit number and displays it (won't work on Windows). | ||
''' | ||
|
||
// URL to the plugin's documentation | ||
def documentation = "http://grails.org/plugin/build-info-tag" | ||
|
||
// Extra (optional) plugin metadata | ||
|
||
// License: one of 'APACHE', 'GPL2', 'GPL3' | ||
def license = "APACHE" | ||
|
||
// Details of company behind the plugin (if there is one) | ||
def organization = [ name: "CHAI", url: "http://www.clintonhealthaccess.org/" ] | ||
|
||
// Any additional developers beyond the author specified above. | ||
// def developers = [ [ name: "Joe Bloggs", email: "joe@bloggs.net" ]] | ||
|
||
// Location of the plugin's issue tracker. | ||
// def issueManagement = [ system: "JIRA", url: "http://jira.grails.org/browse/GPMYPLUGIN" ] | ||
|
||
// Online location of the plugin's browseable source code. | ||
def scm = [ url: "http://github.com/fterrier/grails-build-info-tag" ] | ||
|
||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#Grails Metadata file | ||
#Sat Mar 24 13:44:31 CAT 2012 | ||
app.grails.version=2.0.0 | ||
app.name=build-info-tag | ||
plugins.svn=1.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
grails.project.class.dir = "target/classes" | ||
grails.project.test.class.dir = "target/test-classes" | ||
grails.project.test.reports.dir = "target/test-reports" | ||
grails.project.target.level = 1.6 | ||
//grails.project.war.file = "target/${appName}-${appVersion}.war" | ||
|
||
grails.project.dependency.resolution = { | ||
// inherit Grails' default dependencies | ||
inherits("global") { | ||
// uncomment to disable ehcache | ||
// excludes 'ehcache' | ||
} | ||
log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose' | ||
repositories { | ||
grailsCentral() | ||
// uncomment the below to enable remote dependency resolution | ||
// from public Maven repositories | ||
//mavenCentral() | ||
//mavenLocal() | ||
//mavenRepo "http://snapshots.repository.codehaus.org" | ||
//mavenRepo "http://repository.codehaus.org" | ||
//mavenRepo "http://download.java.net/maven/2/" | ||
//mavenRepo "http://repository.jboss.com/maven2/" | ||
} | ||
dependencies { | ||
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg. | ||
|
||
// runtime 'mysql:mysql-connector-java:5.1.5' | ||
} | ||
|
||
plugins { | ||
build(":tomcat:$grailsVersion", | ||
":release:1.0.0") { | ||
export = false | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// configuration for plugin testing - will not be included in the plugin zip | ||
|
||
log4j = { | ||
// Example of changing the log pattern for the default console | ||
// appender: | ||
// | ||
//appenders { | ||
// console name:'stdout', layout:pattern(conversionPattern: '%c{2} %m%n') | ||
//} | ||
|
||
error 'org.codehaus.groovy.grails.web.servlet', // controllers | ||
'org.codehaus.groovy.grails.web.pages', // GSP | ||
'org.codehaus.groovy.grails.web.sitemesh', // layouts | ||
'org.codehaus.groovy.grails.web.mapping.filter', // URL mapping | ||
'org.codehaus.groovy.grails.web.mapping', // URL mapping | ||
'org.codehaus.groovy.grails.commons', // core / classloading | ||
'org.codehaus.groovy.grails.plugins', // plugins | ||
'org.codehaus.groovy.grails.orm.hibernate', // hibernate integration | ||
'org.springframework', | ||
'org.hibernate', | ||
'net.sf.ehcache.hibernate' | ||
|
||
warn 'org.mortbay.log' | ||
} |
44 changes: 44 additions & 0 deletions
44
grails-app/taglib/org/chai/buildinfo/BuildInfoTagLib.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package org.chai.buildinfo | ||
|
||
import grails.util.GrailsUtil; | ||
import grails.util.Metadata; | ||
|
||
class BuildInfoTagLib { | ||
|
||
static namespace = "build" | ||
|
||
def grailsApplication | ||
|
||
def buildInstance | ||
def buildInitialized = false | ||
|
||
def getBuild() { | ||
if (!buildInitialized) { | ||
def resource = grailsApplication.parentContext.getResource("classpath:build.info") | ||
if (resource.exists()) buildInstance = Metadata.getInstance(resource.inputStream) | ||
else buildInstance = null | ||
buildInitialized = true | ||
} | ||
return buildInstance | ||
} | ||
|
||
def buildInfo = {attrs, body -> | ||
if (GrailsUtil.environment == 'production') { | ||
if (build == null) { | ||
out << "no build info found" | ||
} | ||
else { | ||
out << render(plugin:'buildInfoTag', template:'/templates/buildInfo', model:[ | ||
buildDate: build.'app.buildDate', | ||
gitCommit: build.'app.gitCommit', | ||
systemName: build.'app.systemName', | ||
timezone: build.'app.timezone' | ||
]) | ||
} | ||
} | ||
else { | ||
out << "no build info in ${GrailsUtil.environment} environment" | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<title>Grails Runtime Exception</title> | ||
<meta name="layout" content="main"> | ||
<link rel="stylesheet" href="${resource(dir: 'css', file: 'errors.css')}" type="text/css"> | ||
</head> | ||
<body> | ||
<g:renderException exception="${exception}" /> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
${grailsApplication.metadata['app.name']} | ||
${grailsApplication.metadata['app.version']} | ||
|
||
Build ${buildDate} | ||
Git ${gitCommit} | ||
|
||
<!-- System ${systemName} --> | ||
<!-- Timezone ${timezone} --> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<plugin name='build-info-tag' version='0.1' grailsVersion='2.0.0 > *'> | ||
<author>François Terrier</author> | ||
<authorEmail>fterrier@gmail.com</authorEmail> | ||
<title>Build Info Tag Plugin</title> | ||
<description>Puts a build.info file in the generated WAR file and provides a GSP tag to display | ||
the information in it. For now, the build number is the date and the plugin also | ||
collects the GIT commit number and displays it (won't work on Windows). | ||
</description> | ||
<documentation>http://grails.org/plugin/build-info-tag</documentation> | ||
<type>BuildInfoTagGrailsPlugin</type> | ||
<resources> | ||
<resource>org.chai.buildinfo.BuildInfoTagLib</resource> | ||
</resources> | ||
<repositories /> | ||
<dependencies /> | ||
<plugins> | ||
<runtime> | ||
<plugin group='org.grails.plugins' name='resources' version='1.1.5' /> | ||
<plugin group='org.grails.plugins' name='hibernate' version='2.0.0' /> | ||
<plugin group='org.grails.plugins' name='jquery' version='1.7.1' /> | ||
</runtime> | ||
<build> | ||
<plugin group='org.grails.plugins' name='tomcat' version='2.0.0' /> | ||
</build> | ||
</plugins> | ||
<runtimePluginRequirements /> | ||
<behavior /> | ||
</plugin> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import grails.util.Metadata; | ||
|
||
import java.text.SimpleDateFormat; | ||
|
||
eventCreateWarStart = { warName, stagingDir -> | ||
|
||
def formatter = new SimpleDateFormat("ddMMyyyy-HHmmss") | ||
def buildDate = formatter.format(new Date(System.currentTimeMillis())) | ||
buildDate += '-'+Calendar.getInstance().getTimeZone().getDisplayName(false, TimeZone.SHORT) | ||
|
||
def gitCommit = '' | ||
try { | ||
// TODO make it platform independant | ||
def proc = "git rev-parse HEAD".execute() | ||
gitCommit = proc.text | ||
} catch (Exception e) {} | ||
|
||
Metadata build = Metadata.getInstance(new File("${stagingDir}/WEB-INF/classes/build.info")); | ||
build.'app.buildDate' = buildDate | ||
build.'app.gitCommit' = gitCommit | ||
build.'app.systemName' = InetAddress.getLocalHost().getHostName() | ||
build.'app.timezone' = Calendar.getInstance().getTimeZone().getID() | ||
build.persist() | ||
|
||
println "Compile Starting on build #${buildDate}, git commit: ${gitCommit}" | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<classpath> | ||
<classpathentry kind="src" path="src/java"/> | ||
<classpathentry kind="src" path="src/groovy"/> | ||
<classpathentry kind="src" path="grails-app/conf"/> | ||
<classpathentry kind="src" path="grails-app/controllers"/> | ||
<classpathentry kind="src" path="grails-app/domain"/> | ||
<classpathentry kind="src" path="grails-app/services"/> | ||
<classpathentry kind="src" path="grails-app/taglib"/> | ||
<classpathentry kind="src" path="test/integration"/> | ||
<classpathentry kind="src" path="test/unit"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> | ||
<classpathentry kind="con" path="com.springsource.sts.grails.core.CLASSPATH_CONTAINER"/> | ||
<classpathentry kind="output" path="web-app/WEB-INF/classes"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>test-build-info</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>com.springsource.sts.grails.core.nature</nature> | ||
<nature>org.eclipse.jdt.groovy.core.groovyNature</nature> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#Grails Metadata file | ||
#Sat Mar 24 15:37:03 CAT 2012 | ||
app.grails.version=2.0.0 | ||
app.name=test-build-info | ||
app.servlet.version=2.5 | ||
app.version=0.1 |
5 changes: 5 additions & 0 deletions
5
test/projects/test-build-info/grails-app/conf/ApplicationResources.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
modules = { | ||
application { | ||
resource url:'js/application.js' | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
test/projects/test-build-info/grails-app/conf/BootStrap.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class BootStrap { | ||
|
||
def init = { servletContext -> | ||
} | ||
def destroy = { | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
test/projects/test-build-info/grails-app/conf/BuildConfig.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
grails.servlet.version = "2.5" // Change depending on target container compliance (2.5 or 3.0) | ||
grails.project.class.dir = "target/classes" | ||
grails.project.test.class.dir = "target/test-classes" | ||
grails.project.test.reports.dir = "target/test-reports" | ||
grails.project.target.level = 1.6 | ||
grails.project.source.level = 1.6 | ||
//grails.project.war.file = "target/${appName}-${appVersion}.war" | ||
|
||
grails.plugin.location.'build-info-tag' = "../../.." | ||
|
||
grails.project.dependency.resolution = { | ||
// inherit Grails' default dependencies | ||
inherits("global") { | ||
// uncomment to disable ehcache | ||
// excludes 'ehcache' | ||
} | ||
log "error" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose' | ||
checksums true // Whether to verify checksums on resolve | ||
|
||
repositories { | ||
inherits true // Whether to inherit repository definitions from plugins | ||
grailsPlugins() | ||
grailsHome() | ||
grailsCentral() | ||
mavenCentral() | ||
|
||
// uncomment these to enable remote dependency resolution from public Maven repositories | ||
//mavenCentral() | ||
//mavenLocal() | ||
//mavenRepo "http://snapshots.repository.codehaus.org" | ||
//mavenRepo "http://repository.codehaus.org" | ||
//mavenRepo "http://download.java.net/maven/2/" | ||
//mavenRepo "http://repository.jboss.com/maven2/" | ||
} | ||
dependencies { | ||
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg. | ||
|
||
// runtime 'mysql:mysql-connector-java:5.1.16' | ||
} | ||
|
||
plugins { | ||
runtime ":hibernate:$grailsVersion" | ||
runtime ":jquery:1.7.1" | ||
runtime ":resources:1.1.5" | ||
|
||
build ":tomcat:$grailsVersion" | ||
} | ||
} |
Oops, something went wrong.