sprout-as3-bundle 0.1.27
Sign up to get free protection for your applications and to get access to all the features.
- data/README +48 -0
- data/lib/sprout/as3.rb +5 -0
- data/lib/sprout/as3/version.rb +12 -0
- data/lib/sprout/as3_tasks.rb +7 -0
- data/lib/sprout/generators/class/USAGE +42 -0
- data/lib/sprout/generators/class/class_generator.rb +20 -0
- data/lib/sprout/generators/class/templates/Class.as +8 -0
- data/lib/sprout/generators/class/templates/Component.mxml +8 -0
- data/lib/sprout/generators/class/templates/TestCase.as +30 -0
- data/lib/sprout/generators/class/templates/TestSuite.as +18 -0
- data/lib/sprout/generators/project/project_generator.rb +26 -0
- data/lib/sprout/generators/project/templates/DefaultSkin.as +7 -0
- data/lib/sprout/generators/project/templates/MainClass.as +12 -0
- data/lib/sprout/generators/project/templates/ProjectSprouts.jpg +0 -0
- data/lib/sprout/generators/project/templates/README.txt +56 -0
- data/lib/sprout/generators/project/templates/TestRunner.as +15 -0
- data/lib/sprout/generators/project/templates/generate +21 -0
- data/lib/sprout/generators/project/templates/rakefile.rb +91 -0
- data/lib/sprout/generators/suite/USAGE +0 -0
- data/lib/sprout/generators/suite/suite_generator.rb +17 -0
- data/lib/sprout/generators/suite/templates/TestSuite.as +18 -0
- data/lib/sprout/generators/test/USAGE +37 -0
- data/lib/sprout/generators/test/templates/TestCase.as +30 -0
- data/lib/sprout/generators/test/templates/TestSuite.as +18 -0
- data/lib/sprout/generators/test/test_generator.rb +20 -0
- data/lib/sprout/tasks/asdoc_task.rb +39 -0
- data/lib/sprout/tasks/asunit_task.rb +44 -0
- data/lib/sprout/tasks/compc_doc.rb +508 -0
- data/lib/sprout/tasks/compc_task.rb +100 -0
- data/lib/sprout/tasks/fcsh_task.rb +13 -0
- data/lib/sprout/tasks/fdb_task.rb +0 -0
- data/lib/sprout/tasks/mxmlc_doc.rb +484 -0
- data/lib/sprout/tasks/mxmlc_task.rb +657 -0
- data/rakefile.rb +66 -0
- metadata +128 -0
data/README
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
|
2
|
+
= ActionScript 3.0 Bundle
|
3
|
+
|
4
|
+
The ActionScript 3 Bundle provides support for ActionScript 3.0 project and class generators as well as Rake build tasks.
|
5
|
+
|
6
|
+
You can install this bundle and run it's project generator as follows:
|
7
|
+
|
8
|
+
sprout -n as3 SomeProject
|
9
|
+
|
10
|
+
Once you have generated a new project, using a terminal, you can change to the newly created directory
|
11
|
+
and use script/generate to create a variety of other features.
|
12
|
+
|
13
|
+
To generate a new ActionScript class, test case and test suite, simply run the following from the
|
14
|
+
same directory as your rakefile.
|
15
|
+
|
16
|
+
script/generate class [fully-qualified-class-name]
|
17
|
+
|
18
|
+
For example:
|
19
|
+
|
20
|
+
script/generate class utils.MathUtil
|
21
|
+
|
22
|
+
While you can change where classes are created by modifying your ProjectModel,
|
23
|
+
if the default values are used, the following statements should be correct:
|
24
|
+
|
25
|
+
The class will be created in:
|
26
|
+
src/utils/MathUtil.as
|
27
|
+
The test case will will be created in:
|
28
|
+
test/utils/MathUtilTest.as
|
29
|
+
The test suite will be created or updated at:
|
30
|
+
test/AllTests.as
|
31
|
+
|
32
|
+
If the class name passed into this generator ends with 'Test', only a test case
|
33
|
+
and test suite will be generated in the test package and no class will be generated.
|
34
|
+
|
35
|
+
You can also only create the test case and test suite by calling it's generator directly as follows:
|
36
|
+
|
37
|
+
script/generate test utils.MathUtilTest
|
38
|
+
|
39
|
+
You can update only your test suite by simply initiating the suite generator as follows:
|
40
|
+
|
41
|
+
script/generate suite
|
42
|
+
|
43
|
+
= Available Rake Tasks
|
44
|
+
|
45
|
+
* Sprout::AsDocTask
|
46
|
+
* Sprout::AsUnitTask
|
47
|
+
* Sprout::COMPCTask
|
48
|
+
* Sprout::MXMLCTask
|
data/lib/sprout/as3.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
Description:
|
2
|
+
Stubs out a new ActionScript class and test case and then rebuilds all test
|
3
|
+
suites. Pass the fully-qualified class name, either as a shell file target
|
4
|
+
or a dot-delimited string.
|
5
|
+
|
6
|
+
This command uses the Sprout::Generator::NamedBase class which will search
|
7
|
+
for configuration parameters as follows:
|
8
|
+
|
9
|
+
1) Command line parameters will supercede any of the following.
|
10
|
+
2) Search the current working directory and all parent directories
|
11
|
+
for a valid Rakefile.
|
12
|
+
3) If a Rakefile is not found, classes will be created directly from the
|
13
|
+
current working directory.
|
14
|
+
4) If a Rakefile is found, it will be loaded. If the rakefile instantiates
|
15
|
+
a Sprout::ProjectModel, that configuration will be used for source and test
|
16
|
+
paths, language preferences, and other values.
|
17
|
+
5) If no ProjectModel is instantiated in your Rakefile, the Rakefile itself
|
18
|
+
will be treated as the project root, and classes will be created from that
|
19
|
+
directory.
|
20
|
+
|
21
|
+
You can edit the erb templates that this command uses in a variety of ways.
|
22
|
+
If you would like to edit the templates for all projects on your system,
|
23
|
+
simply copy the directory at: File.dirname(__FILE__) into:
|
24
|
+
|
25
|
+
#{SPROUT_HOME}/sprout/generators/
|
26
|
+
|
27
|
+
To edit templates for a single project, copy the directory to:
|
28
|
+
|
29
|
+
#{PROJECT_HOME}/script/generators/
|
30
|
+
|
31
|
+
Once you have the contents of this package copied, simply edit the files found
|
32
|
+
in the templates/ folder to your satisfaction.
|
33
|
+
|
34
|
+
Example:
|
35
|
+
`./script/generate class utils.MathUtil`
|
36
|
+
|
37
|
+
Will create the follow files:
|
38
|
+
|
39
|
+
Class: src/utils/MathUtil.as
|
40
|
+
Test Case: test/utils/MathUtilTest.as
|
41
|
+
Test Suites: test/AllTests.as
|
42
|
+
test/utils/AllTests.as
|
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
class ClassGenerator < Sprout::Generator::NamedBase # :nodoc:
|
3
|
+
|
4
|
+
def manifest
|
5
|
+
record do |m|
|
6
|
+
# m.class_collisions class_dir, "#{class_name}Controller", "#{class_name}ControllerTest", "#{class_name}Helper"
|
7
|
+
|
8
|
+
if(!user_requested_test)
|
9
|
+
m.directory full_class_dir
|
10
|
+
m.template 'Class.as', full_class_path
|
11
|
+
end
|
12
|
+
|
13
|
+
m.directory full_test_dir
|
14
|
+
m.template 'TestCase.as', full_test_case_path
|
15
|
+
|
16
|
+
m.template 'TestSuite.as', File.join(test_dir, 'AllTests.as')
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
package <%= package_name %> {
|
2
|
+
|
3
|
+
import asunit.framework.TestCase;
|
4
|
+
|
5
|
+
public class <%= test_case_name %> extends TestCase {
|
6
|
+
private var <%= instance_name %>:<%= class_name %>;
|
7
|
+
|
8
|
+
public function <%= test_case_name %>(methodName:String=null) {
|
9
|
+
super(methodName)
|
10
|
+
}
|
11
|
+
|
12
|
+
override protected function setUp():void {
|
13
|
+
super.setUp();
|
14
|
+
<%= instance_name %> = new <%= class_name %>();
|
15
|
+
}
|
16
|
+
|
17
|
+
override protected function tearDown():void {
|
18
|
+
super.tearDown();
|
19
|
+
<%= instance_name %> = null;
|
20
|
+
}
|
21
|
+
|
22
|
+
public function testInstantiated():void {
|
23
|
+
assertTrue("<%= instance_name %> is <%= class_name %>", <%= instance_name %> is <%= class_name %>);
|
24
|
+
}
|
25
|
+
|
26
|
+
public function testFailure():void {
|
27
|
+
assertTrue("Failing test", false);
|
28
|
+
}
|
29
|
+
}
|
30
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
package {
|
2
|
+
/**
|
3
|
+
* This file has been automatically created using
|
4
|
+
* #!/usr/bin/ruby script/generate suite
|
5
|
+
* If you modify it and run this script, your
|
6
|
+
* modifications will be lost!
|
7
|
+
*/
|
8
|
+
|
9
|
+
import asunit.framework.TestSuite;<% test_case_classes.each do |test_case| %>
|
10
|
+
import <%= test_case %>;<% end %>
|
11
|
+
|
12
|
+
public class AllTests extends TestSuite {
|
13
|
+
|
14
|
+
public function AllTests() {<% test_case_classes.each do |test_case| %>
|
15
|
+
addTest(new <%= test_case %>());<% end %>
|
16
|
+
}
|
17
|
+
}
|
18
|
+
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
class ProjectGenerator < Sprout::Generator::NamedBase # :nodoc:
|
3
|
+
|
4
|
+
def manifest
|
5
|
+
record do |m|
|
6
|
+
base = class_name
|
7
|
+
m.directory base
|
8
|
+
m.directory File.join(base, 'assets/skins', project_name)
|
9
|
+
m.directory File.join(base, 'bin')
|
10
|
+
m.directory File.join(base, 'lib')
|
11
|
+
m.directory File.join(base, 'script')
|
12
|
+
m.directory File.join(base, 'src')
|
13
|
+
m.directory File.join(base, 'test')
|
14
|
+
|
15
|
+
m.file 'ProjectSprouts.jpg', File.join(base, 'assets/skins', project_name, 'ProjectSprouts.jpg')
|
16
|
+
m.template 'rakefile.rb', File.join(base, "rakefile.rb")
|
17
|
+
m.template 'README.txt', File.join(base, "README.txt")
|
18
|
+
|
19
|
+
m.template 'generate', File.join(base, 'script', "generate"), :chmod => 0755
|
20
|
+
m.template 'DefaultSkin.as', File.join(base, 'assets/skins', project_name + "Skin.as")
|
21
|
+
|
22
|
+
m.template 'MainClass.as', File.join(base, 'src', "#{class_name}.as")
|
23
|
+
m.template 'TestRunner.as', File.join(base, 'src', "#{class_name}Runner.as")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
package {
|
2
|
+
import flash.display.Sprite;
|
3
|
+
import skins.<%= project_name %>Skin;
|
4
|
+
|
5
|
+
public class <%= project_name %> extends Sprite {
|
6
|
+
|
7
|
+
public function <%= project_name %>() {
|
8
|
+
addChild(new <%= project_name %>Skin.ProjectSprouts());
|
9
|
+
trace("<%= project_name %> instantiated!");
|
10
|
+
}
|
11
|
+
}
|
12
|
+
}
|
Binary file
|
@@ -0,0 +1,56 @@
|
|
1
|
+
|
2
|
+
########################################
|
3
|
+
This project was generated using Sprouts
|
4
|
+
http://code.google.com/p/projectsprouts/
|
5
|
+
|
6
|
+
Please report any bugs to:
|
7
|
+
http://code.google.com/p/projectsprouts/issues/list
|
8
|
+
|
9
|
+
Please feel free to ask questions at:
|
10
|
+
http://groups.google.com/group/projectsprouts
|
11
|
+
|
12
|
+
########################################
|
13
|
+
Using your favorite terminal, cd to this directory have fun!
|
14
|
+
|
15
|
+
########################################
|
16
|
+
To create a new ActionScript class, TestCase and rebuild all project TestSuites:
|
17
|
+
|
18
|
+
script/generate class -s utils.MathUtil
|
19
|
+
|
20
|
+
########################################
|
21
|
+
To create a new Interface begin the name with I + Capital letter (eg: ISomeName)
|
22
|
+
or end the name with 'able'
|
23
|
+
|
24
|
+
Name begins with Capital 'I' followed by another capital letter
|
25
|
+
script/generate class utils.ISomeName
|
26
|
+
|
27
|
+
or
|
28
|
+
|
29
|
+
Name ends with 'able'
|
30
|
+
script/generate class utils.Observable
|
31
|
+
|
32
|
+
or
|
33
|
+
|
34
|
+
Explicitly identify interface creation
|
35
|
+
script/generate interface utils.SomeInterface
|
36
|
+
|
37
|
+
########################################
|
38
|
+
To create a new TestCase only, enter the following:
|
39
|
+
|
40
|
+
script/generate test utils.SomeTest
|
41
|
+
|
42
|
+
########################################
|
43
|
+
To compile and launch your application:
|
44
|
+
|
45
|
+
rake
|
46
|
+
|
47
|
+
########################################
|
48
|
+
To compile and launch your test suites:
|
49
|
+
|
50
|
+
rake test
|
51
|
+
|
52
|
+
########################################
|
53
|
+
To see all available rake tasks:
|
54
|
+
|
55
|
+
rake -T
|
56
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
package {
|
2
|
+
import asunit.textui.TestRunner;
|
3
|
+
|
4
|
+
public class <%= project_name %>Runner extends TestRunner {
|
5
|
+
|
6
|
+
public function <%= project_name %>Runner() {
|
7
|
+
// start(clazz:Class, methodName:String, showTrace:Boolean)
|
8
|
+
// NOTE: sending a particular class and method name will
|
9
|
+
// execute setUp(), the method and NOT tearDown.
|
10
|
+
// This allows you to get visual confirmation while developing
|
11
|
+
// visual entities
|
12
|
+
start(AllTests, null, TestRunner.SHOW_TRACE);
|
13
|
+
}
|
14
|
+
}
|
15
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'rubygems'
|
3
|
+
require 'sprout'
|
4
|
+
sprout 'sprout-as3-bundle'
|
5
|
+
|
6
|
+
# Add a class name if TestSuites were generated
|
7
|
+
if(ARGV.size == 1 && ARGV[0] == 'suite')
|
8
|
+
ARGV << 'AllTests'
|
9
|
+
end
|
10
|
+
|
11
|
+
# Insert class type by default
|
12
|
+
if(ARGV.size == 1)
|
13
|
+
ARGV.unshift('class')
|
14
|
+
end
|
15
|
+
|
16
|
+
# Execute generators like this:
|
17
|
+
# script/generate class utils.MathUtil
|
18
|
+
# script/generate suite
|
19
|
+
# script/generate test utils.MathUtilTest
|
20
|
+
|
21
|
+
Sprout::Sprout.generate('as3', ARGV.shift, ARGV, File.dirname(File.dirname(__FILE__)))
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'sprout'
|
2
|
+
sprout 'as3'
|
3
|
+
|
4
|
+
############################################
|
5
|
+
# Uncomment and modify any of the following:
|
6
|
+
model = Sprout::ProjectModel.instance
|
7
|
+
model.project_name = '<%= project_name %>'
|
8
|
+
|
9
|
+
# Default Values:
|
10
|
+
# model.src_dir = 'src'
|
11
|
+
# model.lib_dir = 'lib'
|
12
|
+
# model.swc_dir = 'lib'
|
13
|
+
# model.bin_dir = 'bin'
|
14
|
+
# model.test_dir = 'test'
|
15
|
+
# model.asset_dir = 'assets'
|
16
|
+
model.language = 'as3'
|
17
|
+
|
18
|
+
output = "#{model.bin_dir}/<%= project_name %>.swf"
|
19
|
+
test_output = "#{model.bin_dir}/<%= project_name %>Runner.swf"
|
20
|
+
|
21
|
+
############################################
|
22
|
+
# Set up remote library tasks
|
23
|
+
# the task name will be converted to a string
|
24
|
+
# and modified as follows sprout-#{name}-library
|
25
|
+
# unless you pass t.gem_name = 'full-sprout-name'
|
26
|
+
# For libraries that contain source code, the
|
27
|
+
# task name will also be the folder name that
|
28
|
+
# will be added to ProjectModel.lib_dir
|
29
|
+
# For a complete list of available sprout gems:
|
30
|
+
# http://gems.projectsprouts.org/quick/index
|
31
|
+
# You can also search that list directly from a
|
32
|
+
# terminal as follows:
|
33
|
+
# gem search -r library
|
34
|
+
# Any gems with 'sprout-' prefix and '-library'
|
35
|
+
# suffix can be be used as a library task.
|
36
|
+
|
37
|
+
library :asunit3
|
38
|
+
library :corelib
|
39
|
+
|
40
|
+
############################################
|
41
|
+
# Launch the application using the Flash Player
|
42
|
+
# NOTE: double-quoted strings in ruby enable
|
43
|
+
# runtime expression evaluation using the
|
44
|
+
# following syntax:
|
45
|
+
# "Some String with: #{variable}"
|
46
|
+
|
47
|
+
desc "Compile and run main application"
|
48
|
+
flashplayer :run => output
|
49
|
+
|
50
|
+
# Make 'run' the default task
|
51
|
+
task :default => :run
|
52
|
+
|
53
|
+
############################################
|
54
|
+
# Launch the test suites using the Flash Player
|
55
|
+
|
56
|
+
desc "Compile and run test suites"
|
57
|
+
flashplayer :test => test_output
|
58
|
+
|
59
|
+
############################################
|
60
|
+
# Compile your application using mxmlc
|
61
|
+
# Any library tasks that are set as
|
62
|
+
# dependencies will automatically be added
|
63
|
+
# to the compiler source or swc paths
|
64
|
+
|
65
|
+
desc "Compile application"
|
66
|
+
mxmlc output => :corelib do |t|
|
67
|
+
t.warnings = true
|
68
|
+
t.default_background_color = '#FFFFFF'
|
69
|
+
t.default_frame_rate = 24
|
70
|
+
t.default_size = '600 400'
|
71
|
+
t.input = "#{model.src_dir}/<%= project_name %>.as"
|
72
|
+
t.source_path << model.asset_dir
|
73
|
+
# t.source_path << "#{model.lib_dir}/non-sprout-src-library"
|
74
|
+
# t.library_path << "#{model.lib_dir}/non-sprout.swc"
|
75
|
+
end
|
76
|
+
|
77
|
+
############################################
|
78
|
+
# Compile test harness using mxmlc
|
79
|
+
|
80
|
+
desc "Compile test harness"
|
81
|
+
mxmlc test_output => [:asunit3, :corelib] do |t|
|
82
|
+
t.warnings = true
|
83
|
+
t.default_background_color = '#FFFFFF'
|
84
|
+
t.default_frame_rate = 24
|
85
|
+
t.verbose_stacktraces = true
|
86
|
+
t.default_size = "800 450"
|
87
|
+
t.input = "#{model.src_dir}/<%= project_name %>Runner.as"
|
88
|
+
t.source_path << model.src_dir
|
89
|
+
t.source_path << model.test_dir
|
90
|
+
t.source_path << model.asset_dir
|
91
|
+
end
|