flashsdk_sqe 0.0.1

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 (94) hide show
  1. data/Gemfile +3 -0
  2. data/Gemfile.lock +41 -0
  3. data/POSTINSTALL.rdoc +81 -0
  4. data/README.textile +79 -0
  5. data/VERSION +1 -0
  6. data/bin/flashlog +8 -0
  7. data/bin/flashplayer +9 -0
  8. data/bin/sprout-as3 +9 -0
  9. data/bin/sprout-flex +8 -0
  10. data/ext/CloseFlashPlayerForDumbassOSX.scpt +6 -0
  11. data/ext/OpenFlashPlayerForDumbassOSX.scpt +12 -0
  12. data/flashsdk_sqe.gemspec +25 -0
  13. data/lib/flashplayer.rb +9 -0
  14. data/lib/flashplayer/errors.rb +12 -0
  15. data/lib/flashplayer/executable.rb +142 -0
  16. data/lib/flashplayer/log_file.rb +100 -0
  17. data/lib/flashplayer/mm_config.rb +96 -0
  18. data/lib/flashplayer/module.rb +51 -0
  19. data/lib/flashplayer/specification.rb +45 -0
  20. data/lib/flashplayer/system_mixins.rb +98 -0
  21. data/lib/flashplayer/task.legacy.rb +293 -0
  22. data/lib/flashplayer/task.rb +62 -0
  23. data/lib/flashplayer/trust.rb +45 -0
  24. data/lib/flashsdk.rb +24 -0
  25. data/lib/flashsdk/acompc.rb +29 -0
  26. data/lib/flashsdk/adl.rb +83 -0
  27. data/lib/flashsdk/adt.rb +276 -0
  28. data/lib/flashsdk/amxmlc.rb +28 -0
  29. data/lib/flashsdk/asdoc.rb +164 -0
  30. data/lib/flashsdk/compc.rb +124 -0
  31. data/lib/flashsdk/compiler_base.rb +1131 -0
  32. data/lib/flashsdk/fcsh.rb +173 -0
  33. data/lib/flashsdk/fcsh_socket.rb +167 -0
  34. data/lib/flashsdk/fdb.rb +833 -0
  35. data/lib/flashsdk/generators/class_generator.rb +87 -0
  36. data/lib/flashsdk/generators/flash_helper.rb +234 -0
  37. data/lib/flashsdk/generators/flex_project_generator.rb +30 -0
  38. data/lib/flashsdk/generators/project_generator.rb +31 -0
  39. data/lib/flashsdk/generators/templates/ActionScript3Class.as +9 -0
  40. data/lib/flashsdk/generators/templates/ActionScript3MainClass.as +11 -0
  41. data/lib/flashsdk/generators/templates/ActionScript3RunnerClass.as +19 -0
  42. data/lib/flashsdk/generators/templates/DefaultProjectImage.png +0 -0
  43. data/lib/flashsdk/generators/templates/Flex4Application.mxml +45 -0
  44. data/lib/flashsdk/generators/templates/Flex4Main.css +7 -0
  45. data/lib/flashsdk/generators/templates/Flex4Rakefile.rb +34 -0
  46. data/lib/flashsdk/generators/templates/Flex4RunnerClass.mxml +29 -0
  47. data/lib/flashsdk/generators/templates/FlexTestRunner.mxml +0 -0
  48. data/lib/flashsdk/generators/templates/Gemfile +5 -0
  49. data/lib/flashsdk/generators/templates/rakefile.rb +79 -0
  50. data/lib/flashsdk/module.rb +107 -0
  51. data/lib/flashsdk/mxmlc.rb +160 -0
  52. data/lib/flex3.rb +54 -0
  53. data/lib/flex4.rb +115 -0
  54. data/pkg/flashsdk_sqe-0.0.1.gem +0 -0
  55. data/rakefile.rb +42 -0
  56. data/test/fixtures/acompc/simple/SomeAirFile.as +11 -0
  57. data/test/fixtures/air/simple/SomeProject.apk +1 -0
  58. data/test/fixtures/air/simple/SomeProject.as +11 -0
  59. data/test/fixtures/air/simple/SomeProject.mxml +9 -0
  60. data/test/fixtures/air/simple/SomeProject.pfx +0 -0
  61. data/test/fixtures/air/simple/SomeProject.swf +0 -0
  62. data/test/fixtures/air/simple/SomeProject.xml +13 -0
  63. data/test/fixtures/asdoc/lib/OtherFile.as +17 -0
  64. data/test/fixtures/asdoc/src/SomeFile.as +11 -0
  65. data/test/fixtures/compc/simple/SomeFile.as +11 -0
  66. data/test/fixtures/flashplayer/AsUnit Runner.swf +0 -0
  67. data/test/fixtures/mxmlc/broken/SomeFile.as +10 -0
  68. data/test/fixtures/mxmlc/simple/SomeFile.as +11 -0
  69. data/test/fixtures/sdk/fdb +90 -0
  70. data/test/fixtures/sdk/mxmlc +56 -0
  71. data/test/unit/acompc_test.rb +37 -0
  72. data/test/unit/adl_test.rb +32 -0
  73. data/test/unit/adt_test.rb +185 -0
  74. data/test/unit/amxmlc_test.rb +55 -0
  75. data/test/unit/asdoc_test.rb +45 -0
  76. data/test/unit/class_generator_test.rb +56 -0
  77. data/test/unit/compc_test.rb +37 -0
  78. data/test/unit/fake_flashplayer_system.rb +11 -0
  79. data/test/unit/fcsh_socket_test.rb +53 -0
  80. data/test/unit/fcsh_test.rb +55 -0
  81. data/test/unit/fdb_test.rb +54 -0
  82. data/test/unit/flash_helper_test.rb +43 -0
  83. data/test/unit/flashplayer_executable_test.rb +69 -0
  84. data/test/unit/flashplayer_log_file_test.rb +47 -0
  85. data/test/unit/flashplayer_mm_config_test.rb +74 -0
  86. data/test/unit/flashplayer_module_test.rb +56 -0
  87. data/test/unit/flashplayer_task_test.rb +91 -0
  88. data/test/unit/flashplayer_trust_test.rb +30 -0
  89. data/test/unit/flex_compiler_options_test.rb +213 -0
  90. data/test/unit/flex_generator_test.rb +37 -0
  91. data/test/unit/mxmlc_test.rb +65 -0
  92. data/test/unit/project_generator_test.rb +57 -0
  93. data/test/unit/test_helper.rb +18 -0
  94. metadata +200 -0
