Sprouts is a tool that helps you get a Flex development environment setup quickly, and helps automate development, testing, and deployment.
Sprouts is an open source project that uses Ruby to make Flex development easier. If you’ve ever used Ruby on Rails or a similar framework, you may be familiar with project generation. In fact the sprouts code generator, rubigen, was extracted from Rails. For those who are used to Java development, Sprouts can be likened to Maven.
Sprouts can not only generate a project, but fetch and install dependencies similar to a package management tool such as RPM. It will even install the Flex SDK and Flash debug player if you don’t have them installed. Sprouts provides wrappers around tools such as MXMLC and COMPC (and recently even FDB) to faciliate automation. It also helps encourage best practices such as unit testing by helping create a framework for executing tests with asunit and integrating with continuous integration tools such as CruiseControl.rb.
The website for sprouts has a great getting started tutorial.
What follows is a typical pattern of usage with Sprouts based on the tutorial.
1. Generate a project:
sprout -n as3 MyProject
This builds the basic directory structure and a simple ActionScript 3 application.
This will run the project, but even better, will download and install dependencies, and set up your environment configuration.
Rake, I as I mentioned, is a ruby build program (think ant or make) But it isn’t just for Ruby. It’s part of the power behind sprouts. You don’t have to know Ruby to use Rake, but you’ll probably learn a little bit without even realizing it.
Rubygems is the package installer used by ruby, and also used by sprouts to install your Flex development dependencies. It’s another part of the secret sauce, and it just works. Similar tools include ivy (for Java), cpan (for perl), or pear (for php).
3. Generate code:
You don’t need to know how rubigen works to use it, but you might find yourself learning a bit about it to build your own generators. It’s not that daunting.
4. Test your code:
This will execute your unit tests. What tests, you say? When sprouts generated your class, it also generated tests to go with it. Of course the tests will fail until you implement the tests (and functionality to make them pass.)
Sprouts also has tasks to help you deploy a project. For instancing, zip and sftp wrappers.
In summary, sprouts performs three main types of tasks:
1) setup flex development environment
2) project and code generation
3) build, test, and deployment tools
This tip was provided by Aaron E, during our submit a tip contest.