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,62 @@
1
+
2
+ module FlashPlayer
3
+
4
+ class Task < Rake::Task
5
+
6
+ attr_accessor :input
7
+ attr_accessor :pkg_name
8
+ attr_accessor :pkg_version
9
+
10
+ ##
11
+ # This is the Rake::Task constructor
12
+ # signature...
13
+ def initialize task_name, rake_application
14
+ super
15
+ @input = task_name
16
+ @player = FlashPlayer::Executable.new
17
+ @pkg_name = FlashPlayer::NAME
18
+ @pkg_version = FlashPlayer::VERSION
19
+ end
20
+
21
+ def execute *args
22
+ super
23
+ update_input_if_necessary
24
+ @player.input = input
25
+ @player.fdb = use_fdb?
26
+ @player.execute
27
+ end
28
+
29
+ def logger=(logger)
30
+ @player.logger = logger
31
+ end
32
+
33
+ def logger
34
+ @player.logger
35
+ end
36
+
37
+ private
38
+
39
+ def use_fdb?
40
+ # Check as string b/c this is
41
+ # how the boolean value comes
42
+ # accross the command line input.
43
+ ENV['USE_FDB'].to_s == 'true'
44
+ end
45
+
46
+ def update_input_if_necessary
47
+ return if input.match(/\.swf$/)
48
+ prerequisites.each do |prereq|
49
+ if(prereq.match(/\.swf$/))
50
+ self.input = prereq
51
+ return
52
+ end
53
+ end
54
+ end
55
+
56
+ end
57
+ end
58
+
59
+ def flashplayer *args, &block
60
+ FlashPlayer::Task.define_task *args, &block
61
+ end
62
+
@@ -0,0 +1,45 @@
1
+
2
+ module FlashPlayer
3
+
4
+ class Trust
5
+
6
+ attr_accessor :logger
7
+
8
+ def initialize
9
+ @logger = $stdout
10
+ end
11
+
12
+ def add path
13
+ file = trust_file
14
+ create(file) unless File.exists?(file)
15
+ update_if_necessary file, path
16
+ end
17
+
18
+ private
19
+
20
+ def create file
21
+ dir = File.dirname file
22
+ FileUtils.makedirs(dir) unless File.exists?(dir)
23
+ FileUtils.touch file
24
+ end
25
+
26
+ def update_if_necessary file, path
27
+ path = File.expand_path path
28
+ if(!has_path?(file, path))
29
+ File.open(file, 'a') do |f|
30
+ f.puts path
31
+ end
32
+ logger.puts ">> Added #{path} to Flash Player Trust file at: #{file}"
33
+ end
34
+ end
35
+
36
+ def has_path? file, path
37
+ !File.read(file).index(path).nil?
38
+ end
39
+
40
+ def trust_file
41
+ FlashPlayer.trust
42
+ end
43
+ end
44
+ end
45
+
data/lib/flashsdk.rb ADDED
@@ -0,0 +1,24 @@
1
+ require 'sprout'
2
+
3
+ lib = File.expand_path File.dirname(__FILE__)
4
+ $:.unshift lib unless $:.include?(lib)
5
+
6
+ require 'benchmark'
7
+ require 'flashsdk/module'
8
+ require 'flashsdk/generators/flash_helper'
9
+ require 'flashsdk/generators/class_generator'
10
+ require 'flashsdk/generators/project_generator'
11
+ require 'flashsdk/generators/flex_project_generator'
12
+ require 'flashsdk/fcsh'
13
+ require 'flashsdk/fcsh_socket'
14
+ require 'flashsdk/compiler_base'
15
+ require 'flashsdk/asdoc'
16
+ require 'flashsdk/mxmlc'
17
+ require 'flashsdk/compc'
18
+ require 'flashsdk/acompc'
19
+ require 'flashsdk/amxmlc'
20
+ require 'flashsdk/adt'
21
+ require 'flashsdk/adl'
22
+ require 'flashsdk/fdb'
23
+ require 'flashplayer'
24
+
@@ -0,0 +1,29 @@
1
+ module FlashSDK
2
+
3
+ ##
4
+ # The ACOMPC tool is a wrapper for the acompc tool.
5
+ #
6
+ class ACOMPC < COMPC
7
+
8
+ ##
9
+ # The default executable target.
10
+ #
11
+ set :executable, :acompc
12
+
13
+ ##
14
+ # TODO: Remove this method once this bug is fixed:
15
+ # http://www.pivotaltracker.com/story/show/4194771
16
+ #
17
+ def execute *args
18
+ self.executable = :acompc
19
+ super
20
+ end
21
+ end
22
+ end
23
+
24
+ def acompc args, &block
25
+ exe = FlashSDK::ACOMPC.new
26
+ exe.to_rake(args, &block)
27
+ exe
28
+ end
29
+
@@ -0,0 +1,83 @@
1
+ module FlashSDK
2
+
3
+ class ADL < Sprout::Executable::Base
4
+
5
+ add_param :runtime, Path
6
+
7
+ add_param :pubid, String
8
+
9
+ add_param :nodebug, Boolean
10
+
11
+ add_param :profile, String, { :delimiter => ' ' }
12
+
13
+ add_param :screensize, String, { :delimiter => ' ' }
14
+
15
+ add_param :app_desc, String, { :hidden_name => true, :delimiter => ' ' }
16
+
17
+ add_param :root_dir, String, { :hidden_name => true, :delimiter => ' ' }
18
+
19
+ #add_param :shitty_dashes, String, { :hidden_name => true, :delimiter => ' ', :default => '--' }
20
+
21
+ add_param :input, File, { :hidden_name => true }
22
+
23
+ ##
24
+ # The the Ruby file that will load the expected
25
+ # Sprout::Specification.
26
+ #
27
+ # Default value is 'flex4'
28
+ #
29
+ set :pkg_name, 'flex4'
30
+
31
+ ##
32
+ # The default pkg version
33
+ #
34
+ set :pkg_version, ">= #{FlashSDK::VERSION}"
35
+
36
+ ##
37
+ # The default executable target.
38
+ #
39
+ set :executable, :adl
40
+
41
+ ##
42
+ # The default prefix
43
+ #
44
+ set :default_prefix, '-'
45
+
46
+ ##
47
+ # Overide the default task creation so
48
+ # adl will run regardless of a file product.
49
+ #
50
+ def create_outer_task *args
51
+ Rake::Task.define_task(*args) do
52
+ execute
53
+ end
54
+ end
55
+
56
+ ##
57
+ # Overide the default behaviour to stop the file product
58
+ # being added to to the CLEAN task.
59
+ #
60
+ def update_rake_task_name_from_args *args
61
+ self.rake_task_name = parse_rake_task_arg args.last
62
+ self.rake_task_name
63
+ end
64
+ end
65
+ end
66
+
67
+ def adl *args, &block
68
+ exe = FlashSDK::ADL.new
69
+ exe.to_rake(*args, &block)
70
+ exe
71
+ end
72
+
73
+ ##
74
+ # TODO: This should NOT be here!
75
+ # This is preventing that method from working
76
+ # as expected only after this FILE is required.
77
+ class Sprout::System::UnixSystem
78
+
79
+ def should_repair_executable path
80
+ return false
81
+ #return (File.exists?(path) && !File.directory?(path) && File.read(path).match(/^\#\!\/bin\/sh/))
82
+ end
83
+ end
@@ -0,0 +1,276 @@
1
+ module FlashSDK
2
+
3
+ ##
4
+ # Creates AIR certificates and compiles AIR packages for distribution.
5
+ #
6
+ # Following is an example of how this tool might be used to create
7
+ # a certificate and AIR package:
8
+ #
9
+ # mxmlc 'bin/SomeProject.swf' do |t|
10
+ # t.input = 'src/SomeProject.as'
11
+ # end
12
+ #
13
+ # adt 'cert/SomeProject.pfx' do |t|
14
+ # t.certificate = true
15
+ # t.cn = 'SelfCertificate'
16
+ # t.key_type = '2048-RSA'
17
+ # t.pfx_file = 'cert/SomeProject.pfx'
18
+ # # Don't check the .password file into version control:
19
+ # t.password = File.read('cert/.password')
20
+ # end
21
+ #
22
+ # adt 'bin/SomeProject.air' => ['bin/SomeProject.swf', 'cert/SomeProject.pfx'] do |t|
23
+ # t.package = true
24
+ # t.package_input = 'SomeProject.xml'
25
+ # t.package_output = 'bin/SomeProject.air'
26
+ # t.storetype = 'PKCS12'
27
+ # t.keystore = 'cert/SomeProject.pfx'
28
+ # # Don't check the .password file into version control:
29
+ # t.storepass = File.read('cert/.password')
30
+ # t.included_files << 'bin/SomeProject.swf'
31
+ # end
32
+ #
33
+ # desc "Compile, certify and package the AIR application"
34
+ # task package => 'bin/SomeProject.air'
35
+ #
36
+ class ADT < Sprout::Executable::Base
37
+ #NOTE:
38
+ # The order of these parameters is important!
39
+ # Please do not alphabetize or rearrange unless you're
40
+ # fixing a bug related to how ADT actually expects
41
+ # the arguments...
42
+
43
+ ##
44
+ # Install an app on a device
45
+ #
46
+ add_param :installApp, Boolean, { :hidden_value => true }
47
+
48
+ ##
49
+ # Uninstall an app from a device
50
+ #
51
+ add_param :uninstallApp, Boolean, { :hidden_value => true }
52
+
53
+ ##
54
+ # Launch an app on a device
55
+ #
56
+ add_param :launchApp, Boolean, { :hidden_value => true }
57
+
58
+ ##
59
+ # The platform to use (ex: android)
60
+ #
61
+ add_param :platform, String, { :delimiter => ' ' }
62
+
63
+ ##
64
+ # The appid of the app being installed/uninstalled (ex: com.foo.Bar)
65
+ #
66
+ add_param :appid, String, { :delimiter => ' ' }
67
+
68
+ ##
69
+ # Create an AIR package.
70
+ #
71
+ add_param :package, Boolean, { :hidden_value => true }
72
+
73
+ ##
74
+ # Set true to create a certificate.
75
+ #
76
+ # If this value is true, you can optionally set org_unit, org_name and country.
77
+ #
78
+ # If this value is true, you MUST set +cn+, +key_type+, and +pfx_file+.
79
+ #
80
+ # adt 'cert/SampleCert.pfx' do |t|
81
+ # t.certificate = true
82
+ # t.cn = 'SelfCertificate'
83
+ # t.key_type = '1024-RSA'
84
+ # t.pfx_file = 'cert/SampleCert.pfx'
85
+ # t.password = 'samplepassword'
86
+ # end
87
+ #
88
+ add_param :certificate, Boolean, { :hidden_value => true }
89
+
90
+ ##
91
+ # A Signing Option
92
+ #
93
+ add_param :storetype, String, { :delimiter => ' ' }
94
+
95
+
96
+ ##
97
+ # A Signing Option
98
+ #
99
+ add_param :keystore, String, { :delimiter => ' ' }
100
+
101
+ ##
102
+ # Provide the password directly to the ADT task
103
+ # so that it doesn't attempt to prompt.
104
+ #
105
+ add_param :storepass, String, { :delimiter => ' ' }
106
+
107
+
108
+ ##
109
+ # A Signing Option
110
+ #
111
+ add_param :keypass, String, { :delimiter => ' ' }
112
+
113
+
114
+ ##
115
+ # A Signing Option
116
+ #
117
+ add_param :providername, String, { :delimiter => ' ' }
118
+
119
+
120
+ ##
121
+ # A Signing Option
122
+ #
123
+ add_param :tsa, String
124
+
125
+ ##
126
+ # Check Store Signing options
127
+ #
128
+ add_param :checkstore, String
129
+
130
+ ##
131
+ # Provisioning profile for iOS apps
132
+ #
133
+ add_param :provisioning_profile, String, { :delimiter => ' ' }
134
+
135
+ ##
136
+ # Expects two files:
137
+ #
138
+ # 1) The Airi file (?)
139
+ # 2) The application description
140
+ #add_param :prepare, Files
141
+
142
+ ##
143
+ # Expects two files:
144
+ #
145
+ # 1) The Airi file (?)
146
+ # 2) The Air file
147
+ add_param :sign, Files, { :delimiter => ' ' }
148
+
149
+
150
+ ##
151
+ # The AIR runtime version to use.
152
+ add_param :version, String, { :delimiter => ' ' }
153
+
154
+
155
+ ##
156
+ # Use a specific target, like apk-debug for Android or ipa-debug for iOS
157
+ #
158
+ add_param :target, String, { :delimiter => ' ' }
159
+
160
+ ##
161
+ # The AIR file that should be created
162
+ # after packaging is complete.
163
+ #
164
+ add_param :package_output, String, { :hidden_name => true }
165
+
166
+ ##
167
+ # The XML application descriptor that
168
+ # should be used to create an AIR
169
+ # application.
170
+ #
171
+ add_param :package_input, File, { :hidden_name => true }
172
+
173
+ ##
174
+ # Organization unit, follows certificate.
175
+ #
176
+ add_param :org_unit, String
177
+
178
+ ##
179
+ # Organization name, follows certificate.
180
+ #
181
+ add_param :org_name, String
182
+
183
+ ##
184
+ # Country, follows certificate.
185
+ #
186
+ add_param :country, String
187
+
188
+ ##
189
+ # The Certificate name.
190
+ #
191
+ add_param :cn, String, { :delimiter => ' ' }
192
+
193
+ ##
194
+ # Key Type, follows certificate.
195
+ #
196
+ add_param :key_type, String, { :hidden_name => true }
197
+
198
+ ##
199
+ # PFX File
200
+ #
201
+ add_param :pfx_file, String, { :hidden_name => true }
202
+
203
+ ##
204
+ # When creating a certificate, this is the file
205
+ # where the password can be found.
206
+ #
207
+ add_param :password, String, { :hidden_name => true, :delimiter => ' ' }
208
+
209
+ ##
210
+ # Expects Signing Options, plus
211
+ # two files:
212
+ #
213
+ # 1) The Air file in
214
+ # 2) The Air file out
215
+ #
216
+ add_param :migrate, Files
217
+
218
+ ##
219
+ # A list of files to include in the
220
+ #
221
+ add_param :included_files, Files, { :hidden_name => true }
222
+
223
+ ##
224
+ # A list of paths (directories) to search
225
+ # for contents that will be included in the
226
+ # packaged AIR application.
227
+ #
228
+ # If files are hidden from the file system,
229
+ # they will not be included.
230
+ #
231
+ add_param :included_paths, Paths, { :hidden_name => true }
232
+
233
+ ##
234
+ # Allows file options in the form of -C <dir> <fileOrDir>+
235
+ #
236
+ # For example if you defined:
237
+ #
238
+ # t.file_options << 'dir path/to/asset.xml'
239
+ #
240
+ # In your adt task defintion, then:
241
+ #
242
+ # -C dir path/to/asset.xml
243
+ #
244
+ # Would be appended to your arguments.
245
+ #
246
+ add_param :file_options, Strings, { :shell_name => '-C', :delimiter => ' ' }
247
+
248
+ ##
249
+ # The the Ruby file that will load the expected
250
+ # Sprout::Specification.
251
+ #
252
+ # Default value is 'flex4'
253
+ #
254
+ set :pkg_name, 'flex4'
255
+
256
+ ##
257
+ # The default pkg version
258
+ #
259
+ set :pkg_version, ">= #{FlashSDK::VERSION}"
260
+
261
+ ##
262
+ # The default executable target.
263
+ #
264
+ set :executable, :adt
265
+
266
+ ##
267
+ # Ensure the default prefix is '-'
268
+ set :default_prefix, '-'
269
+ end
270
+ end
271
+
272
+ def adt *args, &block
273
+ exe = FlashSDK::ADT.new
274
+ exe.to_rake(*args, &block)
275
+ exe
276
+ end