sprout-as3-puremvc-bundle 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/component/component_generator.rb +18 -0
- data/lib/sprout/generators/component/templates/Component.mxml +3 -0
- data/lib/sprout/generators/component/templates/TestSuite.as +18 -0
- data/lib/sprout/generators/component/templates/VisualTestCase.as +32 -0
- data/lib/sprout/generators/project/project_generator.rb +163 -0
- data/lib/sprout/generators/project/templates/MainClass.as +139 -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/deploy/assets/css/main.css +5 -0
- data/lib/sprout/generators/project/templates/deploy/assets/js/swfobject.js +5 -0
- data/lib/sprout/generators/project/templates/deploy/assets/swf/express_install.swf +0 -0
- data/lib/sprout/generators/project/templates/deploy/index.html +30 -0
- data/lib/sprout/generators/project/templates/embed/fonts/arial.ttf +0 -0
- data/lib/sprout/generators/project/templates/embed/fonts/fonts.xml +42 -0
- data/lib/sprout/generators/project/templates/embed/template/AssetEmbedTemplate.as +15 -0
- data/lib/sprout/generators/project/templates/embed/template/FontTemplate.as +20 -0
- data/lib/sprout/generators/project/templates/generate +21 -0
- data/lib/sprout/generators/project/templates/lib/PureMVC_AS3_2_0_3.swc +0 -0
- data/lib/sprout/generators/project/templates/lib/com_ffsys_utils_font.swc +0 -0
- data/lib/sprout/generators/project/templates/lib/com_ffsys_utils_locale.swc +0 -0
- data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_core.swc +0 -0
- data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_effects.swc +0 -0
- data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_effects_tween.swc +0 -0
- data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_errors.swc +0 -0
- data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_events.swc +0 -0
- data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_io.swc +0 -0
- data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils.swc +0 -0
- data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_address.swc +0 -0
- data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_array.swc +0 -0
- data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_assert.swc +0 -0
- data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_bezier.swc +0 -0
- data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_boolean.swc +0 -0
- data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_byte.swc +0 -0
- data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_collections.swc +0 -0
- data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_display.swc +0 -0
- data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_flex.swc +0 -0
- data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_font.swc +0 -0
- data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_history.swc +0 -0
- data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_identifier.swc +0 -0
- data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_inspector.swc +0 -0
- data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_locale.swc +0 -0
- data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_number.swc +0 -0
- data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_object.swc +0 -0
- data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_random.swc +0 -0
- data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_reflection.swc +0 -0
- data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_reflection_members.swc +0 -0
- data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_reflection_meta.swc +0 -0
- data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_reflection_parser.swc +0 -0
- data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_regex.swc +0 -0
- data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_string.swc +0 -0
- data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_substitution.swc +0 -0
- data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_time.swc +0 -0
- data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_xml.swc +0 -0
- data/lib/sprout/generators/project/templates/rakeassets.rb +77 -0
- data/lib/sprout/generators/project/templates/rakefile.rb +112 -0
- data/lib/sprout/generators/project/templates/rakefonts.rb +170 -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_doc.rb +155 -0
- data/lib/sprout/tasks/asdoc_rdoc.rb +155 -0
- data/lib/sprout/tasks/asdoc_task.rb +276 -0
- data/lib/sprout/tasks/asunit_task.rb +148 -0
- data/lib/sprout/tasks/compc_doc.rb +543 -0
- data/lib/sprout/tasks/compc_rdoc.rb +543 -0
- data/lib/sprout/tasks/compc_task.rb +130 -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_rdoc.rb +484 -0
- data/lib/sprout/tasks/mxmlc_task.rb +659 -0
- data/rakefile.rb +73 -0
- metadata +192 -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,18 @@
|
|
|
1
|
+
|
|
2
|
+
class ComponentGenerator < Sprout::Generator::NamedBase # :nodoc:
|
|
3
|
+
|
|
4
|
+
def manifest
|
|
5
|
+
record do |m|
|
|
6
|
+
if(!user_requested_test)
|
|
7
|
+
m.directory full_class_dir
|
|
8
|
+
m.template 'Component.mxml', full_class_path.gsub(/.as$/, '.mxml')
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
m.directory full_test_dir
|
|
12
|
+
m.template 'VisualTestCase.as', full_test_case_path
|
|
13
|
+
|
|
14
|
+
m.template 'TestSuite.as', File.join(test_dir, 'AllTests.as')
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
end
|
|
@@ -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,32 @@
|
|
|
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
|
+
addChild(<%= instance_name %>);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
override protected function tearDown():void {
|
|
19
|
+
super.tearDown();
|
|
20
|
+
removeChild(<%= instance_name %>);
|
|
21
|
+
<%= instance_name %> = null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
public function testInstantiated():void {
|
|
25
|
+
assertTrue("<%= instance_name %> is <%= class_name %>", <%= instance_name %> is <%= class_name %>);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public function testFailure():void {
|
|
29
|
+
assertTrue("Failing test", false);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
class ProjectGenerator < Sprout::Generator::NamedBase # :nodoc:
|
|
2
|
+
|
|
3
|
+
def manifest
|
|
4
|
+
record do |m|
|
|
5
|
+
|
|
6
|
+
template_src = "#{source_path( './' )}";
|
|
7
|
+
|
|
8
|
+
lib_dir = "lib";
|
|
9
|
+
opt_dir = "opt";
|
|
10
|
+
|
|
11
|
+
#puts "template src #{template_src}";
|
|
12
|
+
|
|
13
|
+
base = class_name;
|
|
14
|
+
m.directory( base );
|
|
15
|
+
|
|
16
|
+
#directory for template files
|
|
17
|
+
m.directory( File.join( base, 'embed', 'template' ) );
|
|
18
|
+
|
|
19
|
+
#directory for embedded images
|
|
20
|
+
m.directory( File.join( base, 'embed', 'images' ) );
|
|
21
|
+
|
|
22
|
+
#directory for embedded audio
|
|
23
|
+
m.directory( File.join( base, 'embed', 'audio' ) );
|
|
24
|
+
|
|
25
|
+
#directory for embedded font files
|
|
26
|
+
m.directory( File.join( base, 'embed', 'fonts' ) );
|
|
27
|
+
|
|
28
|
+
#top level deploy runtime assets directory
|
|
29
|
+
m.directory( File.join( base, 'deploy', 'assets' ) );
|
|
30
|
+
|
|
31
|
+
#runtime asset sub-directories
|
|
32
|
+
m.directory( File.join( base, 'deploy', 'assets', 'css' ) );
|
|
33
|
+
m.directory( File.join( base, 'deploy', 'assets', 'js' ) );
|
|
34
|
+
m.directory( File.join( base, 'deploy', 'assets', 'swf' ) );
|
|
35
|
+
m.directory( File.join( base, 'deploy', 'assets', 'xml' ) );
|
|
36
|
+
|
|
37
|
+
#directory for swc libraries
|
|
38
|
+
m.directory( File.join( base, 'lib' ) );
|
|
39
|
+
|
|
40
|
+
#directory for source libraries
|
|
41
|
+
m.directory( File.join( base, 'lib', 'src' ) );
|
|
42
|
+
|
|
43
|
+
#directory for the script/generate stub script
|
|
44
|
+
m.directory( File.join( base, 'script' ) );
|
|
45
|
+
|
|
46
|
+
#directory for all project classes
|
|
47
|
+
m.directory( File.join( base, 'src' ) );
|
|
48
|
+
|
|
49
|
+
#directory for unit test classes
|
|
50
|
+
m.directory( File.join( base, 'test' ) );
|
|
51
|
+
|
|
52
|
+
#add the fonts embed definition xml document
|
|
53
|
+
m.file(
|
|
54
|
+
File.join( 'embed', 'fonts', 'fonts.xml' ),
|
|
55
|
+
File.join( base, 'embed', 'fonts', 'fonts.xml' ) );
|
|
56
|
+
|
|
57
|
+
#add the font class template
|
|
58
|
+
m.file(
|
|
59
|
+
File.join( 'embed', 'template', 'FontTemplate.as' ),
|
|
60
|
+
File.join( base, 'embed', 'template', 'FontTemplate.as' ) );
|
|
61
|
+
|
|
62
|
+
#add the embed template
|
|
63
|
+
m.file(
|
|
64
|
+
File.join( 'embed', 'template', 'AssetEmbedTemplate.as' ),
|
|
65
|
+
File.join( base, 'embed', 'template', 'AssetEmbedTemplate.as' ) );
|
|
66
|
+
|
|
67
|
+
#add the default embedded font
|
|
68
|
+
m.file(
|
|
69
|
+
File.join( 'embed', 'fonts', 'arial.ttf' ),
|
|
70
|
+
File.join( base, 'embed', 'fonts', 'arial.ttf' ) );
|
|
71
|
+
|
|
72
|
+
#add the swfobject js file
|
|
73
|
+
m.file(
|
|
74
|
+
File.join( 'deploy', 'assets', 'js', 'swfobject.js' ),
|
|
75
|
+
File.join( base, 'deploy', 'assets', 'js', 'swfobject.js' ) );
|
|
76
|
+
|
|
77
|
+
#add the express install file
|
|
78
|
+
m.file(
|
|
79
|
+
File.join( 'deploy', 'assets', 'swf', 'express_install.swf' ),
|
|
80
|
+
File.join( base, 'deploy', 'assets', 'swf', 'express_install.swf' ) );
|
|
81
|
+
|
|
82
|
+
#add the main css file
|
|
83
|
+
m.file(
|
|
84
|
+
File.join( 'deploy', 'assets', 'css', 'main.css' ),
|
|
85
|
+
File.join( base, 'deploy', 'assets', 'css', 'main.css' ) );
|
|
86
|
+
|
|
87
|
+
#copy all the lib swcs
|
|
88
|
+
lib_pattern = File.join( template_src, lib_dir, "*.{swc}" );
|
|
89
|
+
contents = Dir.glob( lib_pattern );
|
|
90
|
+
contents.each do |swc|
|
|
91
|
+
swc_name = File.basename( swc );
|
|
92
|
+
m.file File.join( lib_dir, swc_name ), File.join( base, lib_dir, swc_name );
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
#copy optional libraries
|
|
96
|
+
opt_pattern = File.join( template_src, lib_dir, opt_dir, "**", "*.{swc}" );
|
|
97
|
+
opt_contents = Dir.glob( opt_pattern );
|
|
98
|
+
|
|
99
|
+
opt_contents.each do |opt|
|
|
100
|
+
opt_path = opt.sub( File.join( template_src, lib_dir, opt_dir ), "" );
|
|
101
|
+
|
|
102
|
+
target = File.join( base, lib_dir, opt_dir, opt_path );
|
|
103
|
+
parent = File.dirname( target );
|
|
104
|
+
|
|
105
|
+
if !File.exists?( parent )
|
|
106
|
+
FileUtils.mkdir_p( parent );
|
|
107
|
+
end
|
|
108
|
+
m.file opt.sub( template_src, "" ), target;
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
#add the main index file
|
|
112
|
+
m.template(
|
|
113
|
+
File.join( 'deploy', 'index.html' ),
|
|
114
|
+
File.join( base, 'deploy', 'index.html' ) );
|
|
115
|
+
|
|
116
|
+
#rake files
|
|
117
|
+
m.template(
|
|
118
|
+
'rakefile.rb',
|
|
119
|
+
File.join( base, "rakefile.rb" ) );
|
|
120
|
+
m.template(
|
|
121
|
+
'rakefonts.rb',
|
|
122
|
+
File.join( base, "rakefonts.rb" ) );
|
|
123
|
+
m.template(
|
|
124
|
+
'rakeassets.rb',
|
|
125
|
+
File.join( base, "rakeassets.rb" ) );
|
|
126
|
+
|
|
127
|
+
#readme
|
|
128
|
+
m.template(
|
|
129
|
+
'README.txt',
|
|
130
|
+
File.join( base, "README.txt" ) );
|
|
131
|
+
|
|
132
|
+
#generate stub script
|
|
133
|
+
m.template(
|
|
134
|
+
'generate',
|
|
135
|
+
File.join( base, 'script', "generate" ), :chmod => 0755 );
|
|
136
|
+
|
|
137
|
+
m.template(
|
|
138
|
+
'MainClass.as',
|
|
139
|
+
File.join( base, 'src', "#{class_name}.as" ) );
|
|
140
|
+
|
|
141
|
+
m.template(
|
|
142
|
+
'TestRunner.as',
|
|
143
|
+
File.join( base, 'src', "#{class_name}Runner.as" ) );
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
protected
|
|
148
|
+
# Not sure about the banner...
|
|
149
|
+
# def banner
|
|
150
|
+
# "Usage: #{$0} #{spec.name} ModelName [field:type, field:type]"
|
|
151
|
+
# end
|
|
152
|
+
|
|
153
|
+
def add_options!(opt)
|
|
154
|
+
opt.on('-m', '--mxml', "Create a Flex project") { |v| options[:mxml] = true }
|
|
155
|
+
# opt.on("--skip-migration",
|
|
156
|
+
# "Don't generate a migration file for this model") { |v| options[:skip_migration] = v }
|
|
157
|
+
# opt.on("--skip-fixture",
|
|
158
|
+
# "Don't generation a fixture file for this model") { |v| options[:skip_fixture] = v}
|
|
159
|
+
super
|
|
160
|
+
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
end
|