forked from bertramdev/selfie
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSelfieGrailsPlugin.groovy
39 lines (33 loc) · 1.65 KB
/
SelfieGrailsPlugin.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import org.codehaus.groovy.grails.validation.ConstrainedProperty
import com.bertramlabs.plugins.selfie.AttachmentValueConverter
import com.bertramlabs.plugins.selfie.ContentTypeConstraint
import com.bertramlabs.plugins.selfie.FileSizeConstraint
import com.bertramlabs.plugins.selfie.PersistenceEventListener
class SelfieGrailsPlugin {
def version = "0.4.1"
def grailsVersion = "2.3 > *"
def title = "Selfie Plugin"
def author = "David Estes"
def authorEmail = "[email protected]"
def description = "Selfie is a Grails Image / File Upload Plugin. Use Selfie to attach files to your domain models, upload to a CDN, validate content, produce thumbnails."
def documentation = "https://github.com/bertramdev/selfie"
def license = "APACHE"
def organization = [name: "Bertram Labs", url: "http://www.bertramlabs.com/"]
def issueManagement = [system: "GITHUB", url: "https://github.com/bertramdev/selfie/issues"]
def scm = [url: "https://github.com/bertramdev/selfie"]
def pluginExcludes = [
"grails-app/views/error.gsp"
]
def doWithSpring = {
attachmentConverter AttachmentValueConverter
}
def doWithDynamicMethods = { ctx ->
ConstrainedProperty.registerNewConstraint('contentType', ContentTypeConstraint)
ConstrainedProperty.registerNewConstraint('fileSize', FileSizeConstraint)
}
def doWithApplicationContext = { ctx ->
application.mainContext.eventTriggeringInterceptor.datastores.each { k, datastore ->
applicationContext.addApplicationListener new PersistenceEventListener(datastore)
}
}
}