Wednesday, December 5, 2007

Sprouts for Flex Application Generation

A second generation refactoring of AsProject for creating Flex projects is being created by Luke Bayes and Ali Mills at assertTrue. The project has great promise, and since it is based on ruby, gems, yaml and rake it has instant credibility with me. The project is in alpha stage, so there is lots of work to be completed, but here are some thoughts about my first experiences with sprouts...

First, I installed the gem on both OSX (10.4) and Fedora (7) with:

sudo gem install sprout

Then I created my first project on both machines.

sprout -s mxml MyProject

Since this is the first application in this project, there are a bunch of dependency files that need to be downloaded. Sprout gives a good visual indication of what it's doing, so it was not a problem. Once the basic projects were created, it was time for the initial test.

cd MyProject/project ; rake

If you don't have a mm.cfg at your home directory you'll be prompted (pestered?) to create one. This is more of a flex thing rather than sprouts, and I have lots of issues with how flex handles the debug thing, but for now, I just answered yes...

My results on linux were as expected. The project compiled and ran just fine. No so on my mac. It compiled ok, but the runner failed. I was able to access the compiled swf on my browser so I'm assuming that my mac's flex installation is messing up the runner. (After perusing the project issues I see that this is a known problem. I also looked at a post from LeakyMmembrain to help smooth out some issues (but rake still hangs)...)

So now that I have a project framework, next is to see how it works with the Flex/Eclipse IDE (flex 2 on my mac only). This wasn't as I hoped. The generated structure doesn't play nice with Flex's vision of projects, i.e., there is a single level project where src, test, assets, css, and lib reside. but, on the same level are script, rakefile.rb and bin. What flex tries to do is grab all the files and copy them to the bin folder--not good.

Sprout Wish List:

Here is a short list of things I would like to see in sprouts:
  • a rake plugin similar to 'lib/tasks' in rails
  • rake file named Rakefile (ok, that's a nit)
  • better Flex IDE integration, at least for mxml projects
So, I'm hoping that future versions, or possibly a custom template configuration will solve the Flex IDE problem. In any case I'm looking forward to following the progress of the sprouts.

2 comments:

Luke Bayes said...

Hey Darryl,

Thanks for the post about Sprouts!

I just wanted to comment on how sprouts works with Flex projects. There are some steps that I haven't done a great job of describing. One of the first things that I do in every Flex project is open the Project Properties dialog and uncheck the 'Generate HTML' and 'Copy non-embeded files to output directory'. The second of these steps is critical if you use subversion otherwise Flex Builder will copy .svn folders into bin and wreak havoc on your project.

The other critical step is to set up the Flex project to point at src for source files and bin for output.

AsProject used to auto-generate the .project files with these settings for you, but this got challenging with changing Flex betas and versions. Hopefully we'll get that back in at some point.

darryl.west said...

Thanks for the tips. I have recently switched from subversion to git for flex (and other) projects, so no more problems with .svn files.

And thanks for your great work on AsProject and Flex.