Friday, September 04, 2009

The Grails plugin class

GrailsImage via Wikipedia

After creating the plugin structure one thing you can do is to edit the Grails plugin class. The grails plugin class, by default, looks something like this:

class UtilsGrailsPlugin {
// the plugin version
def version = "0.1"
// the version or versions of Grails the plugin is designed for
def grailsVersion = "1.1.1 > *"
// the other plugins this plugin depends on
def dependsOn = [:]
// resources that are excluded from plugin packaging
def pluginExcludes = ["grails-app/views/error.gsp"]

// TODO Fill in these fields
def author = "Your name"
def authorEmail = ""
def title = "Plugin summary/headline"
def description = '''\\
Brief description of the plugin.
'''

// URL to the plugin's documentation
def documentation = "http://grails.org/Utils+Plugin"

....
}
As we are writing our first plugin there are not dependencies we want to define. We will simply fill out some details:

def author = "Paolo Ciccarese"
def authorEmail = "paolo.ciccarese@gmail.com"
def title = "Utilities for vocabularies/ontologies management"
def description = '''\\
Utilities for vocabularies/ontologies management
'''
You might want also to define the location of the documentation. This file will be used to generate the plugin package when needed. It is sufficient to be in the root directory of the plugin and type:
> grails package-plugin

This will create a grails-utils-0.1.zip file that can be then installed by other grails plugins/applications. To install it will be sufficient to be in the new application/plugin root directory and to type
> grails install-plugin grails-utils-0.1.zip

But before doing this, you probably have to write some code that will provide actual utilities.



Reblog this post [with Zemanta]

No comments: