sprout-as3-puremvc-bundle 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. data/README +48 -0
  2. data/lib/sprout/as3.rb +5 -0
  3. data/lib/sprout/as3/version.rb +12 -0
  4. data/lib/sprout/as3_tasks.rb +7 -0
  5. data/lib/sprout/generators/class/USAGE +42 -0
  6. data/lib/sprout/generators/class/class_generator.rb +20 -0
  7. data/lib/sprout/generators/class/templates/Class.as +8 -0
  8. data/lib/sprout/generators/class/templates/Component.mxml +8 -0
  9. data/lib/sprout/generators/class/templates/TestCase.as +30 -0
  10. data/lib/sprout/generators/class/templates/TestSuite.as +18 -0
  11. data/lib/sprout/generators/component/component_generator.rb +18 -0
  12. data/lib/sprout/generators/component/templates/Component.mxml +3 -0
  13. data/lib/sprout/generators/component/templates/TestSuite.as +18 -0
  14. data/lib/sprout/generators/component/templates/VisualTestCase.as +32 -0
  15. data/lib/sprout/generators/project/project_generator.rb +163 -0
  16. data/lib/sprout/generators/project/templates/MainClass.as +139 -0
  17. data/lib/sprout/generators/project/templates/README.txt +56 -0
  18. data/lib/sprout/generators/project/templates/TestRunner.as +15 -0
  19. data/lib/sprout/generators/project/templates/deploy/assets/css/main.css +5 -0
  20. data/lib/sprout/generators/project/templates/deploy/assets/js/swfobject.js +5 -0
  21. data/lib/sprout/generators/project/templates/deploy/assets/swf/express_install.swf +0 -0
  22. data/lib/sprout/generators/project/templates/deploy/index.html +30 -0
  23. data/lib/sprout/generators/project/templates/embed/fonts/arial.ttf +0 -0
  24. data/lib/sprout/generators/project/templates/embed/fonts/fonts.xml +42 -0
  25. data/lib/sprout/generators/project/templates/embed/template/AssetEmbedTemplate.as +15 -0
  26. data/lib/sprout/generators/project/templates/embed/template/FontTemplate.as +20 -0
  27. data/lib/sprout/generators/project/templates/generate +21 -0
  28. data/lib/sprout/generators/project/templates/lib/PureMVC_AS3_2_0_3.swc +0 -0
  29. data/lib/sprout/generators/project/templates/lib/com_ffsys_utils_font.swc +0 -0
  30. data/lib/sprout/generators/project/templates/lib/com_ffsys_utils_locale.swc +0 -0
  31. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_core.swc +0 -0
  32. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_effects.swc +0 -0
  33. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_effects_tween.swc +0 -0
  34. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_errors.swc +0 -0
  35. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_events.swc +0 -0
  36. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_io.swc +0 -0
  37. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils.swc +0 -0
  38. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_address.swc +0 -0
  39. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_array.swc +0 -0
  40. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_assert.swc +0 -0
  41. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_bezier.swc +0 -0
  42. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_boolean.swc +0 -0
  43. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_byte.swc +0 -0
  44. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_collections.swc +0 -0
  45. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_display.swc +0 -0
  46. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_flex.swc +0 -0
  47. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_font.swc +0 -0
  48. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_history.swc +0 -0
  49. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_identifier.swc +0 -0
  50. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_inspector.swc +0 -0
  51. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_locale.swc +0 -0
  52. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_number.swc +0 -0
  53. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_object.swc +0 -0
  54. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_random.swc +0 -0
  55. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_reflection.swc +0 -0
  56. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_reflection_members.swc +0 -0
  57. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_reflection_meta.swc +0 -0
  58. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_reflection_parser.swc +0 -0
  59. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_regex.swc +0 -0
  60. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_string.swc +0 -0
  61. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_substitution.swc +0 -0
  62. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_time.swc +0 -0
  63. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_xml.swc +0 -0
  64. data/lib/sprout/generators/project/templates/rakeassets.rb +77 -0
  65. data/lib/sprout/generators/project/templates/rakefile.rb +112 -0
  66. data/lib/sprout/generators/project/templates/rakefonts.rb +170 -0
  67. data/lib/sprout/generators/suite/USAGE +0 -0
  68. data/lib/sprout/generators/suite/suite_generator.rb +17 -0
  69. data/lib/sprout/generators/suite/templates/TestSuite.as +18 -0
  70. data/lib/sprout/generators/test/USAGE +37 -0
  71. data/lib/sprout/generators/test/templates/TestCase.as +30 -0
  72. data/lib/sprout/generators/test/templates/TestSuite.as +18 -0
  73. data/lib/sprout/generators/test/test_generator.rb +20 -0
  74. data/lib/sprout/tasks/asdoc_doc.rb +155 -0
  75. data/lib/sprout/tasks/asdoc_rdoc.rb +155 -0
  76. data/lib/sprout/tasks/asdoc_task.rb +276 -0
  77. data/lib/sprout/tasks/asunit_task.rb +148 -0
  78. data/lib/sprout/tasks/compc_doc.rb +543 -0
  79. data/lib/sprout/tasks/compc_rdoc.rb +543 -0
  80. data/lib/sprout/tasks/compc_task.rb +130 -0
  81. data/lib/sprout/tasks/fcsh_task.rb +13 -0
  82. data/lib/sprout/tasks/fdb_task.rb +0 -0
  83. data/lib/sprout/tasks/mxmlc_doc.rb +484 -0
  84. data/lib/sprout/tasks/mxmlc_rdoc.rb +484 -0
  85. data/lib/sprout/tasks/mxmlc_task.rb +659 -0
  86. data/rakefile.rb +73 -0
  87. metadata +192 -0
