Written by Simon Bailey
I have finally managed to find the time to dig deeper into the world of Project Sprouts and am excited about the Version 1 release which hosts a collective of changes and improvements in comparison to its predecessor V 0.7. If your unaware of Project Sprouts then I actively encourage you to visit their homepage and have a read over what its all about.
Time saving utilities are crucial as a developer to help cut down on repetitive tedious tasks and also to help reduce errors. Applications such as Text Expander was one great time saving tool and then when I discovered live templates in IntelliJ IDEA, I truly saw the rewards of code generation, especially when combined with ANT for project builds. Project Sprouts takes time saving to a completely new level, accelerating project development workflow in a well structured and logical format.
What I was keen on understanding was where it would help me the most (initially at least) and that is project and class Generators (also read).
Sprout generators should be installed by RubyGems as command line applications on your system. After installing the flashsdk gem, you should have access to a variety of generators…..Some generators are expected to create new projects, others expect to run within existing projects.
Stray kindly hooked me up with her RobotLegs bundle to get me started (this is specific to V0.7 of Sprouts) and I also found the library by Kristofer Joseph which I understand Luke Bayes (Project Sprout creator) has assisted on also. Kristofer’s library has been updated for the V1 release of Project Sprouts and is in turn an excellent resource to understand the hooks required for using Generators in the latest Project Sprouts release (combined with reading the documentation and source of the Sprout-FlashSDK Gem).
I wanted to gain an understanding of building my own Generators and wanted to help detail the steps necessary to achieve this task. The rest of this post outlines how to create a custom class generator using a combination of command line (note I am on Mac OS X) and code editing (I use TextMate, feel free to choose your tool). l define a custom Event template and write a Generator for it, including simple Unit Tests and obviously a project example.
Read on →