assertTrue is the professional blog of Luke Bayes and Ali Mills

Can I target a specific SDK using Project Sprouts?

Posted by Luke Bayes Mon, 23 Nov 2009 18:00:00 GMT

Got another great question today on the Project Sprouts list, and the answer is – yes we can!

How can Project Sprouts possibly have that much Awesome?!

Project Sprouts was originally designed (as AsProject) to solve a specific set of problems and was later entirely refactored to become a modular set of libraries that are built on top of Ruby, RubyGems and Rake.

At it’s current core, Sprouts doesn’t know about ActionScript, Flex or Flash. Project Sprouts is a collection of features that make it reasonably simple to wrap Rake around gemerators, compilers, runtimes and libraries.

The concepts we use to make Project Sprouts work are:

  • Core: The main Sprout gem that ties it all together
  • Libraries: SWC or Source libraries that can be included in a project
  • Bundles: Language-specific (currently AS2, AS3, MXML and flex4)
  • Tools: Compilers, players and other often platform specific binaries that support a bundle

All of these entities are distributed as RubyGems, but are conceptually different in that they provide support for different features and are handled and targeted by Sprouts quite differently.

To see a list of all Sprout RubyGems that are available, run the following in a terminal:

  gem list -r sprout

You can see that each (relevant) gem has a suffix that indicates the type (library, bundle or tool).

Bundles

A bundle provides all of the features to support a new project for a particular environment (or language). Bundles generally include project, and file generators, rake tasks to support different tools, and occasionally dependencies on other bundles.

You can see the current list of bundles with the following:

  gem list -r sprout-.*-bundle

The name in the middle of the dashes is the bundle "name".

This is what you can put after the -n argument when call sprout on the command line.

You can also specify the bundle at the top of a Project Sprouts Rakefile by calling the _ sprout method like _sprout ‘[bundle name]’:

  sprout 'mxml'

Libraries

Libraries are references to publicly hosted source code or SWC files that the community uses in their projects. This (in my opinion) is actually one of the most powerful and yet out of date parts of Sprouts. Because it’s such a pain to keep this listing current, we are often referencing old versions of certain libraries. The main library that you can count on being current is AsUnit.

We’re actively looking for help in keeping our libraries up to date, and if you’re interested in contributing to Sprouts in a low-effort, high-impact way, please contact us and I’ll help you get up to speed with managing these references.

You can find out what libraries are available with the following command:

  gem list -r sprout-.*-library

You can reference a library in a rakefile by calling the library method and passing it a Ruby symbol (or string) of the Library name.

  library :asunit3

Tools

For me, Tools are one of the most exciting features of Sprouts. Tools are externally referenced links to (often) platform specific binaries. These are separate from bundles, because bundles usually don’t need to change with every minor release of a tool.

You can find a list of available tools with the following command:

gem list -r sprout-.*-tool

You can specify tools in your Rakefile in any of three places:

To specify a tool on a ToolTask or TaskHelper, set the gem_name and/or gem_version parameter like:

  mxmlc 'bin/SomeProject.swf' do |t|
    t.input = 'src/SomeProject.as'
    t.gem_name = 'sprout-flex4-tool'
    t.gem_version = '4.1.60109'
  end

To specify a tool on the Project Model, use the compiler_gem_name and/or compiler_gem_version with the same values.

Tags  | no comments

Comments

Your Reply

Comment Form.

Fields denoted with an "*" are required.