@@ -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
@@ -0,0 +1,276 @@
1
+
2
+
3
+ module Sprout
4
+ #
5
+ # The AsDoc Task provides Rake support for the asdoc documentation engine.
6
+ # If a Sprout::MXMLCTask or Sprout::COMPCTask are found as prerequisites
7
+ # to the AsDoc task, AsDoc will inherit the source_path and library_path
8
+ # from those tasks. You can also configure AsDoc normally if you wish.
9
+ #
10
+ # This configuration might look something like this:
11
+ #
12
+ # # Create a remote library dependency on the corelib swc.
13
+ # library :corelib
14
+ #
15
+ # # Alias the compilation task with one that is easier to type
16
+ # # task :compile => 'SomeProject.swf'
17
+ #
18
+ # # Create an MXMLCTask named for the output file that it creates. This task depends on the
19
+ # # corelib library and will automatically add the corelib.swc to it's library_path
20
+ # mxmlc 'bin/SomeProject.swf' => :corelib do |t|
21
+ # t.input = 'src/SomeProject.as'
22
+ # t.default_size = '800 600'
23
+ # t.default_background_color = "#FFFFFF"
24
+ # t.source_path << 'src'
25
+ # t.source_path << 'lib/asunit'
26
+ # t.source_path << 'test'
27
+ # end
28
+ #
29
+ # desc "Generate documentation"
30
+ # asdoc :doc => 'bin/SomeProject.swf'
31
+ #
32
+ # This configuration will generate documentation in the relative path, 'doc', but only if
33
+ # The contents of the documentation directory are older than the sources referenced by the compiler.
34
+ #
35
+ # For more information about using the asdoc command line compiler, check livedocs at:
36
+ # http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Book_Parts&file=asdoc_127_1.html
37
+ #
38
+ class AsDocTask < ToolTask
39
+
40
+ def initialize_task
41
+ super
42
+ @default_gem_name = 'sprout-flex2sdk-tool'
43
+ @default_gem_path = 'bin/asdoc'
44
+
45
+ add_param(:actionscript_file_encoding, :string) do |p|
46
+ p.description = "Sets the file encoding for ActionScript files. For more information see: http://livedocs.adobe.com/flex/2/docs/00001503.html#149244"
47
+ end
48
+
49
+ add_param(:benchmark, :boolean) do |p|
50
+ p.value = true
51
+ p.show_on_false = true
52
+ p.description = "Prints detailed compile times to the standard output. The default value is true."
53
+ end
54
+
55
+ add_param(:doc_classes, :strings) do |p|
56
+ p.description =<<EOF
57
+ A list of classes to document. These classes must be in the source path. This is the default option.
58
+
59
+ 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).
60
+ EOF
61
+ end
62
+
63
+ add_param(:doc_namespaces, :strings) do |p|
64
+ p.description =<<EOF
65
+ A list of URIs whose classes should be documented. The classes must be in the source path.
66
+
67
+ You must include a URI and the location of the manifest file that defines the contents of this namespace.
68
+
69
+ 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)
70
+ EOF
71
+ end
72
+
73
+ add_param(:doc_sources, :paths) do |p|
74
+ p.description =<<EOF
75
+ A list of files that should be documented. If a directory name is in the list, it is recursively searched.
76
+
77
+ 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).
78
+ EOF
79
+ end
80
+
81
+ add_param(:exclude_classes, :string) do |p|
82
+ p.description =<<EOF
83
+ 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.
84
+ EOF
85
+ end
86
+
87
+ add_param(:exclude_dependencies, :boolean) do |p|
88
+ p.description =<<EOF
89
+ Whether all dependencies found by the compiler are documented. If true, the dependencies of the input classes are not documented.
90
+
91
+ The default value is false.
92
+ EOF
93
+ end
94
+
95
+ add_param(:footer, :string) do |p|
96
+ p.description =<<EOF
97
+ The text that appears at the bottom of the HTML pages in the output documentation.
98
+ EOF
99
+ end
100
+
101
+ add_param(:left_frameset_width, :number) do |p|
102
+ p.description =<<EOF
103
+ 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.
104
+
105
+ The default value is 210 pixels.
106
+ EOF
107
+ end
108
+
109
+ add_param(:library_path, :files) do |p|
110
+ p.description =<<EOF
111
+ Links SWC files to the resulting application SWF file. The compiler only links in those classes for the SWC file that are required.
112
+
113
+ The default value of the library-path option includes all SWC files in the libs directory and the current locale. These are required.
114
+
115
+ To point to individual classes or packages rather than entire SWC files, use the source-path option.
116
+
117
+ 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.
118
+
119
+ You can use the += operator to append the new argument to the list of existing SWC files.
120
+
121
+ 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.
122
+ EOF
123
+ end
124
+
125
+ add_param(:load_config, :file) do |p|
126
+ p.description =<<EOF
127
+ Specifies the location of the configuration file that defines compiler options.
128
+
129
+ If you specify a configuration file, you can override individual options by setting them on the command line.
130
+
131
+ All relative paths in the configuration file are relative to the location of the configuration file itself.
132
+
133
+ Use the += operator to chain this configuration file to other configuration files.
134
+
135
+ 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).
136
+ EOF
137
+ end
138
+
139
+ add_param(:main_title, :string) do |p|
140
+ p.description =<<EOF
141
+ The text that appears at the top of the HTML pages in the output documentation.
142
+
143
+ The default value is "API Documentation".
144
+ EOF
145
+ end
146
+
147
+ add_param(:namespace, :string) do |p|
148
+ p.description =<<EOF
149
+ Not sure about this option, it was in the CLI help, but not documented on the Adobe site
150
+ EOF
151
+ end
152
+
153
+ add_param(:output, :path) do |p|
154
+ p.value = 'doc'
155
+ p.description =<<EOF
156
+ The output directory for the generated documentation. The default value is "doc".
157
+ EOF
158
+ end
159
+
160
+ add_param(:package, :string) do |p|
161
+ p.description =<<EOF
162
+ The descriptions to use when describing a package in the documentation. You can specify more than one package option.
163
+
164
+ The following example adds two package descriptions to the output:
165
+ 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"
166
+ EOF
167
+ end
168
+
169
+ add_param(:source_path, :paths) do |p|
170
+ p.description =<<EOF
171
+ 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.
172
+
173
+ You can use wildcards to include all files and subdirectories of a directory.
174
+
175
+ To link an entire library SWC file and not individual classes or directories, use the library-path option.
176
+
177
+ The source path is also used as the search path for the component compiler's include-classes and include-resource-bundles options.
178
+
179
+ You can also use the += operator to append the new argument to the list of existing source path entries.
180
+ EOF
181
+ end
182
+
183
+ add_param(:strict, :boolean) do |p|
184
+ p.value = true
185
+ p.show_on_false = true
186
+ p.description =<<EOF
187
+ Prints undefined property and function calls; also performs compile-time type checking on assignments and options supplied to method calls.
188
+
189
+ The default value is true.
190
+
191
+ For more information about viewing warnings and errors, see Viewing warnings and errors (http://livedocs.adobe.com/flex/2/docs/00001517.html#182413).
192
+ EOF
193
+ end
194
+
195
+ add_param(:templates_path, :paths) do |p|
196
+ p.description =<<EOF
197
+ 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.
198
+ EOF
199
+ end
200
+
201
+ add_param(:warnings, :boolean) do |p|
202
+ p.description =<<EOF
203
+ Enables all warnings. Set to false to disable all warnings. This option overrides the warn-warning_type options.
204
+
205
+ The default value is true.
206
+ EOF
207
+ end
208
+
209
+ add_param(:window_title, :string) do |p|
210
+ p.description =<<EOF
211
+ The text that appears in the browser window in the output documentation.
212
+
213
+ The default value is "API Documentation".
214
+ EOF
215
+ end
216
+ end
217
+
218
+ def define # :nodoc:
219
+ super
220
+ validate_templates
221
+ CLEAN.add(output)
222
+ end
223
+
224
+ def prepare
225
+ super
226
+ prerequisite = nil
227
+ @prerequisites.each do |req|
228
+ prerequisite = @application[req]
229
+ if(prerequisite.is_a?(MXMLCTask))
230
+ prerequisite.source_path.each do |path|
231
+ doc_sources << path
232
+ end
233
+ prerequisite.library_path.each do |path|
234
+ library_path << path
235
+ end
236
+ end
237
+ end
238
+ end
239
+
240
+ protected
241
+
242
+ def validate_templates
243
+ if(templates_path.size == 0)
244
+ templates_dir = Sprout.get_executable(gem_name, 'asdoc/templates', gem_version)
245
+ templates_path << templates_dir
246
+ end
247
+ end
248
+
249
+ def execute(*args)
250
+ update_helper_mode
251
+ begin
252
+ super
253
+ rescue ExecutionError => e
254
+ if(e.message.index('Warning:'))
255
+ # MXMLC sends warnings to stderr....
256
+ Log.puts(e.message.gsub('[ERROR]', '[WARNING]'))
257
+ else
258
+ raise e
259
+ end
260
+ end
261
+ end
262
+
263
+ # The AsDoc packaage includes an asDocHelper binary that is packaged up without
264
+ # the executable flag, calling Sprout::get_executable with this target will
265
+ # automatically chmod it to 744.
266
+ def update_helper_mode
267
+ exe = Sprout.get_executable('sprout-flex2sdk-tool', 'asdoc/templates/asDocHelper', gem_version)
268
+ end
269
+
270
+ end
271
+ end
272
+
273
+ def asdoc(args, &block)
274
+ Sprout::AsDocTask.define_task(args, &block)
275
+ end
276
+
@@ -0,0 +1,148 @@
1
+ =begin
2
+ Copyright (c) 2007 Pattern Park
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining
5
+ a copy of this software and associated documentation files (the
6
+ "Software"), to deal in the Software without restriction, including
7
+ without limitation the rights to use, copy, modify, merge, publish,
8
+ distribute, sublicense, and/or sell copies of the Software, and to
9
+ permit persons to whom the Software is furnished to do so, subject to
10
+ the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ =end
23
+
24
+ module Rake # :nodoc:
25
+ class Tasks # :nodoc:
26
+
27
+ # Override Rake::Task.actions so that we can
28
+ # pull them from our dependent tasks
29
+ def actions
30
+ @actions
31
+ end
32
+ end
33
+
34
+ end
35
+
36
+ module Sprout
37
+ class AsUnitError < StandardError # :nodoc:
38
+ end
39
+
40
+ # This task does not yet work!
41
+ # The AsUnitTask provides a shortcut to compiling a test harness
42
+ # directly from a related MXMLCTask. The first prerequisite
43
+ # that is an MXMLCTask or MTASCTask will be copied and modified
44
+ # to generate a test swf using ProjectModel.instance.test_dir
45
+ # and the AsUnit library gem.
46
+ #
47
+ # mxmlc 'bin/SomeProject.swf' => :corelib do |t|
48
+ # t.input = 'src/SomeProject.as'
49
+ # end
50
+ #
51
+ # asunit :test => 'bin/SomeProject.swf'
52
+ #
53
+ class AsUnitTask < Rake::FileTask # :nodoc:
54
+ attr_accessor :input
55
+ attr_accessor :output
56
+ attr_accessor :asunit_gem
57
+ attr_accessor :source_path
58
+
59
+ =begin
60
+ def initialize(name, app) # :nodoc:
61
+ super
62
+ @asunit_gem = :asunit3
63
+ @spawned = []
64
+ @source_path = []
65
+ end
66
+
67
+ def self.define_task(args, &block)
68
+ t = super
69
+ yield t if block_given?
70
+ t.define
71
+ return t
72
+ end
73
+
74
+ def define
75
+ puts ">> DEFINE CALLED with: #{prerequisites.size}"
76
+ library @asunit_gem
77
+
78
+ reqs = prerequisites.dup
79
+ req = nil
80
+ reqs.each_index do |index|
81
+ req = reqs[index]
82
+ puts "req: #{req}"
83
+ t = get_task_instance(req)
84
+ if(is_mxmlc?(t))
85
+ spawn_mxmlc_task(t)
86
+ reqs.slice!(index)
87
+ end
88
+ end
89
+
90
+ @spawned.each do |req|
91
+ @prerequisites << req
92
+ end
93
+
94
+ @spawned = []
95
+ end
96
+
97
+ def get_spawned_task_name
98
+
99
+ end
100
+
101
+ def spawn_mxmlc_task(task)
102
+ puts "SPAWNING MXMLC TASK"
103
+ cloned = task.dup
104
+ task.actions.each do |action|
105
+ cloned.actions << action
106
+ end
107
+ # cloned.name = 'bin/SomeProjectRunner.swf'
108
+ cloned.input = 'src/SomeProjectRunner.as'
109
+ cloned.output = 'bin/SomeProjectRunner.swf'
110
+ cloned.prerequisites << asunit_gem
111
+ cloned.define
112
+
113
+ source_path.each do |path|
114
+ cloned.source_path << path
115
+ end
116
+
117
+ @spawned << cloned
118
+ end
119
+
120
+ # Alias for source_path so that MTASCTasks can also use this feature
121
+ def class_path=(path)
122
+ @source_path = path
123
+ end
124
+
125
+ def class_path
126
+ return self.source_path
127
+ end
128
+
129
+ def is_mxmlc?(task)
130
+ task.is_a?(MXMLCTask)
131
+ end
132
+
133
+ def get_task_instance(name)
134
+ Rake::application[name]
135
+ end
136
+
137
+ def execute(*args)
138
+ puts ">> asunit task"
139
+ # FileUtils.touch(name)
140
+ end
141
+ =end
142
+
143
+ end
144
+ end
145
+
146
+ def asunit(args, &block)
147
+ Sprout::AsUnitTask.define_task(args, &block)
148
+ end