Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
musketyr committed Feb 1, 2012
1 parent f6de21b commit 70b8297
Show file tree
Hide file tree
Showing 40 changed files with 5,865 additions and 0 deletions.
72 changes: 72 additions & 0 deletions .classpath
@@ -0,0 +1,72 @@
<?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="grails-app/utils"/>
<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 exported="true" kind="con" path="GROOVY_DSL_SUPPORT"/>
<classpathentry kind="src" path=".link_to_grails_plugins/release-1.0.0/src/groovy">
<attributes>
<attribute name="com.springsource.sts.grails.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".link_to_grails_plugins/release-1.0.0/src/java">
<attributes>
<attribute name="com.springsource.sts.grails.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="BuildConfig.groovy|*DataSource.groovy|UrlMappings.groovy|Config.groovy|BootStrap.groovy|spring/resources.groovy" kind="src" path=".link_to_grails_plugins/resources-1.1.5/grails-app/conf">
<attributes>
<attribute name="com.springsource.sts.grails.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".link_to_grails_plugins/resources-1.1.5/grails-app/i18n">
<attributes>
<attribute name="com.springsource.sts.grails.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".link_to_grails_plugins/resources-1.1.5/grails-app/resourceMappers">
<attributes>
<attribute name="com.springsource.sts.grails.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".link_to_grails_plugins/resources-1.1.5/grails-app/taglib">
<attributes>
<attribute name="com.springsource.sts.grails.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".link_to_grails_plugins/resources-1.1.5/src/groovy">
<attributes>
<attribute name="com.springsource.sts.grails.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".link_to_grails_plugins/resources-1.1.5/src/java">
<attributes>
<attribute name="com.springsource.sts.grails.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".link_to_grails_plugins/svn-1.0.1/src/groovy">
<attributes>
<attribute name="com.springsource.sts.grails.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="BuildConfig.groovy|*DataSource.groovy|UrlMappings.groovy|Config.groovy|BootStrap.groovy|spring/resources.groovy" kind="src" path=".link_to_grails_plugins/webxml-1.4.1/grails-app/conf">
<attributes>
<attribute name="com.springsource.sts.grails.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".link_to_grails_plugins/webxml-1.4.1/src/groovy">
<attributes>
<attribute name="com.springsource.sts.grails.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target-eclipse/classes"/>
</classpath>
26 changes: 26 additions & 0 deletions .project
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>jasmine-resources</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>
<linkedResources>
<link>
<name>.link_to_grails_plugins</name>
<type>2</type>
<locationURI>GRAILS_ROOT/2.0.0/projects/jasmine-resources/plugins</locationURI>
</link>
</linkedResources>
</projectDescription>
4 changes: 4 additions & 0 deletions .settings/com.springsource.sts.grails.core.prefs
@@ -0,0 +1,4 @@
#Wed Feb 01 10:10:02 CET 2012
com.springsource.sts.grails.core.com.springsource.sts.grails.core.install.name=Grails 2.0.0
com.springsource.sts.grails.core.use.default.install=false
eclipse.preferences.version=1
3 changes: 3 additions & 0 deletions .settings/org.codehaus.groovy.eclipse.preferences.prefs
@@ -0,0 +1,3 @@
#Wed Feb 01 10:10:02 CET 2012
eclipse.preferences.version=1
groovy.dont.generate.class.files=true
3 changes: 3 additions & 0 deletions .settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
#Wed Feb 01 10:41:24 CET 2012
eclipse.preferences.version=1
encoding//.link_to_grails_plugins/resources-1.1.5/grails-app/i18n/messages.properties=UTF-8
72 changes: 72 additions & 0 deletions JasmineResourcesGrailsPlugin.groovy
@@ -0,0 +1,72 @@
class JasmineResourcesGrailsPlugin {
// the plugin version
def version = "0.1.0"
// the version or versions of Grails the plugin is designed for
def grailsVersion = "1.3.7 > *"
// the other plugins this plugin depends on
def dependsOn = ['resources':'1.0 > *']
// resources that are excluded from plugin packaging
def pluginExcludes = [
"grails-app/views/error.gsp",
"grails-app/conf/TestResources.groovy",
]

// TODO Fill in these fields
def title = "Jasmine Resources Plugin" // Headline display name of the plugin
def author = "Vladimír Oraný"
def authorEmail = "vladimir.orany@appsatori.eu"
def description = '''\
Jasmine resources plugin bundled with 1.1.0 release.
'''

// URL to the plugin's documentation
def documentation = "http://grails.org/plugin/jasmine-resources"

// 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: "My Company", url: "http://www.my-company.com/" ]

// 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://svn.grails-plugins.codehaus.org/browse/grails-plugins/" ]

def doWithWebDescriptor = { xml ->
// TODO Implement additions to web.xml (optional), this event occurs before
}

def doWithSpring = {
// TODO Implement runtime spring config (optional)
}

def doWithDynamicMethods = { ctx ->
// TODO Implement registering dynamic methods to classes (optional)
}

def doWithApplicationContext = { applicationContext ->
// TODO Implement post initialization spring config (optional)
}

def onChange = { event ->
// TODO Implement code that is executed when any artefact that this plugin is
// watching is modified and reloaded. The event contains: event.source,
// event.application, event.manager, event.ctx, and event.plugin.
}

def onConfigChange = { event ->
// TODO Implement code that is executed when the project configuration changes.
// The event is the same as for 'onChange'.
}

def onShutdown = { event ->
// TODO Implement code that is executed when the application shuts down (optional)
}
}
16 changes: 16 additions & 0 deletions README.md
@@ -0,0 +1,16 @@
# Grails Jasmine Resources Plugin

