flashsdk 1.0.13.pre → 1.0.14.pre

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.
Files changed (46) hide show
  1. data/Gemfile +1 -1
  2. data/Gemfile.lock +2 -4
  3. data/VERSION +1 -1
  4. data/lib/flashplayer/specification.rb +39 -35
  5. data/lib/flashplayer/system_mixins.rb +2 -5
  6. data/lib/flashplayer/task.legacy.rb +1 -1
  7. data/lib/flashsdk/adl.rb +5 -2
  8. data/lib/flashsdk/adt.rb +1 -2
  9. data/lib/flashsdk/amxmlc.rb +1 -2
  10. data/lib/flashsdk/compc.rb +0 -1
  11. data/lib/flashsdk/compiler_base.rb +111 -61
  12. data/lib/flashsdk/fcsh.rb +65 -0
  13. data/lib/flashsdk/fcsh_client.rb +36 -0
  14. data/lib/flashsdk/fdb.rb +767 -0
  15. data/lib/flashsdk/generators/class_generator.rb +37 -12
  16. data/lib/flashsdk/generators/flash_helper.rb +119 -23
  17. data/lib/flashsdk/module.rb +99 -1
  18. data/lib/flashsdk/mxmlc.rb +34 -8
  19. data/lib/flashsdk.rb +2 -0
  20. data/lib/flex3.rb +10 -9
  21. data/lib/flex4.rb +29 -0
  22. data/test/fixtures/sdk/fdb +62 -0
  23. data/test/fixtures/sdk/mxmlc +54 -0
  24. data/test/unit/adl_test.rb +1 -3
  25. data/test/unit/adt_test.rb +2 -3
  26. data/test/unit/amxmlc_test.rb +4 -2
  27. data/test/unit/class_generator_test.rb +1 -1
  28. data/test/unit/compc_test.rb +1 -2
  29. data/test/unit/fcsh_test.rb +35 -0
  30. data/test/unit/fdb_test.rb +49 -0
  31. data/test/unit/flash_helper_test.rb +21 -5
  32. data/test/unit/flashplayer_log_file_test.rb +2 -2
  33. data/test/unit/flashplayer_mm_config_test.rb +1 -1
  34. data/test/unit/flashplayer_module_test.rb +1 -1
  35. data/test/unit/flashplayer_task_test.rb +2 -2
  36. data/test/unit/flashplayer_trust_test.rb +1 -1
  37. data/test/unit/flex_generator_test.rb +1 -1
  38. data/test/unit/mxmlc_test.rb +27 -5
  39. data/test/unit/project_generator_test.rb +1 -1
  40. data/test/unit/test_helper.rb +3 -1
  41. data/test-stderr.log +1 -0
  42. data/test-stdout.log +58 -0
  43. metadata +15 -9
  44. data/lib/flashsdk/compc_legacy.rb +0 -149
  45. data/lib/flashsdk/mxmlc_legacy.rb +0 -135
  46. data/mate +0 -0
@@ -1,33 +1,57 @@
1
+
1
2
  module FlashSDK
3
+
4
+ ##
5
+ # This Generator will create a new ActionScript class
6
+ # based on the +ActionScript3Class.as+ template.
7
+ #
8
+ # This Generator should only be executed from within
9
+ # a project that has a Gemfile. If your Gemfile
10
+ # loads the "asunit4" gem, a test case and test suite
11
+ # will also be created whenever this generator is run.
12
+ #
13
+ # You can run this generator as follows:
14
+ #
15
+ # $ sprout-class utils.MathUtil
16
+ #
17
+ # You can prevent the creation of a test case and test
18
+ # suite by sending in the +--no-test+ parameter as follows:
19
+ #
20
+ # $ sprout-class utils.MathUtil --no-test
21
+ #
2
22
  class ClassGenerator < Sprout::Generator::Base
3
23
  include FlashHelper
4
-
24
+
5
25
  ##
6
- # The path where assets will be created.
26
+ # @return [String] The default package to use.
27
+ add_param :package, String, { :default => ""}
28
+
29
+ ##
30
+ # @return [String] The path where assets will be created.
7
31
  add_param :assets, String, { :default => 'assets' }
8
32
 
9
33
  ##
