Further Sprouts

This a continuation of the project my Spouts.

Project Aims

Create new classes and extend previous project


1. In the Terminal cd to an appropriate folder. (In my case ‘sprouts’ within my ‘workspace’. )

2. Enter in the Terminal:

$ sprout -n as2 AnotherProject

A new folder ‘AnotherProject’ is created with all the base Sprouts files.

The Terminal output will be listing the files created:

>> Creating new project ‘AnotherProject’ with as2
create AnotherProject
create AnotherProject/assets/skins/AnotherProjectSkin
create AnotherProject/bin
create AnotherProject/lib
create AnotherProject/script
create AnotherProject/src
create AnotherProject/test
create AnotherProject/assets/skins/AnotherProjectSkin/ProjectSprouts.png
create AnotherProject/rakefile.rb
create AnotherProject/README.txt
create AnotherProject/script/generate
create AnotherProject/src/AnotherProject.as
create AnotherProject/test/AnotherProjectRunner.as

2. cd to the new folder

$ cd AnotherProject

3. Make a new Class

See as2 bundle on the projectsprouts site.
Enter in the Terminal:

$ script/generate class utils.MathUtil
The output will be:
create src/utils
create src/utils/MathUtil.as
create test/utils
create test/utils/MathUtilTest.as
create test/AllTests.as

This creates a suit of classes including the MathUtilTest.as Class.
The MathUtil Class is as follows:

class utils.MathUtil { public static var linkageId:String = "__Packages.utils.MathUtil"; public static var classRef:Function = MathUtil; public function MathUtil() { } public static var serializable:Boolean = Object.registerClass(linkageId, classRef); }

The README.txt file the Sprout created is worth looking at. It lists useful Sprout and Rake commands. For example:

$ rake -T

lists all rake tasks as follows:

rake clean # Remove any temporary products.
rake clobber # Remove any generated file.
rake run # Compile and run main application
rake test # Compile and run test suites
$ rake run

will create and open the AnotherProject.swf


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 )

Google+ photo

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

Connecting to %s