This plugin adds [Jasmine](http://pivotal.github.com/jasmine/) resources to the Grails Application.

It uses new [Resources Plugin](http://grails.org/plugin/resources) to handle resources gracefully.
Just let your Jasmine Specs depend on 'jasmine' module and it's done. There is also controller for
standalone manual testing. Just navigate to `<app>/jasmine/<module-name>` to see the results.

If jQuery plugin is installed it automatically adds [jQuery Jasmine](https://github.com/velesin/jasmine-jquery) script.

The plugin is not yet available on the grails repository, install it by running following command

```
grails install-plugin http://cloud.github.com/downloads/musketyr/grails-jasmine-resources/grails-jasmine-resources-0.1.0.zip
```

6 changes: 6 additions & 0 deletions application.properties
@@ -0,0 +1,6 @@
#Grails Metadata file
#Wed Feb 01 10:41:10 CET 2012
app.grails.version=2.0.0
app.name=jasmine-resources
plugins.resources=1.1.5
plugins.svn=1.0.1
37 changes: 37 additions & 0 deletions grails-app/conf/BuildConfig.groovy
@@ -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
}
}
}
24 changes: 24 additions & 0 deletions grails-app/conf/Config.groovy
@@ -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'
}
43 changes: 43 additions & 0 deletions grails-app/conf/DataSource.groovy
@@ -0,0 +1,43 @@
dataSource {
pooled = true
driverClassName = "org.h2.Driver"
username = "sa"
password = ""
}
hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = true
cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'
}
// environment specific settings
environments {
development {
dataSource {
dbCreate = "create-drop" // one of 'create', 'create-drop', 'update', 'validate', ''
url = "jdbc:h2:mem:devDb;MVCC=TRUE"
}
}
test {
dataSource {
dbCreate = "update"
url = "jdbc:h2:mem:testDb;MVCC=TRUE"
}
}
production {
dataSource {
dbCreate = "update"
url = "jdbc:h2:prodDb;MVCC=TRUE"
pooled = true
properties {
maxActive = -1
minEvictableIdleTimeMillis=1800000
timeBetweenEvictionRunsMillis=1800000
numTestsPerEvictionRun=3
testOnBorrow=true
testWhileIdle=true
testOnReturn=true
validationQuery="SELECT 1"
}
}
}
}
15 changes: 15 additions & 0 deletions grails-app/conf/JasmineResourcesPluginResources.groovy
@@ -0,0 +1,15 @@
def applicationContext = org.codehaus.groovy.grails.commons.ApplicationHolder.application.mainContext
def jqueryPlugin = applicationContext.pluginManager.getGrailsPlugin('jquery')

modules = {
'jasmine' {
resource id: 'jasmine-favicon',url:[plugin: 'jasmine-resources', dir:'images/jasmine', file: 'jasmine_favicon.png'], attrs:[rel:'shortcut icon'], disposition: 'head'
resource id: 'jasmine-css', url:[plugin: 'jasmine-resources', dir:'css/jasmine', file: 'jasmine.css'], disposition: 'head'
resource id: 'jasmine', url:[plugin: 'jasmine-resources', dir:'js/jasmine', file: 'jasmine.js'], disposition: 'head'
resource id: 'jasmine-html', url:[plugin: 'jasmine-resources', dir:'js/jasmine', file: 'jasmine-html.js'], disposition: 'head'
if(jqueryPlugin){
resource id: 'jasmine-jquery', url:[plugin: 'jasmine-resources', dir:'js/jasmine', file: 'jasmine-jquery-1.3.1.js'], disposition: 'head'
}
resource id: 'jasmine-reporter', url:[plugin: 'jasmine-resources', dir:'js/jasmine', file: 'jasmine-reporter.js'], disposition: 'head'
}
}
6 changes: 6 additions & 0 deletions grails-app/conf/JasmineResourcesUrlMappings.groovy
@@ -0,0 +1,6 @@
class JasmineResourcesUrlMappings {

static mappings = {
"/jasmine/$module" (controller: 'jasmine', action: 'index')
}
}
15 changes: 15 additions & 0 deletions grails-app/conf/TestResources.groovy
@@ -0,0 +1,15 @@
def dev = grails.util.GrailsUtil.isDevelopmentEnv()
def applicationContext = org.codehaus.groovy.grails.commons.ApplicationHolder.application.mainContext
def jqueryPlugin = applicationContext.pluginManager.getGrailsPlugin('jquery')

def jsFile = dev ? "angular.js" :"angular.min.js"

modules = {
'test' {
dependsOn 'jasmine'
resource url: 'plugins/js/Player.js', disposition: 'head'
resource url: 'plugins/js/Song.js', disposition: 'head'
resource url: 'plugins/js/SpecHelper.js', disposition: 'head'
resource url: 'plugins/js/PlayerSpec.js', disposition: 'head'
}
}
13 changes: 13 additions & 0 deletions grails-app/conf/UrlMappings.groovy
@@ -0,0 +1,13 @@
class UrlMappings {

static mappings = {
"/$controller/$action?/$id?"{
constraints {
// apply constraints here
}
}

"/"(view:"/index")
"500"(view:'/error')
}
}
@@ -0,0 +1,6 @@
package jasmine.resources

class JasmineController {

def index() { }
}
11 changes: 11 additions & 0 deletions grails-app/views/error.gsp
@@ -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>

0 comments on commit 70b8297

Please sign in to comment.