10
- # The path where skins will be created.
34
+ # @return [String] The path where skins will be created.
11
35
  add_param :skins, String, { :default => 'skins' }
12
36
 
13
37
  ##
14
- # The path where test cases should be created.
38
+ # @return [String] The path where test cases should be created.
15
39
  add_param :test, String, { :default => 'test' }
16
40
 
17
41
  ##
18
- # The path where libraries should be added.
42
+ # @return [String] The path where libraries should be added.
19
43
  add_param :lib, String, { :default => 'lib' }
20
44
 
21
45
  ##
22
- # The path where binaries should be created.
46
+ # @return [String] The path where binaries should be created.
23
47
  add_param :bin, String, { :default => 'bin' }
24
48
 
25
49
  ##
26
- # The path where source files should be created.
50
+ # @return [String] The path where source files should be created.
27
51
  add_param :src, String, { :default => 'src' }
28
52
 
29
53
  ##
30
- # Do not create a test case for this class.
54
+ # @return [String] Do not create a test case for this class.
31
55
  add_param :no_test, Boolean
32
56
 
33
57
  def manifest
@@ -45,12 +69,13 @@ module FlashSDK
45
69
  end
46
70
  end
47
71
 
48
- ##
49
- # This is a null Generator, if you add a test library
50
- # to your Gemfile, it should have it's own TestClassGenerator
51
- # that supercedes this one.
52
72
  module FlashSDK
73
+ ##
74
+ # This is a null Generator, if you add a test library
75
+ # to your Gemfile, it should have it's own TestClassGenerator
76
+ # that supercedes this one.
53
77
  class TestClassGenerator < Sprout::Generator::Base
78
+
54
79
  def manifest
55
80
  end
56
81
  end
@@ -1,8 +1,53 @@
1
1
 
2
2
  module FlashSDK
3
3
 
4
+ ##
5
+ # The FlashHelper is a module that can be included into any {Sprout::Generator}
6
+ # in order to provide support for many common features.
7
+ #
8
+ # @example An example of how to use this helper:
9
+ #
10
+ # require 'flashsdk'
11
+ #
12
+ # class BigFatGenerator < Sprout::Generator::Base
13
+ # include FlashSDK::FlashHelper
14
+ #
15
+ # ...
16
+ # end
17
+ #
4
18
  module FlashHelper
5
19
 
20
+ protected
21
+
22
+ ##
23
+ # @return [String] The directory of the package based on the +input+ string.
24
+ def package_directory
25
+ if package.include?('/')
26
+ remove_slashes package
27
+ end
28
+ split_package package
29
+ end
30
+
31
+ ##
32
+ # @param [String] A directory or path on disk with slashes like ('/')
33
+ # @return [String] The provided value with slashes replaced by dots.
34
+ def remove_slashes(value)
35
+ if value.include?('/')
36
+ value = value.split('/').join('.')
37
+ end
38
+ return value
39
+ end
40
+
41
+ ##
42
+ # @param value [String] A fully-qualified package or class name (com.example.project.SomeClass)
43
+ # @return [Array<String>] The provided package or class name split on the period.
44
+ # split on dots.
45
+ def split_package(value)
46
+ value.split('.')
47
+ end
48
+
49
+ ##
50
+ # @return [String] The directory for test cases that are related to the class provided by +input+
6
51
  def test_class_directory
7
52
  parts = input_in_parts
8
53
  if parts.size > 1
@@ -12,28 +57,35 @@ module FlashSDK
12
57
  return test
13
58
  end
14
59
 
15
- # Glob that is used to search for test cases and build
16
- # up the test suites
60
+ ##
61
+ # @return [String] Glob that is used to search for test cases and build
62
+ # up the test suites.
17
63
  def test_glob
18
64
  return @test_glob ||= File.join(path, test, '**', '?*Test.as')
19
65
  end
20
66
 
67
+ # @return [String] The provided or default glob.
21
68
  def test_glob= glob
22
69
  @test_glob = glob
23
70
  end
24
71
 
25
- # Collection of all test case files either assigned or found
72
+ ##
73
+ # @return [Array<File>] Collection of all test case files either assigned or found
26
74
  # using the test_glob as provided.
27
75
  def test_cases
28
76
  @test_cases ||= Dir.glob(test_glob)
29
77
  end
30
78
 
