More on Sprouts

I’ve been looking a little closer at Sprouts, and think I have a bit better handle on what it is and what it does. After reading through all the links and associated comments in my previous post, and particularly the Sprouts RDocs helped.

As with many things that seem more complex than they are, part of the difficulty lies in naming. Sprouts is an application, but it does several different things. So conceptually, it’s difficult to describe it by what it does. I feel a similarity to describing Java. What is it — a programming language, a compiler, an execution environment — all of the above.

Similarly sprouts is a build tool, a project generator, a dependency resolver/ package manager, and a download, installation, and configuration tool. It helps me to think of it in terms of analogies with other tools, but I’m sure that fails. But learning by analogy is as good a method as any, and maybe I’ll get some corrections.

One thing Sprouts does is set up a Flex/ActionScript development environment. At the core, Sprouts is a series of tasks, and one tedious and error prone task is downloading, installing, and configuring your
development environment. The idea is that installing Ruby (and Rubygems) is easier than finding all your tools separately. A variety of tools have been built that do this: RPM/apt/yum, CPAN, easy_install, gem. Maven can do this too, but most likely because of the complexity of the Java ecosystem, it tends to get ugly.

I’m a bit worried about Sprouts falling into this trap. And the trap is in the download. There’s no easy way to ensure compatibility other than eternal vigilance. CPAN and RPM have bitten me before as well. Yum and Apt alleviate this problem by just not asking. So does gem, which is what the Sprouts installer users. Most of the time this works — as long as you’re staying bleeding edge. I don’t like that the LibraryTask installs for you. Maybe there’s a flag to disable it. Hopefully there’s at least a prompt. (I haven’t actually used Sprouts yet.) I don’t (always) want my build tool to download a library off the internet (or fail to do so), I’d rather it fail and say “libary X isn’t available. I really like the way the Ruby Enterprise/Phusion Passenger installer does this.

But I’m getting ahead of myself. The next thing Sprouts does is Build your application. It does this by wrapping the Flex SDK commands like ‘mxmlc’ into Rake tasks. I don’t know if it calls the ant tasks
or goes to the command line.

Back to the environment setup. Sprout can download, install, and configure the Flex SDK, the Flash debug player (can this run headless, e.g., without a GUI, on my build server?), set up trace logging (which apparently can be painful) and other configuration issues with the flash player, download other tools (and libraries) like a trace log viewer, and a unit test framework (ASUnit or FlexUnit).

Sprouts then gets into other magic like creating a test harness (I’m not sure what that means, possibly inspecting your code for classes and generating associated test and test suite scaffolding?) and setting up a project environment. I’m envisoning Rails Generators, and in fact, it looks like the same thing with script/generate.rb MyFlexProject. It uses Rubigen, which was extracted from Rails.

It mentions IDE integration and continuous integration, which I’m guessing mean setting up libraries in the IDE, and creating ant or rake tasks to build/deploy/test. Cruisecontrol and (especially Cruisecontrol.rb) are mentioned.

Here are some typical tasks:

ZipTask, SFTPTask, LibraryTask, MXMLCTask, CompcTask, AsUnitTask, AsDocTask.

The Sprouts model looks like this:

Tools
Libraries
Bundles
Generators
Tasks
Sprout

“Tools, Libraries and Bundles are distributed as RubyGems”

Sprout is the application, including the CLI (is there a GUI or web interface?)

A task is a Rake task. So I’m assuming I can make my own custom tasks.

I also assume I can make my own generators, all I need is to learn to use Rubigen.

Gem, Rake, and Rubigen seem to be the core components.

As I said, Sprouts is task oriented. There are ToolTasks and LibraryTasks. I’m a little confused, but I would break tasks down into specific categories like download, install, configure, build, package, deploy, test, etc. While sftp and zip could get double duty for download/deploy and install/package, I’d want to keep distinct, even if they call the same underlying tasks. I’d like to be aware of what its doing, and not implicitly step outside the scope of it’s activity. For example, if you’re building, don’t jump out of the build scope into the install or configure scope unless explicitly granted permission, which I’d think you’d only want in a bootstrap phase.

Anyway, sprouts looks like an exciting tool and I can’t wait to delve deeper into it, and actually use it.

7 thoughts on “More on Sprouts

  1. There could be some overlap between Sprouts and Capistrano. Sprouts could potentially have been built with Capistrano. I think I’m glad for simplicity’s sake that it wasn’t.

  2. Hey Aaron,

    This is a fantastic description of the project!

    You are absolutely correct about the risks and rewards of Sprouts trying to do too much. I’ve been considering some different ideas about how to avoid some of the problems, but I’m definitely open to suggestions – especially when they include patches!

    ;-)

    To your question about how Sprouts interacts with MXMLC, COMPC, MTASC, etc.

    It does go directly to the command line applications in an operating-system-specific manner through win32-open3 or open4 depending on what system you’re on.

    Please keep digging and let us know as you have more ideas about making Sprouts better!

    Thanks.

  3. Re: Capistrano….

    Sprouts is essentially a pure Ruby application that in the case of build scripts relies on Rake, and in the case of package management, relies on RubyGems.

    We use Capistrano for our rails deployments but Sprouts (fortunately), doesn’t quite get into the deployment issue.

  4. I started using sprouts not long ago, after making a custom as3 bundle in Textmate to execute the rake command properly.. the work flow is pretty simple, especially if you are familiar with alittle rails, ruby & raking.

    Props!

  5. Jason-

    Thanks for the comment. I’d love to see how you made your custom bundle. That’s probably where I’m headed next. Somewhat coincidentally, I was just looking for my own post here to help refresh my own understanding.

    -Aaron

  6. I downloaded the AS3 Bundle and the latest version of RakeMate, and added the included files ./RakeMate/rake_mate.rb & ./RakeMate/run_rake_task.rb into the AS3 Bundle under ./Support/ (you may have to satisfy run_rake_mate include line, with something more explicit , or include the class directly in the rake_mate.rb. )

    Then you can execute rake similar to how its done in the ruby bundle for run rake task.(you can pretty much copy and paste the script from ruby rake tasks to a new rake/build/run using the Bundle editor.

    I created hotkey to run rake task and i get a nice popup menu that ask me what rake task i want to run thats defined in the rakefile.rb.

    This pretty much lets me do everything i need, and also get nice debug output!

  7. oh, you will want to set the input to NONE, and the output as Show as HTML. and make sure the scope selector is source.actionscript.3, text.xml.mxml, text.xml

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s