@@ -0,0 +1,32 @@
1
+ require 'test_helper'
2
+
3
+ class ADLTest < Test::Unit::TestCase
4
+ include Sprout::TestHelper
5
+
6
+ context "An ADL tool" do
7
+
8
+ setup do
9
+ @fixture = File.join 'test', 'fixtures', 'air', 'simple'
10
+ @app_desc = File.join @fixture, 'SomeProject.xml'
11
+ @profile = 'mobileDevice'
12
+ @screensize = 'NexusOne'
13
+ end
14
+
15
+ teardown do
16
+ end
17
+
18
+ should "accept input" do
19
+ adl = FlashSDK::ADL.new
20
+ adl.app_desc = @app_desc
21
+ adl.root_dir = Dir.pwd
22
+ adl.screensize = @screensize
23
+ adl.profile = @profile
24
+ assert_equal "-profile #{@profile} -screensize #{@screensize} #{@app_desc} #{Dir.pwd}", adl.to_shell
25
+ # Uncomment to actually launch
26
+ # the AIR application:
27
+ #adl.execute
28
+ end
29
+
30
+ end
31
+ end
32
+
@@ -0,0 +1,185 @@
1
+ require 'test_helper'
2
+
3
+ class ADTTest < Test::Unit::TestCase
4
+ include Sprout::TestHelper
5
+
6
+ context "An ADT tool" do
7
+
8
+ setup do
9
+ @fixture = File.join 'test', 'fixtures', 'air', 'simple'
10
+ @application_xml = File.join @fixture, 'SomeProject.xml'
11
+ @expected_output = File.join @fixture, 'SomeProject.air'
12
+ @apk_input = File.join @fixture, 'SomeProject.apk'
13
+ @ipa_output = File.join @fixture, 'SomeProject.ipa'
14
+ @swf_input = File.join @fixture, 'SomeProject.swf'
15
+ @swf_main = File.join @fixture, 'SomeProject.mxml'
16
+ @certificate = File.join @fixture, 'SomeProject.pfx'
17
+ @ipa_cert = File.join @fixture, 'SomeProject.p12'
18
+ @provisioning_profile = File.join @fixture, 'Profile.mobileprovision'
19
+ @platform = 'android'
20
+ @target = 'apk-debug'
21
+ @appid = 'com.foo.bar.SomeProject'
22
+ @cert_password = 'samplePassword'
23
+ end
24
+
25
+ teardown do
26
+ clear_tasks
27
+ remove_file @expected_output
28
+ end
29
+
30
+ should "package a SWF with an application.xml" do
31
+ as_a_unix_system do
32
+ t = adt @expected_output do |t|
33
+ t.package = true
34
+ t.target = @target
35
+ t.package_input = @application_xml
36
+ t.package_output = @expected_output
37
+ t.storetype = 'PKCS12'
38
+ t.keystore = @certificate
39
+ t.storepass = @cert_password
40
+ t.included_files << @swf_input
41
+ end
42
+
43
+ assert_equal "-package -storetype PKCS12 -keystore #{@certificate} " +
44
+ "-storepass #{@cert_password} -target #{@target} " +
45
+ "test/fixtures/air/simple/SomeProject.air " +
46
+ "test/fixtures/air/simple/SomeProject.xml " +
47
+ "test/fixtures/air/simple/SomeProject.swf", t.to_shell
48
+
49
+ # Uncomment to actually run adt (much slower)
50
+ #t.execute
51
+ #assert_file @expected_output
52
+ end
53
+ end
54
+
55
+ should "package a SWF and complex assets with an application.xml" do
56
+ as_a_unix_system do
57
+ t = adt @expected_output do |t|
58
+ t.package = true
59
+ t.target = @target
60
+ t.package_input = @application_xml
61
+ t.package_output = @expected_output
62
+ t.storetype = 'PKCS12'
63
+ t.keystore = @certificate
64
+ t.storepass = @cert_password
65
+ t.included_files << @swf_input
66
+ t.file_options << 'bin path/to/asset.xml'
67
+ end
68
+
69
+ assert_equal "-package -storetype PKCS12 -keystore #{@certificate} " +
70
+ "-storepass #{@cert_password} -target #{@target} " +
71
+ "test/fixtures/air/simple/SomeProject.air " +
72
+ "test/fixtures/air/simple/SomeProject.xml " +
73
+ "test/fixtures/air/simple/SomeProject.swf " +
74
+ "-C bin path/to/asset.xml", t.to_shell
75
+
76
+ # Uncomment to actually run adt (much slower)
77
+ #t.execute
78
+ #assert_file @expected_output
79
+ end
80
+ end
81
+
82
+ should "package an iOS swf with a provisioning profile" do
83
+ as_a_unix_system do
84
+ t = adt @ipa_output do |t|
85
+ t.package = true
86
+ t.target = 'ipa-test'
87
+ t.package_input = @application_xml
88
+ t.package_output = @ipa_output
89
+ t.storetype = 'PKCS12'
90
+ t.keystore = @ipa_cert
91
+ t.storepass = @cert_password
92
+ t.provisioning_profile = @provisioning_profile
93
+ t.included_files << @swf_input
94
+ end
95
+
96
+ assert_equal "-package -storetype PKCS12 -keystore #{@ipa_cert} " +
97
+ "-storepass #{@cert_password} -provisioning-profile " +
98
+ "#{@provisioning_profile} -target ipa-test " +
99
+ "test/fixtures/air/simple/SomeProject.ipa " +
100
+ "test/fixtures/air/simple/SomeProject.xml " +
101
+ "test/fixtures/air/simple/SomeProject.swf", t.to_shell
102
+
103
+ # Uncomment to actually run adt (much slower)
104
+ #t.execute
105
+ #assert_file @expected_output
106
+ end
107
+ end
108
+
109
+ should "install an APK" do
110
+ as_a_unix_system do
111
+ t = adt @expected_output do |t|
112
+ t.installApp = true
113
+ t.platform = @platform
114
+ t.package = true
115
+ t.package_input = @apk_input
116
+ end
117
+
118
+ assert_equal "-installApp -platform #{@platform} -package #{@apk_input}", t.to_shell
119
+
120
+ # Uncomment to actually run adt (much slower)
121
+ #t.execute
122
+ #assert_file @expected_output
123
+ end
124
+ end
125
+
126
+ should "uninstall an APK" do
127
+ as_a_unix_system do
128
+ t = adt @expected_output do |t|
129
+ t.uninstallApp = true
130
+ t.platform = @platform
131
+ t.appid = @appid
132
+ end
133
+
134
+ assert_equal "-uninstallApp -platform #{@platform} -appid #{@appid}", t.to_shell
135
+
136
+ # Uncomment to actually run adt (much slower)
137
+ #t.execute
138
+ #assert_file @expected_output
139
+ end
140
+ end
141
+
142
+ should "launch an app" do
143
+ as_a_unix_system do
144
+ t = adt @expected_output do |t|
145
+ t.launchApp = true
146
+ t.platform = @platform
147
+ t.appid = @appid
148
+ end
149
+
150
+ assert_equal "-launchApp -platform #{@platform} -appid #{@appid}", t.to_shell
151
+
152
+ # Uncomment to actually run adt (much slower)
153
+ #t.execute
154
+ #assert_file @expected_output
155
+ end
156
+ end
157
+
158
+ should "create a self-signed certificate" do
159
+ as_a_unix_system do
160
+ t = adt(@certificate) do |t|
161
+ t.certificate = true
162
+ t.cn = 'SelfCertificate'
163
+ t.key_type = '2048-RSA'
164
+ t.pfx_file = @certificate
165
+ t.password = @cert_password
166
+ end
167
+
168
+ assert_equal '-certificate -cn SelfCertificate 2048-RSA test/fixtures/air/simple/SomeProject.pfx samplePassword', t.to_shell
169
+
170
+ # Uncomment to actually run adt (much slower)
171
+ #t.execute
172
+ #assert_file @certificate
173
+ end
174
+ end
175
+
176
+ # USE THIS METHOD TO CREATE THE INPUT SWF:
177
+ #should "create an input swf" do
178
+ #t = amxmlc @swf_input do |t|
179
+ #t.input = @swf_main
180
+ #end
181
+ #t.execute
182
+ #end
183
+ end
184
+ end
185
+
@@ -0,0 +1,55 @@
1
+ require 'test_helper'
2
+
3
+ class AMXMLCTest < Test::Unit::TestCase
4
+ include Sprout::TestHelper
5
+
6
+ context "An AMXMLC tool" do
7
+
8
+ setup do
9
+ @fixture = File.join 'test', 'fixtures', 'air', 'simple'
10
+ @input = File.join @fixture, 'SomeProject.as'
11
+ @expected_output = File.join @fixture, 'bin', 'SomeProject.swf'
12
+ end
13
+
14
+ teardown do
15
+ remove_file File.join(@fixture, 'bin')
16
+ end
17
+
18
+ should "accept input" do
19
+ as_a_unix_system do
20
+ amxmlc = FlashSDK::AMXMLC.new
21
+ amxmlc.input = @input
22
+ amxmlc.source_path << @fixture
23
+ assert_equal '-source-path+=test/fixtures/air/simple test/fixtures/air/simple/SomeProject.as', amxmlc.to_shell
24
+ end
25
+ end
26
+
27
+ should "compile a swf" do
28
+ FileUtils.mkdir_p File.dirname(@expected_output)
29
+
30
+ amxmlc = FlashSDK::AMXMLC.new
31
+ amxmlc.binary_path = File.join fixtures, 'sdk', 'mxmlc'
32
+ amxmlc.input = @input
33
+ amxmlc.output = @expected_output
34
+ amxmlc.execute
35
+ assert_file @expected_output
36
+ end
37
+
38
+
39
+ should "assign default-size" do
40
+ amxmlc = FlashSDK::AMXMLC.new
41
+ amxmlc.default_size = '800,500'
42
+ assert_equal '-default-size=800,500', amxmlc.to_shell
43
+ end
44
+
45
+ should "assign simple output" do
46
+ as_a_unix_system do
47
+ t = amxmlc 'bin/SomeProject.swf' do |t|
48
+ t.input = @input
49
+ end
50
+ assert_equal '-output=bin/SomeProject.swf test/fixtures/air/simple/SomeProject.as', t.to_shell
51
+ end
52
+ end
53
+ end
54
+ end
55
+
@@ -0,0 +1,45 @@
1
+ require 'test_helper'
2
+
3
+ class AsDocTest < Test::Unit::TestCase
4
+ include Sprout::TestHelper
5
+
6
+ context "An AsDoc tool" do
7
+
8
+ setup do
9
+ @original_use_fcsh_value = ENV['USE_FCSH']
10
+ @fixture = File.join fixtures, 'asdoc'
11
+ @source_path = File.join @fixture, 'src'
12
+ @lib_path = File.join @fixture, 'lib'
13
+ @doc_output = File.join @fixture, 'docs'
14
+
15
+ @swf_input = File.join @fixture, 'src', 'SomeFile.as'
16
+ @swf_output = File.join @fixture, 'bin', 'SomeFile.swf'
17
+ end
18
+
19
+ teardown do
20
+ remove_file @doc_output
21
+ end
22
+
23
+ should "generate simple documentation" do
24
+ t = FlashSDK::AsDoc.new
25
+ t.doc_sources << @source_path
26
+ t.doc_sources << @lib_path
27
+ t.output = @doc_output
28
+ t.execute
29
+
30
+ assert_file File.join(@doc_output, 'index.html')
31
+ end
32
+
33
+ =begin
34
+ should "work with a rake task too" do
35
+ exe = asdoc @doc_output do |t|
36
+ t.doc_sources << @source_path
37
+ t.doc_sources << @lib_path
38
+ end
39
+ exe.execute
40
+ end
41
+ =end
42
+
43
+ end
44
+ end
45
+
@@ -0,0 +1,56 @@
1
+ require 'test_helper'
2
+
3
+ class ClassGeneratorTest < Test::Unit::TestCase
4
+ include Sprout::TestHelper
5
+
6
+ context "a new class generator" do
7
+
8
+ setup do
9
+ @temp = File.join(fixtures, 'generators', 'tmp')
10
+ FileUtils.mkdir_p @temp
11
+ @generator = FlashSDK::ClassGenerator.new
12
+ @generator.path = @temp
13
+ @generator.logger = StringIO.new
14
+
15
+ Sprout::Generator.register FlashSDK::ClassGenerator
16
+ Sprout::Generator.register FlashSDK::TestClassGenerator
17
+ end
18
+
19
+ teardown do
20
+ remove_file @temp
21
+ end
22
+
23
+ should "work with a simple class" do
24
+ @generator.input = 'utils.MathUtil'
25
+ @generator.execute
26
+ assert_file File.join(@temp, 'src', 'utils', 'MathUtil.as')
27
+ end
28
+
29
+ should "work with no package" do
30
+ @generator.input = 'MathUtil'
31
+ @generator.execute
32
+ assert_file File.join(@temp, 'src', 'MathUtil.as')
33
+ end
34
+
35
+ should "work with directory instead of dots" do
36
+ @generator.input = 'src/utils/MathUtil.as'
37
+ @generator.execute
38
+ assert_file File.join(@temp, 'src', 'utils', 'MathUtil.as')
39
+ end
40
+
41
+ should "work with directory but no source" do
42
+ @generator.input = 'utils/MathUtil.as'
43
+ @generator.execute
44
+ assert_file File.join(@temp, 'src', 'utils', 'MathUtil.as')
45
+ end
46
+
47
+ should "not call TestGenerator when no_test" do
48
+ FlashSDK::TestClassGenerator.any_instance.expects(:manifest).never
49
+ @generator.input = 'utils.MathUtil'
50
+ @generator.test_class = false
51
+ @generator.execute
52
+ end
53
+ end
54
+
55
+ end
56
+
@@ -0,0 +1,37 @@
1
+ require 'test_helper'
2
+
3
+ class COMPCTest < Test::Unit::TestCase
4
+ include Sprout::TestHelper
5
+
6
+ context "An COMPC tool" do
7
+
8
+ setup do
9
+ @fixture = File.join 'test', 'fixtures', 'compc', 'simple'
10
+ @input = File.join @fixture, 'SomeFile.as'
11
+ @expected_output = File.join @fixture, 'SomeFile.swc'
12
+ end
13
+
14
+ teardown do
15
+ remove_file @expected_output
16
+ end
17
+
18
+ should "accept input" do
19
+ as_a_unix_system do
20
+ compc = FlashSDK::COMPC.new
21
+ compc.output = @expected_output
22
+ compc.include_sources << @fixture
23
+ assert_equal '--output=test/fixtures/compc/simple/SomeFile.swc --include-sources+=test/fixtures/compc/simple', compc.to_shell
24
+ end
25
+ end
26
+
27
+ should "compile a swc" do
28
+ compc = FlashSDK::COMPC.new
29
+ compc.include_sources << @fixture
30
+ compc.output = @expected_output
31
+ compc.execute
32
+ assert_file @expected_output
33
+ end
34
+
35
+ end
36
+ end
37
+
@@ -0,0 +1,11 @@
1
+
2
+ class FakeFlashPlayerSystem
3
+
4
+ def clean_path path
5
+ path
6
+ end
7
+
8
+ def open_flashplayer_with player, swf
9
+ end
10
+ end
11
+
@@ -0,0 +1,53 @@
1
+ require 'test_helper'
2
+
3
+ class FCSHSocketTest < Test::Unit::TestCase
4
+ include Sprout::TestHelper
5
+
6
+ context "a new fcsh server" do
7
+
8
+ setup do
9
+ # Uncomment to see output:
10
+ #Sprout.stdout = $stdout
11
+ #Sprout.stderr = $stderr
12
+
13
+ @input = File.join(fixtures, 'mxmlc', 'simple', 'SomeFile.as')
14
+ @test_port = 12543
15
+ end
16
+
17
+ teardown do
18
+ clear_tasks
19
+ end
20
+
21
+ should "be instantiable" do
22
+ service_ready = false
23
+ # Create the remote side of the connection:
24
+ t = Thread.new do
25
+ Thread.current.abort_on_exception = true
26
+ server = FlashSDK::FCSHSocket.new
27
+ server.port = @test_port
28
+ service_ready = true
29
+ server.listen
30
+ end
31
+
32
+ # Wait for the remote connection to exist
33
+ while !service_ready
34
+ sleep 0.1
35
+ end
36
+
37
+ sleep 2.0
38
+
39
+ mxmlc = FlashSDK::MXMLC.new
40
+ mxmlc.input = @input
41
+
42
+ client = FlashSDK::FCSHSocket.new
43
+ client.port = @test_port
44
+ client.execute "mxmlc #{mxmlc.to_shell}"
45
+ FileUtils.touch @input
46
+ client.execute "mxmlc #{mxmlc.to_shell}"
47
+ client.execute "quit"
48
+
49
+ t.join
50
+ end
51
+ end
52
+ end
53
+