h4oflashsdk 1.0.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/Gemfile +3 -0
- data/Gemfile.lock +41 -0
- data/POSTINSTALL.rdoc +79 -0
- data/README.textile +79 -0
- data/VERSION +1 -0
- data/bin/flashlog +8 -0
- data/bin/flashplayer +9 -0
- data/bin/sprout-as3 +9 -0
- data/bin/sprout-flex +8 -0
- data/ext/CloseFlashPlayerForDumbassOSX.scpt +6 -0
- data/ext/OpenFlashPlayerForDumbassOSX.scpt +12 -0
- data/flashsdk.gemspec +25 -0
- data/flashsdk.komodoproject +4 -0
- data/lib/flashplayer/errors.rb +12 -0
- data/lib/flashplayer/executable.rb +143 -0
- data/lib/flashplayer/log_file.rb +94 -0
- data/lib/flashplayer/mm_config.rb +96 -0
- data/lib/flashplayer/module.rb +51 -0
- data/lib/flashplayer/specification.rb +45 -0
- data/lib/flashplayer/system_mixins.rb +98 -0
- data/lib/flashplayer/task.legacy.rb +293 -0
- data/lib/flashplayer/task.rb +62 -0
- data/lib/flashplayer/trust.rb +45 -0
- data/lib/flashplayer.rb +9 -0
- data/lib/flashsdk/acompc.rb +29 -0
- data/lib/flashsdk/adl.rb +83 -0
- data/lib/flashsdk/adt.rb +276 -0
- data/lib/flashsdk/amxmlc.rb +28 -0
- data/lib/flashsdk/asdoc.rb +164 -0
- data/lib/flashsdk/compc.rb +124 -0
- data/lib/flashsdk/compiler_base.rb +1131 -0
- data/lib/flashsdk/fcsh.rb +173 -0
- data/lib/flashsdk/fcsh_socket.rb +167 -0
- data/lib/flashsdk/fdb.rb +833 -0
- data/lib/flashsdk/generators/class_generator.rb +87 -0
- data/lib/flashsdk/generators/flash_helper.rb +234 -0
- data/lib/flashsdk/generators/flex_project_generator.rb +30 -0
- data/lib/flashsdk/generators/project_generator.rb +31 -0
- data/lib/flashsdk/generators/templates/ActionScript3Class.as +9 -0
- data/lib/flashsdk/generators/templates/ActionScript3MainClass.as +11 -0
- data/lib/flashsdk/generators/templates/ActionScript3RunnerClass.as +19 -0
- data/lib/flashsdk/generators/templates/DefaultProjectImage.png +0 -0
- data/lib/flashsdk/generators/templates/Flex4Application.mxml +45 -0
- data/lib/flashsdk/generators/templates/Flex4Main.css +7 -0
- data/lib/flashsdk/generators/templates/Flex4Rakefile.rb +34 -0
- data/lib/flashsdk/generators/templates/Flex4RunnerClass.mxml +29 -0
- data/lib/flashsdk/generators/templates/FlexTestRunner.mxml +0 -0
- data/lib/flashsdk/generators/templates/Gemfile +5 -0
- data/lib/flashsdk/generators/templates/rakefile.rb +79 -0
- data/lib/flashsdk/module.rb +107 -0
- data/lib/flashsdk/mxmlc.rb +160 -0
- data/lib/flashsdk.rb +24 -0
- data/lib/flex3.rb +54 -0
- data/lib/flex4.rb +115 -0
- data/rakefile.rb +42 -0
- data/test/fixtures/acompc/simple/SomeAirFile.as +11 -0
- data/test/fixtures/air/simple/SomeProject.apk +1 -0
- data/test/fixtures/air/simple/SomeProject.as +11 -0
- data/test/fixtures/air/simple/SomeProject.mxml +9 -0
- data/test/fixtures/air/simple/SomeProject.pfx +0 -0
- data/test/fixtures/air/simple/SomeProject.swf +0 -0
- data/test/fixtures/air/simple/SomeProject.xml +13 -0
- data/test/fixtures/asdoc/lib/OtherFile.as +17 -0
- data/test/fixtures/asdoc/src/SomeFile.as +11 -0
- data/test/fixtures/compc/simple/SomeFile.as +11 -0
- data/test/fixtures/flashplayer/AsUnit Runner.swf +0 -0
- data/test/fixtures/mxmlc/broken/SomeFile.as +10 -0
- data/test/fixtures/mxmlc/simple/SomeFile.as +11 -0
- data/test/fixtures/sdk/fdb +90 -0
- data/test/fixtures/sdk/mxmlc +56 -0
- data/test/unit/acompc_test.rb +37 -0
- data/test/unit/adl_test.rb +32 -0
- data/test/unit/adt_test.rb +185 -0
- data/test/unit/amxmlc_test.rb +55 -0
- data/test/unit/asdoc_test.rb +45 -0
- data/test/unit/class_generator_test.rb +56 -0
- data/test/unit/compc_test.rb +37 -0
- data/test/unit/fake_flashplayer_system.rb +11 -0
- data/test/unit/fcsh_socket_test.rb +53 -0
- data/test/unit/fcsh_test.rb +55 -0
- data/test/unit/fdb_test.rb +54 -0
- data/test/unit/flash_helper_test.rb +43 -0
- data/test/unit/flashplayer_executable_test.rb +69 -0
- data/test/unit/flashplayer_log_file_test.rb +47 -0
- data/test/unit/flashplayer_mm_config_test.rb +74 -0
- data/test/unit/flashplayer_module_test.rb +56 -0
- data/test/unit/flashplayer_task_test.rb +91 -0
- data/test/unit/flashplayer_trust_test.rb +30 -0
- data/test/unit/flex_compiler_options_test.rb +213 -0
- data/test/unit/flex_generator_test.rb +37 -0
- data/test/unit/mxmlc_test.rb +65 -0
- data/test/unit/project_generator_test.rb +57 -0
- data/test/unit/test_helper.rb +18 -0
- metadata +284 -0
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'flashsdk'
|
2
|
+
|
3
|
+
##
|
4
|
+
# This is the Flash Player Sprout::Specification and is how
|
5
|
+
# we figure out from where to load the Flash Player for the
|
6
|
+
# current user system.
|
7
|
+
Sprout::Specification.new do |s|
|
8
|
+
s.name = FlashPlayer::NAME
|
9
|
+
s.version = FlashPlayer::VERSION
|
10
|
+
|
11
|
+
##
|
12
|
+
# NOTE: The order of these declarations is important, the RubyFeature.load method
|
13
|
+
# will search for the first match that is appropriate for the end user system.
|
14
|
+
#
|
15
|
+
# Current releases of the Ruby One-Click Installer for Windows actually
|
16
|
+
# run on top of Mingw, and OSX is a *nix variant, which means that
|
17
|
+
# all System types (in Ruby at least) derive from UnixSystem.
|
18
|
+
#
|
19
|
+
# This means that the Linux/Unix declaration will
|
20
|
+
# match everyone, so it is effectively the same as ':universal'
|
21
|
+
s.add_remote_file_target do |t|
|
22
|
+
t.platform = :windows
|
23
|
+
t.archive_type = :exe
|
24
|
+
t.url = "http://download.macromedia.com/pub/flashplayer/updaters/11/flashplayer_11_sa_debug.exe"
|
25
|
+
#t.url = "http://download.macromedia.com/pub/flashplayer/updaters/10/flashplayer_10_sa_debug.exe"
|
26
|
+
t.md5 = "6fbc96203b878529a5baefe2226a403e"
|
27
|
+
t.add_executable :flashplayer, "6fbc96203b878529a5baefe2226a403e.exe"
|
28
|
+
end
|
29
|
+
|
30
|
+
s.add_remote_file_target do |t|
|
31
|
+
t.platform = :osx
|
32
|
+
t.archive_type = :zip
|
33
|
+
t.url = "http://fpdownload.macromedia.com/pub/flashplayer/updaters/11/flashplayer_11_sa_debug.app.zip"
|
34
|
+
t.md5 = "861e7b57ffae780ba391ac6adcb40a0d"
|
35
|
+
t.add_executable :flashplayer, "Flash Player Debugger.app"
|
36
|
+
end
|
37
|
+
|
38
|
+
s.add_remote_file_target do |t|
|
39
|
+
t.platform = :linux
|
40
|
+
t.archive_type = :tgz
|
41
|
+
t.url = "http://fpdownload.macromedia.com/pub/flashplayer/updaters/11/flashplayer_11_sa_debug.i386.tar.gz"
|
42
|
+
t.md5 = "38151e67351abce195339dc44d4ff7d0"
|
43
|
+
t.add_executable :flashplayer, "flashplayerdebugger"
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
|
2
|
+
module Sprout
|
3
|
+
|
4
|
+
module System
|
5
|
+
|
6
|
+
class WinSystem
|
7
|
+
|
8
|
+
def open_flashplayer_with exe, swf
|
9
|
+
return Thread.new {
|
10
|
+
execute exe, swf
|
11
|
+
}
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class OSXSystem < UnixSystem
|
16
|
+
|
17
|
+
##
|
18
|
+
# Use AppleScript to open the specified Flash Player
|
19
|
+
# because, simply launching the executable does not focus
|
20
|
+
# it.
|
21
|
+
def open_flashplayer_with exe, swf
|
22
|
+
# Clean paths differently for this exectuable,
|
23
|
+
# because we're forking out to AppleScript over
|
24
|
+
# a new process, and spaces need to be escaped.
|
25
|
+
@player_exe = exe.split(' ').join('\ ')
|
26
|
+
|
27
|
+
wrapper = []
|
28
|
+
wrapper << "osascript"
|
29
|
+
wrapper << open_flashplayer_script_path
|
30
|
+
wrapper << @player_exe
|
31
|
+
|
32
|
+
# Call the UnixSystem.open_flashplayer_with method:
|
33
|
+
super wrapper.join(" "), File.expand_path(swf)
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
##
|
39
|
+
# Use AppleScript to close the Flash Player
|
40
|
+
def close_flashplayer
|
41
|
+
closer = []
|
42
|
+
closer << "osascript"
|
43
|
+
closer << close_flashplayer_script_path
|
44
|
+
closer << @player_exe
|
45
|
+
`#{closer.join(" ")}`
|
46
|
+
end
|
47
|
+
|
48
|
+
def ext_gem_path
|
49
|
+
File.join(File.dirname(__FILE__), '..', '..', 'ext')
|
50
|
+
end
|
51
|
+
|
52
|
+
def close_flashplayer_script_path
|
53
|
+
File.expand_path(File.join(ext_gem_path, "CloseFlashPlayerForDumbassOSX.scpt"))
|
54
|
+
end
|
55
|
+
|
56
|
+
def open_flashplayer_script_path
|
57
|
+
File.expand_path(File.join(ext_gem_path, "OpenFlashPlayerForDumbassOSX.scpt"))
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
# All others inherit from this class
|
63
|
+
class UnixSystem
|
64
|
+
|
65
|
+
def open_flashplayer_with exe, swf
|
66
|
+
player_open = false
|
67
|
+
trap("INT") {
|
68
|
+
close_flashplayer
|
69
|
+
@player_thread.kill
|
70
|
+
}
|
71
|
+
|
72
|
+
@player_thread = Thread.new {
|
73
|
+
require 'open4'
|
74
|
+
@player_pid, stdin, stdout, stderr = Open4.popen4("#{exe} #{swf}")
|
75
|
+
player_open = true
|
76
|
+
stdout.read
|
77
|
+
}
|
78
|
+
|
79
|
+
# Wait until the player process has actually
|
80
|
+
# openned...
|
81
|
+
while !player_open
|
82
|
+
sleep 0.1
|
83
|
+
end
|
84
|
+
|
85
|
+
@player_thread
|
86
|
+
end
|
87
|
+
|
88
|
+
private
|
89
|
+
|
90
|
+
def close_flashplayer
|
91
|
+
# Don't need to do anything - created
|
92
|
+
# this method to handle belligerent OS X trash.
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
@@ -0,0 +1,293 @@
|
|
1
|
+
|
2
|
+
=begin
|
3
|
+
|
4
|
+
class FlashPlayerTask < Rake::Task
|
5
|
+
# This is the opening prelude to a collection of test results. When the
|
6
|
+
# task encounters this string in the trace output log file, it will begin
|
7
|
+
# collecting trace statements with the expectation that the following
|
8
|
+
# strings will be well-formatted XML data matching what JUnit emits for
|
9
|
+
# Cruise Control.
|
10
|
+
#
|
11
|
+
# See the lib/asunit3/asunit.framework.XMLResultPrinter for more information.
|
12
|
+
@@test_result_pre_delimiter = '<XMLResultPrinter>'
|
13
|
+
|
14
|
+
# This is the closing string that will indicate the end of test result XML data
|
15
|
+
@@test_result_post_delimiter = '</XMLResultPrinter>'
|
16
|
+
|
17
|
+
@@home = nil
|
18
|
+
@@trust = nil
|
19
|
+
|
20
|
+
def initialize(task_name, app)
|
21
|
+
super(task_name, app)
|
22
|
+
@default_gem_name = 'sprout-flashplayer-tool'
|
23
|
+
@default_gem_version = '10.22.0'
|
24
|
+
@default_result_file = 'AsUnitResults.xml'
|
25
|
+
@inside_test_result = false
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.define_task(args, &block)
|
29
|
+
t = super
|
30
|
+
yield t if block_given?
|
31
|
+
t.define
|
32
|
+
end
|
33
|
+
|
34
|
+
# Local system path to the Flash Player Trust file
|
35
|
+
def FlashPlayerTask.trust
|
36
|
+
if(@@trust)
|
37
|
+
return @@trust
|
38
|
+
end
|
39
|
+
@@trust = File.join(FlashPlayerTask.home, '#Security', 'FlashPlayerTrust', 'sprout.cfg')
|
40
|
+
return @@trust
|
41
|
+
end
|
42
|
+
|
43
|
+
# Local system path to where the Flash Player stores trace output logs and trust files
|
44
|
+
def FlashPlayerTask.home
|
45
|
+
if(@@home)
|
46
|
+
return @@home
|
47
|
+
end
|
48
|
+
|
49
|
+
FlashPlayerTask.home_paths.each do |path|
|
50
|
+
if(File.exists?(path))
|
51
|
+
return @@home = path
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
if(@@home.nil?)
|
56
|
+
raise FlashPlayerError.new('FlashPlayer unable to find home folder for your platform')
|
57
|
+
end
|
58
|
+
return @@home
|
59
|
+
end
|
60
|
+
|
61
|
+
# Collection of the potential locations of the Flash Player Home
|
62
|
+
# For each supported Platform, the first existing location
|
63
|
+
# will be used.
|
64
|
+
def FlashPlayerTask.home_paths
|
65
|
+
return [File.join(User.library, 'Preferences', 'Macromedia', 'Flash Player'),
|
66
|
+
File.join(User.library, 'Application Support', 'Macromedia'),
|
67
|
+
File.join(User.home, 'Application Data', 'Macromedia', 'Flash Player'),
|
68
|
+
File.join(User.home, 'AppData', 'Roaming', 'Macromedia', 'Flash Player'),
|
69
|
+
File.join(User.home, '.macromedia', 'Flash_Player')]
|
70
|
+
end
|
71
|
+
|
72
|
+
# The swf parameter can be set explicitly in the block sent to this task as in:
|
73
|
+
#
|
74
|
+
# flashplayer :run do |t|
|
75
|
+
# t.swf = 'bin/SomeProject.swf'
|
76
|
+
# end
|
77
|
+
#
|
78
|
+
# Or it can be set implicitly as a rake prerequisite as follows:
|
79
|
+
#
|
80
|
+
# flashplayer :run => 'bin/SomeProject' do |t|
|
81
|
+
# end
|
82
|
+
#
|
83
|
+
def swf=(swf)
|
84
|
+
@swf = swf
|
85
|
+
end
|
86
|
+
|
87
|
+
def swf
|
88
|
+
@swf ||= nil
|
89
|
+
if(@swf.nil?)
|
90
|
+
prerequisites.each do |req|
|
91
|
+
if(req.index('.swf'))
|
92
|
+
@swf = req.to_s
|
93
|
+
break
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
return @swf
|
98
|
+
end
|
99
|
+
|
100
|
+
def gem_version=(version)
|
101
|
+
@gem_version = version
|
102
|
+
end
|
103
|
+
|
104
|
+
def gem_version
|
105
|
+
return @gem_version ||= nil
|
106
|
+
end
|
107
|
+
|
108
|
+
# Full name of the sprout tool gem that this tool task will use.
|
109
|
+
# This defaults to sprout-flashplayer-tool
|
110
|
+
def gem_name=(name)
|
111
|
+
@gem_name = name
|
112
|
+
end
|
113
|
+
|
114
|
+
def gem_name
|
115
|
+
return @gem_name ||= @default_gem_name
|
116
|
+
end
|
117
|
+
|
118
|
+
# The File where JUnit test results should be written. This value
|
119
|
+
# defaults to 'AsUnitResults.xml'
|
120
|
+
#
|
121
|
+
def test_result_file=(file)
|
122
|
+
@test_result_file = file
|
123
|
+
end
|
124
|
+
|
125
|
+
def test_result_file
|
126
|
+
@test_result_file ||= @default_result_file
|
127
|
+
end
|
128
|
+
|
129
|
+
def test_result
|
130
|
+
@test_result ||= ''
|
131
|
+
end
|
132
|
+
|
133
|
+
def define
|
134
|
+
CLEAN.add(test_result_file)
|
135
|
+
end
|
136
|
+
|
137
|
+
def execute(*args)
|
138
|
+
super
|
139
|
+
raise FlashPlayerError.new("FlashPlayer task #{name} required field swf is nil") unless swf
|
140
|
+
|
141
|
+
log_file = nil
|
142
|
+
|
143
|
+
# Don't let trust or log file failures break other features...
|
144
|
+
begin
|
145
|
+
config = FlashPlayerConfig.new
|
146
|
+
log_file = config.log_file
|
147
|
+
FlashPlayerTrust.new(File.expand_path(File.dirname(swf)))
|
148
|
+
|
149
|
+
if(File.exists?(log_file))
|
150
|
+
File.open(log_file, 'w') do |f|
|
151
|
+
f.write('')
|
152
|
+
end
|
153
|
+
else
|
154
|
+
FileUtils.makedirs(File.dirname(log_file))
|
155
|
+
FileUtils.touch(log_file)
|
156
|
+
end
|
157
|
+
rescue StandardError => e
|
158
|
+
logger.puts '[WARNING] FlashPlayer encountered an error working with the mm.cfg log and/or editing the Trust file'
|
159
|
+
end
|
160
|
+
|
161
|
+
@running_process = nil
|
162
|
+
@thread = run(gem_name, gem_version, swf)
|
163
|
+
read_log(@thread, log_file) unless log_file.nil?
|
164
|
+
@thread.join
|
165
|
+
end
|
166
|
+
|
167
|
+
def run(tool, gem_version, swf)
|
168
|
+
path_to_exe = Sprout.get_executable(tool, nil, gem_version)
|
169
|
+
target = User.clean_path(path_to_exe)
|
170
|
+
@player_pid = nil
|
171
|
+
|
172
|
+
thread_out = $stdout
|
173
|
+
command = "#{target} #{User.clean_path(swf)}"
|
174
|
+
|
175
|
+
usr = User.new()
|
176
|
+
if(usr.is_a?(WinUser) && !usr.is_a?(CygwinUser))
|
177
|
+
return Thread.new {
|
178
|
+
system command
|
179
|
+
}
|
180
|
+
elsif usr.is_a?(OSXUser)
|
181
|
+
require 'clix_flash_player'
|
182
|
+
@clix_player = CLIXFlashPlayer.new
|
183
|
+
@clix_player.execute(target, swf)
|
184
|
+
return @clix_player
|
185
|
+
else
|
186
|
+
return Thread.new {
|
187
|
+
require 'open4'
|
188
|
+
@player_pid, stdin, stdout, stderr = Open4.popen4(command)
|
189
|
+
stdout.read
|
190
|
+
}
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
def close
|
195
|
+
usr = User.new
|
196
|
+
if(usr.is_a?(WinUser))
|
197
|
+
Thread.kill(@thread)
|
198
|
+
elsif(usr.is_a?(OSXUser))
|
199
|
+
@clix_player.kill unless @clix_player.nil?
|
200
|
+
else
|
201
|
+
Process.kill("SIGALRM", @player_pid)
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
def read_log(thread, log_file)
|
206
|
+
lines_put = 0
|
207
|
+
|
208
|
+
if(log_file.nil?)
|
209
|
+
raise FlashPlayerError.new('[ERROR] Unable to find the trace output log file because the expected location was nil')
|
210
|
+
end
|
211
|
+
|
212
|
+
if(!File.exists?(log_file))
|
213
|
+
raise FlashPlayerError.new('[ERROR] Unable to find the trace output log file in the expected location: ' + log_file)
|
214
|
+
end
|
215
|
+
|
216
|
+
while(thread.alive?)
|
217
|
+
sleep(0.2)
|
218
|
+
lines_read = 0
|
219
|
+
|
220
|
+
File.open(log_file, 'r') do |file|
|
221
|
+
file.readlines.each do |line|
|
222
|
+
lines_read = lines_read + 1
|
223
|
+
if(lines_read > lines_put)
|
224
|
+
if(!parse_test_result(line, thread))
|
225
|
+
logger.puts "[trace] #{line}"
|
226
|
+
end
|
227
|
+
$stdout.flush
|
228
|
+
lines_put = lines_put + 1
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
# Returns true if inside of a test result
|
236
|
+
def parse_test_result(line, thread)
|
237
|
+
if(@inside_test_result)
|
238
|
+
if(line.index(@@test_result_post_delimiter))
|
239
|
+
@inside_test_result = false
|
240
|
+
write_test_result(test_result)
|
241
|
+
close
|
242
|
+
examine_test_result test_result
|
243
|
+
return true
|
244
|
+
else
|
245
|
+
test_result << line
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
if(line.index(@@test_result_pre_delimiter))
|
250
|
+
@inside_test_result = true
|
251
|
+
end
|
252
|
+
|
253
|
+
return @inside_test_result
|
254
|
+
end
|
255
|
+
|
256
|
+
def write_test_result(result)
|
257
|
+
FileUtils.makedirs(File.dirname(test_result_file))
|
258
|
+
File.open(test_result_file, File::CREAT|File::TRUNC|File::RDWR) do |f|
|
259
|
+
f.puts(result)
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
263
|
+
def examine_test_result(result)
|
264
|
+
require 'rexml/document'
|
265
|
+
doc = nil
|
266
|
+
begin
|
267
|
+
doc = REXML::Document.new(result)
|
268
|
+
rescue REXML::ParseException => e
|
269
|
+
puts "[WARNING] Invalid test results encountered"
|
270
|
+
return
|
271
|
+
end
|
272
|
+
|
273
|
+
# Handle JUnit Failures
|
274
|
+
failures = []
|
275
|
+
|
276
|
+
doc.elements.each('/testsuites/testsuite/testsuite/testcase/error') do |element|
|
277
|
+
failures << element.text
|
278
|
+
end
|
279
|
+
|
280
|
+
doc.elements.each("/testsuites/testsuite/testsuite/testcase/failure") do |element|
|
281
|
+
failures << element.text
|
282
|
+
end
|
283
|
+
|
284
|
+
if(failures.size > 0)
|
285
|
+
raise AssertionFailure.new("[ERROR] Test Failures Encountered \n#{failures.join("\n")}")
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
end
|
290
|
+
|
291
|
+
=end
|
292
|
+
|
293
|
+
|
@@ -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/flashplayer.rb
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
require 'flashplayer/system_mixins'
|
2
|
+
require 'flashplayer/errors'
|
3
|
+
require 'flashplayer/module'
|
4
|
+
require 'flashplayer/mm_config'
|
5
|
+
require 'flashplayer/trust'
|
6
|
+
require 'flashplayer/log_file'
|
7
|
+
require 'flashplayer/executable'
|
8
|
+
require 'flashplayer/task'
|
9
|
+
require 'flashplayer/specification'
|
@@ -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
|
+
|
data/lib/flashsdk/adl.rb
ADDED
@@ -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
|