# WOGroovy

SUZUKI Tetsuya (suzuki@spice-of-life.net)

## About WOGroovy

WOGroovy is a framework to develop WebObjects application with Groovy. Now the frameworks can work on Mac OS X + Xcode.

Development with Groovy
  Easy and rapid prototyping more than pure Java only. You can embed Groovy in applications and wrote a class with Groovy only.
Dynamic Compiling
  Groovy scripts are compiled and loaded dynamically. Shall we dance with scriptable WebObjects?
Method Additions
  Many methods include Utilities classes are added to use easily like Groovy.

See also WOGroovy Home about news and more documents.

## License

WOGroovy is distributed with BSD license.

## Installation

Install ProjectWONDER before installing WOGroovy.

### WOGroovy framework

Copy WOGroovy.framework into /Library/Frameworks. Add a property to ~/WebObjects.Properties.

    wogroovy.WOGroovyCompilerProxyEnabled=true

### Templates

Copy templates into directoies the following.

Groovy Basic Classes.pbfiletemplate
  /Library/Application Support/Apple/Developer Tools/File Templates/WebObjects/
Groovy Class.pbfiletemplate
  /Library/Application Support/Apple/Developer Tools/File Templates/WebObjects
Groovy Component.pbfiletemplate
  /Library/Application Support/Apple/Developer Tools/Target Templates

### Usage

#### Add frameworks

First, add these frameworks.

- aWOGroovy.framework
- ERJars.framework
- ERExtensions.framework

#### Ready to compile

You need to set compilng Groovy scripts at building Java source files. If you want to compile Groovy scripts only when building for deployment, check "Run only when installing".

1. Select "Application Server" target and open edit window of it.
2. Add a shell script phase after "Sources" of build phase. Select "Project" "New Build Phase" "New Shell Script" from menu. Move the shell script phase to after "Sources".
3. Input the shell script.

       sh /Library/Frameworks/WOGroovy.framework/Resources/CompileGroovyScripts.sh

#### Ready to dynamic compile (rapid turnaround mode)

This is the same to ERXCompilerProxy.

1. Select "project name" target and open edit window of it.
2. Add a shell script phase after "Frameworks and Libraries" of build phase. Select "Project" "New Build Phase" "New Shell Script" from menu. Move the shell script phase to after "Frameworks and Libraries".
3. Input the shell script.

       sh "/Library/Frameworks/ERExtensions.framework/Resources/InstallCompilerProxySupport.sh"

#### Editing Groovy scripts

Groovy WebObjects is ready. Put Groovy scripts (the suffix must be .groovy) in project directory. You need not add the scripts to projects because WOGroovy framework targets all scripts in the project directory to compile.

Note: Don't remove Java source files. If you remove the files, application will not works.

### Templates

Groovy Basic Classes
  Add Groovy script files for Application, Session, DirectAction?, Main classes. Inputted file names at selecting targets are ignored.
Groovy Class
  Add a script file for new class.
Groovy Component
  Add a component includes Groovy script.