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
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
require 'sprout'
|
|
2
|
+
require 'rakefonts'
|
|
3
|
+
require 'rakeassets'
|
|
4
|
+
# Optionally load gems from a server other than rubyforge:
|
|
5
|
+
# set_sources 'http://gems.projectsprouts.org'
|
|
6
|
+
sprout 'as3'
|
|
7
|
+
|
|
8
|
+
############################################
|
|
9
|
+
# Uncomment and modify any of the following:
|
|
10
|
+
Sprout::ProjectModel.setup do |model|
|
|
11
|
+
model.project_name = '<%= project_name %>'
|
|
12
|
+
# Default Values:
|
|
13
|
+
# model.src_dir = 'src'
|
|
14
|
+
# model.lib_dir = 'lib'
|
|
15
|
+
# model.swc_dir = 'lib'
|
|
16
|
+
model.bin_dir = 'deploy'
|
|
17
|
+
# model.test_dir = 'test'
|
|
18
|
+
# model.doc_dir = 'doc'
|
|
19
|
+
model.asset_dir = 'embed'
|
|
20
|
+
model.language = 'as3'
|
|
21
|
+
model.output = "#{model.bin_dir}/<%= project_name.downcase %>.swf"
|
|
22
|
+
model.test_output = "#{model.bin_dir}/<%= project_name.downcase %>_runner.swf"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
model = Sprout::ProjectModel.instance
|
|
26
|
+
|
|
27
|
+
############################################
|
|
28
|
+
# Set up remote library tasks
|
|
29
|
+
# the task name will be converted to a string
|
|
30
|
+
# and modified as follows sprout-#{name}-library
|
|
31
|
+
# unless you pass t.gem_name = 'full-sprout-name'
|
|
32
|
+
# For libraries that contain source code, the
|
|
33
|
+
# task name will also be the folder name that
|
|
34
|
+
# will be added to ProjectModel.lib_dir
|
|
35
|
+
# For a complete list of available sprout gems:
|
|
36
|
+
# http://rubyforge.org/frs/?group_id=3688
|
|
37
|
+
# You can also search that list directly from a
|
|
38
|
+
# terminal as follows:
|
|
39
|
+
# gem search -r sprout-*library
|
|
40
|
+
|
|
41
|
+
library :asunit3
|
|
42
|
+
library :corelib
|
|
43
|
+
|
|
44
|
+
############################################
|
|
45
|
+
# Launch the application using the Flash Player
|
|
46
|
+
# NOTE: double-quoted strings in ruby enable
|
|
47
|
+
# runtime expression evaluation using the
|
|
48
|
+
# following syntax:
|
|
49
|
+
# "Some String with: #{variable}"
|
|
50
|
+
|
|
51
|
+
desc "Compile and run main application"
|
|
52
|
+
flashplayer :run => model.output
|
|
53
|
+
|
|
54
|
+
# Make 'run' the default task
|
|
55
|
+
task :default => :run
|
|
56
|
+
|
|
57
|
+
############################################
|
|
58
|
+
# Launch the test suites using the Flash Player
|
|
59
|
+
|
|
60
|
+
desc "Compile and run test suites"
|
|
61
|
+
flashplayer :test => model.test_output
|
|
62
|
+
|
|
63
|
+
############################################
|
|
64
|
+
# Compile your application using mxmlc
|
|
65
|
+
# Any library tasks that are set as
|
|
66
|
+
# dependencies will automatically be added
|
|
67
|
+
# to the compiler source or swc paths
|
|
68
|
+
|
|
69
|
+
desc "Compile application"
|
|
70
|
+
mxmlc model.output => [:corelib] do |t|
|
|
71
|
+
# Uncomment to use the Flex 3 SDK
|
|
72
|
+
t.gem_name = 'sprout-flex3sdk-tool'
|
|
73
|
+
t.warnings = true
|
|
74
|
+
t.default_background_color = '#FFFFFF'
|
|
75
|
+
t.default_frame_rate = 30
|
|
76
|
+
t.default_size = '800 600'
|
|
77
|
+
t.input = "#{model.src_dir}/<%= project_name %>.as"
|
|
78
|
+
t.source_path << model.asset_dir
|
|
79
|
+
# t.source_path << "#{model.lib_dir}/non-sprout-src-library"
|
|
80
|
+
|
|
81
|
+
#added lib directory as a library path
|
|
82
|
+
#so that swc files can be dropped in lib
|
|
83
|
+
#and automatically picked up
|
|
84
|
+
t.library_path << "#{model.lib_dir}"
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
############################################
|
|
88
|
+
# Compile test harness using mxmlc
|
|
89
|
+
|
|
90
|
+
desc "Compile test harness"
|
|
91
|
+
mxmlc model.test_output => [:asunit3, :corelib] do |t|
|
|
92
|
+
# Uncomment to use the Flex 3 SDK
|
|
93
|
+
t.gem_name = 'sprout-flex3sdk-tool'
|
|
94
|
+
t.warnings = true
|
|
95
|
+
t.default_background_color = '#FFFFFF'
|
|
96
|
+
t.default_frame_rate = 24
|
|
97
|
+
t.verbose_stacktraces = true
|
|
98
|
+
t.default_size = "800 450"
|
|
99
|
+
t.input = "#{model.src_dir}/<%= project_name %>Runner.as"
|
|
100
|
+
t.source_path << model.src_dir
|
|
101
|
+
t.source_path << model.test_dir
|
|
102
|
+
t.source_path << model.asset_dir
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
############################################
|
|
106
|
+
# Build documentation for your application
|
|
107
|
+
|
|
108
|
+
desc "Create documentation"
|
|
109
|
+
asdoc model.doc_dir => model.test_output do |t|
|
|
110
|
+
# Uncomment to use the Flex 3 SDK
|
|
111
|
+
t.gem_name = 'sprout-flex3sdk-tool'
|
|
112
|
+
end
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
require 'rexml/document'
|
|
2
|
+
require 'rexml/element'
|
|
3
|
+
require "erb"
|
|
4
|
+
|
|
5
|
+
ERR_NO_TEMPLATE = "The template class does not exist.";
|
|
6
|
+
ERR_NO_FONT_XML = "The font definition XML document does not exist.";
|
|
7
|
+
|
|
8
|
+
task :fonts do |t|
|
|
9
|
+
|
|
10
|
+
#folder for font definition files and for automatically
|
|
11
|
+
#generated class files
|
|
12
|
+
font_dir = File.join( "embed", "fonts" );
|
|
13
|
+
|
|
14
|
+
#path to erb template directory
|
|
15
|
+
template_dir = File.join( "embed", "template" );
|
|
16
|
+
|
|
17
|
+
#directory where compiled swf files containing the fonts
|
|
18
|
+
#will be generated
|
|
19
|
+
font_output_dir = File.join( "deploy", "assets", "fonts" );
|
|
20
|
+
|
|
21
|
+
#path to the template class file
|
|
22
|
+
font_template = File.join( template_dir, "FontTemplate.as" );
|
|
23
|
+
|
|
24
|
+
#path to the XML document declaring which fonts should
|
|
25
|
+
#be embedded per locale
|
|
26
|
+
font_definition_document = File.join( font_dir, "fonts.xml" );
|
|
27
|
+
|
|
28
|
+
#path to write the converted xml document to
|
|
29
|
+
font_runtime_document = File.join( "deploy", "assets", "xml", "fonts.xml" );
|
|
30
|
+
|
|
31
|
+
#a pattern to replace using gsub on the output file
|
|
32
|
+
#path before the path is written to the output
|
|
33
|
+
#xml document
|
|
34
|
+
movie_path_pattern = /^deploy\//
|
|
35
|
+
|
|
36
|
+
movie_output_file = nil;
|
|
37
|
+
|
|
38
|
+
#array of font groups
|
|
39
|
+
groups = [];
|
|
40
|
+
|
|
41
|
+
#get the XML document
|
|
42
|
+
file = File.new( font_definition_document )
|
|
43
|
+
|
|
44
|
+
if !File.exists?( file )
|
|
45
|
+
puts ERR_NO_FONT_XML;
|
|
46
|
+
exit( 1 );
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
template = File.new( font_template )
|
|
50
|
+
|
|
51
|
+
if !File.exists?( file )
|
|
52
|
+
puts ERR_NO_TEMPLATE;
|
|
53
|
+
exit( 1 );
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
#now read in the template file
|
|
57
|
+
fp = File.open( font_template );
|
|
58
|
+
contents = fp.read();
|
|
59
|
+
fp.close();
|
|
60
|
+
|
|
61
|
+
#start the XML parsing
|
|
62
|
+
doc = REXML::Document.new( file )
|
|
63
|
+
|
|
64
|
+
#convert the document to an object structure
|
|
65
|
+
doc.elements.each( "TypeFaceManager/TypeFaceGroup" ) { |element|
|
|
66
|
+
group = { :lang => element.attributes["lang"], :fonts => [] };
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
output_movie_name = group[:lang] + ".swf";
|
|
70
|
+
movie_output_file = File.join( font_output_dir, output_movie_name );
|
|
71
|
+
|
|
72
|
+
path_element = REXML::Element.new( "path" );
|
|
73
|
+
path_element.add_text( movie_output_file.gsub( movie_path_pattern, "" ) );
|
|
74
|
+
|
|
75
|
+
element.add_element( path_element );
|
|
76
|
+
|
|
77
|
+
element.each_element( "TypeFace" ) { |font_element|
|
|
78
|
+
font = { :id => font_element.attributes["id"] }
|
|
79
|
+
|
|
80
|
+
#has an embed elements been declared
|
|
81
|
+
has_embed = ( font_element.get_elements("Embed").length > 0 );
|
|
82
|
+
|
|
83
|
+
if has_embed
|
|
84
|
+
font[:source] =
|
|
85
|
+
font_element.get_elements("Embed/source")[ 0 ].get_text();
|
|
86
|
+
font[:fontFamily] =
|
|
87
|
+
font_element.get_elements("Embed/fontFamily")[ 0 ].get_text();
|
|
88
|
+
font[:fontWeight] =
|
|
89
|
+
font_element.get_elements("Embed/fontWeight")[ 0 ].get_text();
|
|
90
|
+
font[:mimeType] =
|
|
91
|
+
font_element.get_elements("Embed/mimeType")[ 0 ].get_text();
|
|
92
|
+
font[:unicodeRange] =
|
|
93
|
+
font_element.get_elements("Embed/unicodeRange")[ 0 ].get_text();
|
|
94
|
+
font[:variable] =
|
|
95
|
+
font_element.get_elements("Embed/variable")[ 0 ].get_text();
|
|
96
|
+
|
|
97
|
+
#only push the font onto the group list if this typeface
|
|
98
|
+
#is being embedded
|
|
99
|
+
group[:fonts].push( font );
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
styles = font_element.get_elements("TypeFaceStyles/TypeFaceStyle");
|
|
103
|
+
|
|
104
|
+
#add the correct text format font attribute
|
|
105
|
+
#which points to the fontFamily when embedding
|
|
106
|
+
#for all declared text formated
|
|
107
|
+
styles.each do |style|
|
|
108
|
+
|
|
109
|
+
#this typeface has no embed declaration
|
|
110
|
+
#output a warning if no font element has been declared
|
|
111
|
+
#for the styles associated with the typeface
|
|
112
|
+
if !has_embed
|
|
113
|
+
has_style_font = ( style.get_elements("font").length > 0 );
|
|
114
|
+
|
|
115
|
+
if !has_style_font
|
|
116
|
+
puts "Warning: a style for a non-embedded typeface has no font element."
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
style.add_element(
|
|
122
|
+
REXML::Element.new("font").add_text(font[:fontFamily] ) );
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
#we're done with the Embed element at this point
|
|
126
|
+
#so remove it
|
|
127
|
+
font_element.delete_element( "Embed" );
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
groups.push( group );
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
#loop through all the groups
|
|
134
|
+
groups.each do |group|
|
|
135
|
+
|
|
136
|
+
#set up the instance variables to
|
|
137
|
+
#be used for the template ERB parsing
|
|
138
|
+
@fontClassName = "TypeFaceGroup_" + group[:lang];
|
|
139
|
+
sym = "@group".intern;
|
|
140
|
+
instance_variable_set( sym, group );
|
|
141
|
+
|
|
142
|
+
#set up the ERB instance using the template
|
|
143
|
+
#previously loaded
|
|
144
|
+
erb = ERB.new <<-EOF
|
|
145
|
+
#{contents}
|
|
146
|
+
EOF
|
|
147
|
+
|
|
148
|
+
#now do the erb template parsing
|
|
149
|
+
result = erb.result( binding );
|
|
150
|
+
|
|
151
|
+
#now write the parsed class file for the font group
|
|
152
|
+
output_file = File.join( font_dir, @fontClassName + ".as" );
|
|
153
|
+
fp = open( output_file, "w+" );
|
|
154
|
+
fp.write( result );
|
|
155
|
+
fp.close();
|
|
156
|
+
|
|
157
|
+
#write out the modified xml document
|
|
158
|
+
fp = open( font_runtime_document, "w+" );
|
|
159
|
+
fp.write( doc.to_s() );
|
|
160
|
+
fp.close();
|
|
161
|
+
|
|
162
|
+
#now compile the swf
|
|
163
|
+
compile_result = exec( "mxmlc #{output_file} -o #{movie_output_file}" );
|
|
164
|
+
|
|
165
|
+
#output the result for compiling the swf movie
|
|
166
|
+
puts "#{compile_result}"
|
|
167
|
+
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
end
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
# Generate a new ActionScript 3.0 test suite
|
|
3
|
+
# This generator can be executed as follows:
|
|
4
|
+
#
|
|
5
|
+
# sprout -n as3 SomeProject
|
|
6
|
+
# cd SomeProject
|
|
7
|
+
# script/generator suite
|
|
8
|
+
#
|
|
9
|
+
class SuiteGenerator < Sprout::Generator::NamedBase # :nodoc:
|
|
10
|
+
|
|
11
|
+
def manifest
|
|
12
|
+
record do |m|
|
|
13
|
+
m.template 'TestSuite.as', File.join(test_dir, 'AllTests.as')
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
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,37 @@
|
|
|
1
|
+
Description:
|
|
2
|
+
Stubs out a new ActionScript test case that depends on the AsUnit framework.
|
|
3
|
+
|
|
4
|
+
This command uses the Sprout::Generator::NamedBase class which will search
|
|
5
|
+
for configuration parameters as follows:
|
|
6
|
+
|
|
7
|
+
1) Command line parameters will supercede any of the following.
|
|
8
|
+
2) Search the current working directory and all parent directories
|
|
9
|
+
for a valid Rakefile.
|
|
10
|
+
3) If a Rakefile is not found, classes will be created directly from the
|
|
11
|
+
current working directory.
|
|
12
|
+
4) If a Rakefile is found, it will be loaded. If the rakefile instantiates
|
|
13
|
+
a Sprout::ProjectModel, that configuration will be used for source and test
|
|
14
|
+
paths, language preferences, and other values.
|
|
15
|
+
5) If no ProjectModel is instantiated in your Rakefile, the Rakefile itself
|
|
16
|
+
will be treated as the project root, and classes will be created from that
|
|
17
|
+
directory.
|
|
18
|
+
|
|
19
|
+
You can edit the erb templates that this command uses in a variety of ways.
|
|
20
|
+
If you would like to edit the templates for all projects on your system,
|
|
21
|
+
simply copy the directory at: File.dirname(__FILE__) into:
|
|
22
|
+
|
|
23
|
+
#{SPROUT_HOME}/sprout/generators/
|
|
24
|
+
|
|
25
|
+
To edit templates for a single project, copy the directory to:
|
|
26
|
+
|
|
27
|
+
#{PROJECT_HOME}/script/generators/
|
|
28
|
+
|
|
29
|
+
Once you have the contents of this package copied, simply edit the files found
|
|
30
|
+
in the templates/ folder to your satisfaction.
|
|
31
|
+
|
|
32
|
+
Example:
|
|
33
|
+
`./script/generate class utils.MathUtil`
|
|
34
|
+
|
|
35
|
+
Will create the follow files:
|
|
36
|
+
|
|
37
|
+
Test Case: test/utils/MathUtilTest.as
|
|
@@ -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,20 @@
|
|
|
1
|
+
|
|
2
|
+
# Generate a new ActionScript 3.0 TestCase and rebuild the test suites.
|
|
3
|
+
# This generator can be executed as follows:
|
|
4
|
+
#
|
|
5
|
+
# sprout -n as3 SomeProject
|
|
6
|
+
# cd SomeProject
|
|
7
|
+
# script/generator test utils.MathUtilTest
|
|
8
|
+
#
|
|
9
|
+
class TestGenerator < Sprout::Generator::NamedBase # :nodoc:
|
|
10
|
+
|
|
11
|
+
def manifest
|
|
12
|
+
record do |m|
|
|
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,155 @@
|
|
|
1
|
+
module Sprout
|
|
2
|
+
class AsDocTask < ToolTask
|
|
3
|
+
# Sets the file encoding for ActionScript files. For more information see: http://livedocs.adobe.com/flex/2/docs/00001503.html#149244
|
|
4
|
+
def actionscript_file_encoding=(string)
|
|
5
|
+
@actionscript_file_encoding = string
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
# Prints detailed compile times to the standard output. The default value is true.
|
|
9
|
+
def benchmark=(boolean)
|
|
10
|
+
@benchmark = boolean
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# A list of classes to document. These classes must be in the source path. This is the default option.
|
|
14
|
+
#
|
|
15
|
+
# This option works the same way as does the -include-classes option for the compc component compiler. For more information, see Using the component compiler (http://livedocs.adobe.com/flex/201/html/compilers_123_31.html#162910).
|
|
16
|
+
def doc_classes=(strings)
|
|
17
|
+
@doc_classes = strings
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# A list of URIs whose classes should be documented. The classes must be in the source path.
|
|
21
|
+
#
|
|
22
|
+
# You must include a URI and the location of the manifest file that defines the contents of this namespace.
|
|
23
|
+
#
|
|
24
|
+
# This option works the same way as does the -include-namespaces option for the compc component compiler. For more information, see Using the component compiler. (http://livedocs.adobe.com/flex/201/html/compilers_123_31.html#162910)
|
|
25
|
+
def doc_namespaces=(strings)
|
|
26
|
+
@doc_namespaces = strings
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# A list of files that should be documented. If a directory name is in the list, it is recursively searched.
|
|
30
|
+
#
|
|
31
|
+
# This option works the same way as does the -include-sources option for the compc component compiler. For more information, see Using the component compiler (http://livedocs.adobe.com/flex/201/html/compilers_123_31.html#162910).
|
|
32
|
+
def doc_sources=(paths)
|
|
33
|
+
@doc_sources = paths
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# A list of classes that should not be documented. You must specify individual class names. Alternatively, if the ASDoc comment for the class contains the @private tag, is not documented.
|
|
37
|
+
def exclude_classes=(string)
|
|
38
|
+
@exclude_classes = string
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Whether all dependencies found by the compiler are documented. If true, the dependencies of the input classes are not documented.
|
|
42
|
+
#
|
|
43
|
+
# The default value is false.
|
|
44
|
+
def exclude_dependencies=(boolean)
|
|
45
|
+
@exclude_dependencies = boolean
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# The text that appears at the bottom of the HTML pages in the output documentation.
|
|
49
|
+
def footer=(string)
|
|
50
|
+
@footer = string
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# An integer that changes the width of the left frameset of the documentation. You can change this size to accommodate the length of your package names.
|
|
54
|
+
#
|
|
55
|
+
# The default value is 210 pixels.
|
|
56
|
+
def left_frameset_width=(number)
|
|
57
|
+
@left_frameset_width = number
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Links SWC files to the resulting application SWF file. The compiler only links in those classes for the SWC file that are required.
|
|
61
|
+
#
|
|
62
|
+
# The default value of the library-path option includes all SWC files in the libs directory and the current locale. These are required.
|
|
63
|
+
#
|
|
64
|
+
# To point to individual classes or packages rather than entire SWC files, use the source-path option.
|
|
65
|
+
#
|
|
66
|
+
# If you set the value of the library-path as an option of the command-line compiler, you must also explicitly add the framework.swc and locale SWC files. Your new entry is not appended to the library-path but replaces it.
|
|
67
|
+
#
|
|
68
|
+
# You can use the += operator to append the new argument to the list of existing SWC files.
|
|
69
|
+
#
|
|
70
|
+
# In a configuration file, you can set the append attribute of the library-path tag to true to indicate that the values should be appended to the library path rather than replace it.
|
|
71
|
+
def library_path=(files)
|
|
72
|
+
@library_path = files
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# Specifies the location of the configuration file that defines compiler options.
|
|
76
|
+
#
|
|
77
|
+
# If you specify a configuration file, you can override individual options by setting them on the command line.
|
|
78
|
+
#
|
|
79
|
+
# All relative paths in the configuration file are relative to the location of the configuration file itself.
|
|
80
|
+
#
|
|
81
|
+
# Use the += operator to chain this configuration file to other configuration files.
|
|
82
|
+
#
|
|
83
|
+
# For more information on using configuration files to provide options to the command-line compilers, see About configuration files (http://livedocs.adobe.com/flex/2/docs/00001490.html#138195).
|
|
84
|
+
def load_config=(file)
|
|
85
|
+
@load_config = file
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# The text that appears at the top of the HTML pages in the output documentation.
|
|
89
|
+
#
|
|
90
|
+
# The default value is "API Documentation".
|
|
91
|
+
def main_title=(string)
|
|
92
|
+
@main_title = string
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Not sure about this option, it was in the CLI help, but not documented on the Adobe site
|
|
96
|
+
def namespace=(string)
|
|
97
|
+
@namespace = string
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# The output directory for the generated documentation. The default value is "doc".
|
|
101
|
+
def output=(path)
|
|
102
|
+
@output = path
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# The descriptions to use when describing a package in the documentation. You can specify more than one package option.
|
|
106
|
+
#
|
|
107
|
+
# The following example adds two package descriptions to the output:
|
|
108
|
+
# asdoc -doc-sources my_dir -output myDoc -package com.my.business "Contains business classes and interfaces" -package com.my.commands "Contains command base classes and interfaces"
|
|
109
|
+
def package=(string)
|
|
110
|
+
@package = string
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Adds directories or files to the source path. The Flex compiler searches directories in the source path for MXML or AS source files that are used in your Flex applications and includes those that are required at compile time.
|
|
114
|
+
#
|
|
115
|
+
# You can use wildcards to include all files and subdirectories of a directory.
|
|
116
|
+
#
|
|
117
|
+
# To link an entire library SWC file and not individual classes or directories, use the library-path option.
|
|
118
|
+
#
|
|
119
|
+
# The source path is also used as the search path for the component compiler's include-classes and include-resource-bundles options.
|
|
120
|
+
#
|
|
121
|
+
# You can also use the += operator to append the new argument to the list of existing source path entries.
|
|
122
|
+
def source_path=(paths)
|
|
123
|
+
@source_path = paths
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# Prints undefined property and function calls; also performs compile-time type checking on assignments and options supplied to method calls.
|
|
127
|
+
#
|
|
128
|
+
# The default value is true.
|
|
129
|
+
#
|
|
130
|
+
# For more information about viewing warnings and errors, see Viewing warnings and errors (http://livedocs.adobe.com/flex/2/docs/00001517.html#182413).
|
|
131
|
+
def strict=(boolean)
|
|
132
|
+
@strict = boolean
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# The path to the ASDoc template directory. The default is the asdoc/templates directory in the ASDoc installation directory. This directory contains all the HTML, CSS, XSL, and image files used for generating the output.
|
|
136
|
+
def templates_path=(paths)
|
|
137
|
+
@templates_path = paths
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
# Enables all warnings. Set to false to disable all warnings. This option overrides the warn-warning_type options.
|
|
141
|
+
#
|
|
142
|
+
# The default value is true.
|
|
143
|
+
def warnings=(boolean)
|
|
144
|
+
@warnings = boolean
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
# The text that appears in the browser window in the output documentation.
|
|
148
|
+
#
|
|
149
|
+
# The default value is "API Documentation".
|
|
150
|
+
def window_title=(string)
|
|
151
|
+
@window_title = string
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
end
|
|
155
|
+
end
|