Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support configurable watchedResources #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions ResourcesGrailsPlugin.groovy
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import grails.util.Environment

import org.codehaus.groovy.grails.commons.ConfigurationHolder
import org.codehaus.groovy.grails.commons.ApplicationHolder

import org.springframework.beans.factory.config.MethodInvokingFactoryBean
import org.springframework.core.io.FileSystemResource
Expand All @@ -21,6 +22,13 @@ class ResourcesGrailsPlugin {

static DEFAULT_URI_PREFIX = 'static'
static DEFAULT_ADHOC_PATTERNS = ["/images/*", "*.css", "*.js"].asImmutable()
static DEFAULT_WATCHED_RESOURCES = [
"file:./grails-app/resourceMappers/**/*.groovy",
"file:./plugins/*/grails-app/resourceMappers/**/*.groovy",
"file:./grails-app/conf/*Resources.groovy",
"file:./plugins/*/grails-app/conf/*Resources.groovy",
"file:./web-app/**/*.*" // Watch for resource changes, we need excludes here for WEB-INF+META-INF when grails impls this
].asImmutable()

def version = "1.1.6"
def grailsVersion = "1.3 > *"
Expand All @@ -39,13 +47,6 @@ class ResourcesGrailsPlugin {
]

def artefacts = [getResourceMapperArtefactHandler(), getResourcesArtefactHandler()]
def watchedResources = [
"file:./grails-app/resourceMappers/**/*.groovy",
"file:./plugins/*/grails-app/resourceMappers/**/*.groovy",
"file:./grails-app/conf/*Resources.groovy",
"file:./plugins/*/grails-app/conf/*Resources.groovy",
"file:./web-app/**/*.*" // Watch for resource changes, we need excludes here for WEB-INF+META-INF when grails impls this
]

def author = "Marc Palmer, Luke Daley"
def authorEmail = "[email protected], [email protected]"
Expand All @@ -62,6 +63,11 @@ class ResourcesGrailsPlugin {
def issueManagement = [ system: "JIRA", url: "http://jira.grails.org/browse/GPRESOURCES" ]
def scm = [ url: "https://github.com/grails-plugins/grails-resources" ]

def getWatchedResources() {
def watchedResources = getResourcesConfig(ApplicationHolder.application).watchedResources
watchedResources ? watchedResources : DEFAULT_WATCHED_RESOURCES
}

def getWebXmlFilterOrder() {
def FilterManager = getClass().getClassLoader().loadClass('grails.plugin.webxml.FilterManager')
[ DeclaredResourcesPluginFilter: FilterManager.DEFAULT_POSITION - 300,
Expand Down