79
+ ##
80
+ # @param [Array<String>] Set the collection of test cases as Files on disk.
81
+ # @return [Array<String>] Collection of all test case files that were assigned or found.
31
82
  def test_cases= collection
32
83
  @test_cases = collection
33
84
  end
34
85
 
35
- # Get the list of test_cases (which are files) as a
36
- # list of fully qualified class names
86
+ ##
87
+ # @return [Array<String>] Get the list of test_cases (which are files) as a
88
+ # list of fully qualified class names.
37
89
  def test_case_classes
38
90
  classes = self.test_cases.dup
39
91
  classes.collect do |file|
@@ -41,18 +93,24 @@ module FlashSDK
41
93
  end
42
94
  end
43
95
 
96
+ ##
44
97
  # Transform a file name in the source or test path
45
- # to a fully-qualified class name
98
+ # into a fully-qualified class name.
99
+ #
100
+ # @param file [File] The path to a file on disk that is in the +src+ or +test+ folder.
101
+ # @return [String] The fully-qualified class name.
46
102
  def actionscript_file_to_class_name file
47
103
  name = file.dup
48
- name.gsub!(/^#{path}\//, '')
49
- name.gsub!(/^#{test}\//, '')
50
- name.gsub!(/^#{src}\//, '')
104
+ name.gsub!(/^#{path}\//, '') if respond_to? :path
105
+ name.gsub!(/^#{test}\//, '') if respond_to? :test
106
+ name.gsub!(/^#{src}\//, '') if respond_to? :src
51
107
  name.gsub!(/.as$/, '')
52
108
  name.gsub!(/#{File::SEPARATOR}/, '.')
53
109
  return name
54
110
  end
55
111
 
112
+ ##
113
+ # @return [String] The directory that contains the +input+ class.
56
114
  def class_directory
57
115
  parts = input_in_parts
58
116
  if parts.size > 1
@@ -62,6 +120,14 @@ module FlashSDK
62
120
  return src
63
121
  end
64
122
 
123
+ ##
124
+ # @return [String] The package that provided on the command line at +--package+
125
+ def default_package_name
126
+ remove_slashes package
127
+ end
128
+
129
+ ##
130
+ # @return [String] The package that was provided on the command line at +--input+
65
131
  def package_name
66
132
  parts = input_in_parts
67
133
  if parts.size > 1
@@ -71,6 +137,8 @@ module FlashSDK
71
137
  return ""
72
138
  end
73
139
 
140
+ ##
141
+ # @return [String] The fully-qualified class name provided on the command line at +--input+.
74
142
  def class_name
75
143
  parts = input_in_parts
76
144
  name = parts.pop.camel_case
@@ -80,6 +148,9 @@ module FlashSDK
80
148
  name
81
149
  end
82
150
 
151
+ ##
152
+ # @return [String] The fully-qualified test class name based on the +--input+
153
+ # argument provided on the command line.
83
154
  def test_class_name
84
155
  source = class_name
85
156
  if(!source.match(/Test$/))
@@ -88,10 +159,15 @@ module FlashSDK
88
159
  source
89
160
  end
90
161
 
162
+ ##
163
+ # @return [String] The project name provided as +--input+ on the command line.
164
+ # This is probably only helpful for project generators.
91
165
  def project_name
92
166
  input.camel_case
93
167
  end
94
168
 
169
+ ##
170
+ # @return [String] Currently returns hard-coded 'instance'.
95
171
  def instance_name
96
172
  # TODO: should uncapitalize class_name
97
173
  # (not the same as lowercase)
@@ -100,36 +176,56 @@ module FlashSDK
100
176
  'instance'
101
177
  end
102
178
 
103
- def input_in_parts
104
- provided_input = input.dup
105
- if provided_input.include?('/')
106
- provided_input.gsub! /^#{src}\//, ''
107
- provided_input = provided_input.split('/').join('.')
108
- end
179
+ ##
180
+ # @param value [String] If no value is provided, will use +--input+ instead.
181
+ # @return [Array<String>] An Array of the provided string split on slahes
182
+ # or dots with the file extension removed.
183
+ def input_in_parts(value=nil)
184
+ provided_input = value || input.dup
185
+ provided_input.gsub! /^#{src}\//, '' if respond_to? :src
186
+ provided_input = provided_input.split('/').join('.')
109
187
 
110
- provided_input.gsub!(/\.as$/, '')
111
- provided_input.gsub!(/\.mxml$/, '')
112
- provided_input.gsub!(/\.xml$/, '')
113
-
114
- provided_input.split('.')
188
+ remove_file_extensions(provided_input).split('.')
115
189
  end
116
190
 
191
+ ##
192
+ # @return [String] The fully qualified class name version of whatever was +input+.
117
193
  def fully_qualified_class_name
118
- input
119
- end
120
-
194
+ remove_slashes remove_file_extensions(input)
195
+ end
196
+
197
+ ##
198
+ # @param value [String] A string that may have a file extension.
199
+ # @return [String] A new String with common file extensions
200
+ # (.as, .mxml, .xml) removed from the provided value.
201
+ def remove_file_extensions value
202
+ value = value.dup
203
+ value.gsub!(/\.as$/, '')
204
+ value.gsub!(/\.mxml$/, '')
205
+ value.gsub!(/\.xml$/, '')
206
+ return value
207
+ end
208
+
209
+ ##
210
+ # @return [String] The +class_name+ with '.swf' appended.
121
211
  def deploy_swf_name
122
212
  "#{class_name}.swf"
123
213
  end
124
214
 
215
+ ##
216
+ # @return [String] The +class_name+ with '-debug.swf' appended.
125
217
  def debug_swf_name
126
218
  "#{class_name}-debug.swf"
127
219
  end
128
220
 
221
+ ##
222
+ # @return [String] The +class_name+ with '-test.swf' appendend.
129
223
  def test_swf_name
130
224
  "#{class_name}-test.swf"
131
225
  end
132
226
 
227
+ ##
228
+ # @return [String] The +class_name+ with 'Runner.swf' appended.
133
229
  def test_runner_name
134
230
  "#{class_name}Runner"
135
231
  end
@@ -1,4 +1,102 @@
1
-
1
+ ##
2
+ #
3
+ # The FlashSDK is a collection of project and file generators,
4
+ # automated build tasks, external libraries, executables,
5
+ # and runtimes that make it possible to create SWF and AIR content.
6
+ #
7
+ # If you're just getting started with the FlashSDK, you'll probably
8
+ # want to read more about the following topics.
9
+ #
10
+ # = Generators
11
+ #
12
+ # The FlashSDK comes with a handful of standard generators. These
13
+ # generators should be installed into your system $PATH when you
14
+ # install the FlashSDK gem. In general, Sprout generators fall
15
+ # into one of two categories: a) Application Generators, or b) File
16
+ # Generators.
17
+ #
18
+ # Application Generators can be run from any directory on your system
19
+ # and will usually create a new folder and place a large number of
20
+ # files into that folder. These generators usually don't have any
21
+ # prerequisites in terms of where they're run.
22
+ #
23
+ # File Generators usually expect to be run within an existing project
24
+ # directory, and often have dependencies related to the type of
25
+ # project they're run in. For example, most Class generators expect
26
+ # to find a Gemfile in the same directory where they're run.
27
+ #
28
+ # If you're interested in creating your own Generators, please see
29
+ # the {Sprout::Generator} documentation.
30
+ #
31
+ # == See Also:
32
+ #
33
+ # {FlashSDK::ClassGenerator},
34
+ # {FlashSDK::FlexProjectGenerator},
35
+ # {FlashSDK::ProjectGenerator}
36
+ #
37
+ # = Rake Tasks
38
+ #
39
+ # The FlashSDK includes a number of automated build tasks that work with
40
+ # the Rake build system.
41
+ #
42
+ # If you're not familiar with Rake, you should
43
+ # stop right now and read Martin Fowler's essay introducing it to the
44
+ # world: http://martinfowler.com/articles/rake.html
45
+ #
46
+ # == See Also:
47
+ #
48
+ # {FlashSDK::MXMLC},
49
+ # {FlashSDK::COMPC},
50
+ # {FlashSDK::FDB},
51
+ # {FlashSDK::ADL},
52
+ # {FlashSDK::ADT},
53
+ # {FlashPlayer::Task}
54
+ #
55
+ # = Libraries
56
+ #
57
+ # There is a growing collection of libraries that have been made available
58
+ # to Sprouts users. The first of these projects is the automated
59
+ # unit test framework, AsUnit[http://asunit.org].
60
+ #
61
+ # To include a new Sprout Library into your project, you'll need to take the
62
+ # following steps:
63
+ #
64
+ # * Add it to your Gemfile like:
65
+ #
66
+ # gem "asunit4", ">= 4.0.0.pre"
67
+ #
68
+ # * Add it to your Rakefile like:
69
+ #
70
+ # library :asunit4
71
+ #
72
+ # * Add it to your Rake Task like:
73
+ #
74
+ # mxmlc 'bin/SomeProjectRunner.swf' => :asunit4 do |t|
75
+ # ...
76
+ # end
77
+ #
78
+ # * From your project root, run:
79
+ #
80
+ # bundle install
81
+ #
82
+ # If you're interested in learning more about how to _create_ new libraries,
83
+ # check out the {Sprout::Library} documentation.
84
+ #
85
+ # = Executables / Runtimes
86
+ #
87
+ # The FlasSDK also includes a number of tools that help us compile and run
88
+ # ActionScript (or AIR) applications.
89
+ #
90
+ # These executables are usually accessed via Rake, and shouldn't require
91
+ # any manual intervention, but some of you are interested in
92
+ # where these applications live and how to change how they're accessed.
93
+ #
94
+ # Following are the {Sprout::Specification}s that are included with the FlashSDK:
95
+ #
96
+ # * {file:flashsdk/lib/flashplayer/specification.rb}
97
+ # * {file:flashsdk/lib/flex3.rb}
98
+ # * {file:flashsdk/lib/flex4.rb}
99
+ #
2
100
  module FlashSDK
3
101
  # Do this strip, otherwise we get a carriage return
4
102
  # after our version, and that poops on our archive folder
@@ -9,9 +9,7 @@ module FlashSDK
9
9
  # identical to what is available on the regular compiler except dashes have been replaced
10
10
  # by underscores.
11
11
  #
12
- # The following example can be pasted in a file named 'rakefile.rb' which should be placed in
13
- # the same folder as an ActionScript 3.0 class named 'SomeProject.as' that extends
14
- # flash.display.Sprite.
12
+ # The following example can be pasted in a file named 'rakefile.rb' which should be placed in the same folder as an ActionScript 3.0 class named 'SomeProject.as' that extends flash.display.Sprite.
15
13
  #
16
14
  # # Create a remote library dependency on the corelib swc.
17
15
  # library :corelib
@@ -29,16 +27,32 @@ module FlashSDK
29
27
  # t.source_path << 'lib/otherlib'
30
28
  # end
31
29
  #
32
- # Note: Be sure to check out the features of the Executable to learn more about gem_version and preprocessor
30
+ # Remember that Rake files are really just regular Ruby code, so if you want to have some configuration information shared by multiple build tasks, just define a method like:
33
31
  #
34
- # Interface and descriptions found here:
35
- # http://livedocs.adobe.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001481.html
32
+ # def configure_tasks t
33
+ # t.library_path << 'lib/SomeLibrary.swc'
34
+ # t.source_path << 'lib/otherlib'
35
+ # end
36
+ #
37
+ # desc "Compile the project"
38
+ # mxmlc 'bin/SomeProject.swf' do |t|
39
+ # configure_tasks t
40
+ # t.input = 'src/SomeProject.as'
41
+ # end
42
+ #
43
+ # desc "Compile the test harness"
44
+ # mxmlc 'bin/SomeProjectRunner.swf' => :asunit4 do |t|
45
+ # configure_tasks t
46
+ # t.input = 'src/SomeProjectRunner.as'
47
+ # end
48
+ #
49
+ # @see FlashSDK::CompilerBase
50
+ # @see Sprout::Executable
36
51
  #
37
52
  class MXMLC < CompilerBase
38
- include Sprout::Executable
39
53
 
40
54
  ##
41
- # Main source file to send compiler"
55
+ # Main source file to send compiler.
42
56
  # This must be the last item in this list
43
57
  add_param :input, File, { :required => true, :hidden_name => true }
44
58
 
@@ -65,6 +79,18 @@ module FlashSDK
65
79
  end
66
80
  end
67
81
 
82
+ ##
83
+ # Create a new Rake::File task that will execute {FlashSDK::MXMLC}.
84
+ #
85
+ # @return [Sprout::MXMLC]
86
+ #
87
+ # @example The following is a simple MXMLC task:
88
+ #
89
+ # desc "Compile the project"
90
+ # mxmlc 'bin/SomeProject.swf' do |t|
91
+ # t.input = 'src/SomeProject.as'
92
+ # end
93
+ #
68
94
  def mxmlc args, &block
69
95
  exe = FlashSDK::MXMLC.new
70
96
  exe.to_rake(args, &block)
data/lib/flashsdk.rb CHANGED
@@ -8,11 +8,13 @@ require 'flashsdk/generators/flash_helper'
8
8
  require 'flashsdk/generators/class_generator'
9
9
  require 'flashsdk/generators/project_generator'
10
10
  require 'flashsdk/generators/flex_project_generator'
11
+ require 'flashsdk/fcsh'
11
12
  require 'flashsdk/compiler_base'
12
13
  require 'flashsdk/mxmlc'
13
14
  require 'flashsdk/compc'
14
15
  require 'flashsdk/amxmlc'
15
16
  require 'flashsdk/adt'
16
17
  require 'flashsdk/adl'
18
+ require 'flashsdk/fdb'
17
19
  require 'flashplayer'
18
20
 
data/lib/flex3.rb CHANGED
@@ -1,19 +1,20 @@
1
1
 
2
2
  Sprout::Specification.new do |s|
3
+ # This is the Specification that loads the Flex 3 SDK,
4
+ # To use the Flex 3 SDK from your build tasks, you can
5
+ # simply update the pkg_name parameter of your build
6
+ # task as follows:
7
+ #
8
+ # mxmlc 'bin/SomeProject.swf' do |t|
9
+ # t.input = 'src/SomeProject.as'
10
+ # t.pkg_name = 'flex3'
11
+ # end
12
+ #
3
13
  s.name = 'flex3'
4
14
  s.version = FlashSDK::VERSION
5
15
 
6
- # Create an independent remote_file_target for each
7
- # platform that must be supported independently.
8
- #
9
- # If the archive includes support for all platforms (:windows, :osx, :unix)
10
- # then set platform = :universal
11
- #
12
16
  s.add_remote_file_target do |t|
13
- # Apply the windows-specific configuration:
14
17
  t.platform = :universal
15
- # Apply the shared platform configuration:
16
- # Remote Archive:
17
18
  t.archive_type = :zip
18
19
  t.url = "http://fpdownload.adobe.com/pub/flex/sdk/builds/flex3/flex_sdk_3.4.0.9271_mpl.zip"
19
20
  t.md5 = "ba0df5a5b7a9c901540bedaf8a4fec9e"
data/lib/flex4.rb CHANGED
@@ -1,5 +1,34 @@
1
1
 
2
2
  Sprout::Specification.new do |s|
3
+ # This is the Specification that loads the Flex 4 SDK,
4
+ # To use the Flex 4 SDK from your build tasks, you can
5
+ # simply update the pkg_name parameter of your build
6
+ # task as follows:
7
+ #
8
+ # mxmlc 'bin/SomeProject.swf' do |t|
9
+ # t.input = 'src/SomeProject.as'
10
+ # t.pkg_name = 'flex4'
11
+ # end
12
+ #
13
+ # If you'd like to consume any of the libraries that
14
+ # are included with the Flex SDK, you can embed them
15
+ # from your Rakefile as follows:
16
+ #
17
+ # library :f_textlayout
18
+ #
19
+ # mxmlc 'bin/SomeProject.swf' => :f_textlayout do |t|
20
+ # t.input = 'src/SomeProject.as'
21
+ # end
22
+ #
23
+ # If you'd like to consume one of the localized frameworks
24
+ # you can set that up as follows:
25
+ #
26
+ # library 'flex_4_es_ES'
27
+ #
28
+ # mxmlc 'bin/SomeProject.swf' => 'flex_4_es_ES' do |t|
29
+ # t.input = 'src/SomeProject.as'
30
+ # end
31
+ #
3
32
  s.name = 'flex4'
4
33
  s.version = '4.1.0.16076'
5
34
 
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ ##
4
+ # This is a Fake executable that will behave
5
+ # exactly like a real FDB executable for a
6
+ # specific, expected set of steps.
7
+ class FakeFDB
8
+
9
+ def initialize
10
+ str = "Adobe fdb (Flash Player Debugger) [build 16076]\n"
11
+ str << "Copyright (c) 2004-2007 Adobe, Inc. All rights reserved.\n"
12
+ str << "(fdb) "
13
+ printf str
14
+ gather_input
15
+ end
16
+
17
+ def gather_input
18
+ $stdout.flush
19
+ command = $stdin.gets.chomp!
20
+ if command == "run"
21
+ handle_run
22
+ elsif command == "continue"
23
+ handle_continue
24
+ elsif command == "kill"
25
+ handle_kill
26
+ elsif command == "quit"
27
+ handle_quit
28
+ else
29
+ puts ""
30
+ raise "Don't know how to respond to #{command}"
31
+ end
32
+ gather_input
33
+ end
34
+
35
+ def handle_run
36
+ str = "Waiting for Player to connect\n"
37
+ str << "Player connected; session starting.\n"
38
+ str << "Set breakpoints and then type 'continue' to resume the session.\n"
39
+ str = "[SWF] Users:lbayes:Projects:AsUnit-P2:asunit-4.0:bin:AsUnitRunner.swf - 226,833 bytes after decompression\n"
40
+ str << "(fdb) "
41
+ printf str
42
+ end
43
+
44
+ def handle_continue
45
+ str = "Breakpoint 1, AsUnitRunner() at AsUnitRunner.as:12\n"
46
+ str << "12 core = new TextCore();\n"
47
+ str << "(fdb) "
48
+ printf str
49
+ end
50
+
51
+ def handle_kill
52
+ printf "Kill the program being debugged? (y or n) "
53
+ end
54
+
55
+ def handle_quit
56
+ exit
57
+ end
58
+
59
+ end
60
+
61
+ fdb = FakeFDB.new
62
+
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ ##
4
+ # This is a Fake MXMLC executable that should
5
+ # support our test cases by performing exactly
6
+ # the same tasks that MXMLC performs, but much
7
+ # faster.
8
+ #
9
+ # This executable should be easily swapped with
10
+ # the real MXMLC binary for any test.
11
+ class FakeMXMLC
12
+
13
+ def initialize args
14
+ #puts ">> ARGS: #{args.inspect}"
15
+ if(args.size == 2 &&
16
+ args[0] == "-static-link-runtime-shared-libraries" &&
17
+ args[1] == "test/fixtures/mxmlc/simple/SomeFile.as")
18
+ compile_simple_swf args
19
+ elsif args == ["-output=test/fixtures/air/simple/bin/SomeProject.swf", "-static-link-runtime-shared-libraries", "test/fixtures/air/simple/SomeProject.as"]
20
+ compile_amxmlc_swf args
21
+ end
22
+ end
23
+
24
+ private
25
+
26
+ def compile_amxmlc_swf args
27
+ path = args[0].split('=').pop
28
+ compile_swf path
29
+ end
30
+
31
+ ##
32
+ # /Users/lbayes/Library/Sprouts/1.0/cache/flex4/4.1.0.16076/bin/mxmlc -static-link-runtime-shared-libraries test/fixtures/mxmlc/simple/SomeFile.as
33
+ # Loading configuration file /Users/lbayes/Library/Sprouts/1.0/cache/flex4/4.1.0.16076/frameworks/flex-config.xml
34
+ # /Users/lbayes/Projects/Sprouts/flashsdk/test/fixtures/mxmlc/simple/SomeFile.swf (558 bytes)
35
+ def compile_simple_swf args
36
+ path = File.expand_path(args[1].gsub(/\.as$/, '.swf'))
37
+ compile_swf path
38
+ end
39
+
40
+ def compile_swf path
41
+ File.open path, 'wb+' do |f|
42
+ f.write swf_bytes
43
+ end
44
+ puts "#{File.expand_path(path)} (#{swf_bytes.size})"
45
+ end
46
+
47
+ def swf_bytes
48
+ @swf_bytes ||= File.read 'test/fixtures/air/simple/SomeProject.swf'
49
+ end
50
+
51
+ end
52
+
53
+ mxmlc = FakeMXMLC.new ARGV
54
+