sprout-flashplayer-bundle 9.115.9 → 9.115.11
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sprout/flashplayer/version.rb +1 -1
- data/lib/sprout/tasks/flashplayer_task.rb +152 -49
- metadata +2 -2
@@ -25,7 +25,13 @@ module Sprout
|
|
25
25
|
|
26
26
|
class FlashPlayerError < StandardError #:nodoc:
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
|
+
# This exception will be raised when the FlashPlayerTask has encountered
|
30
|
+
# a test_result_pre_delimiter and subsequently a well-formatted JUnit
|
31
|
+
# XML result test failure
|
32
|
+
class AssertionFailure < StandardError
|
33
|
+
end
|
34
|
+
|
29
35
|
# The FlashPlayerTask will download, unpack, configure and launch the debug
|
30
36
|
# Flash Player for OS X, Windows and Linux.
|
31
37
|
#
|
@@ -40,58 +46,36 @@ module Sprout
|
|
40
46
|
# t.swf = 'bin/SomeProject.swf'
|
41
47
|
# end
|
42
48
|
#
|
43
|
-
# You can also send the FlashPlayerTask a variety of additional parameters including which
|
44
|
-
# version of the FlashPlayer to download (only 9.115.x is supported at the time of this writing).
|
45
|
-
#
|
46
49
|
class FlashPlayerTask < Rake::Task
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
+
# This is the opening prelude to a collection of test results. When the
|
51
|
+
# task encounters this string in the trace output log file, it will begin
|
52
|
+
# collecting trace statements with the expectation that the following
|
53
|
+
# strings will be well-formatted XML data matching what JUnit emits for
|
54
|
+
# Cruise Control.
|
55
|
+
#
|
56
|
+
# See the lib/asunit3/asunit.framework.XMLResultPrinter for more information.
|
50
57
|
@@test_result_pre_delimiter = '<XMLResultPrinter>'
|
58
|
+
|
59
|
+
# This is the closing string that will indicate the end of test result XML data
|
51
60
|
@@test_result_post_delimiter = '</XMLResultPrinter>'
|
61
|
+
|
52
62
|
@@home = nil
|
53
63
|
@@trust = nil
|
54
64
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
65
|
+
def initialize(task_name, app)
|
66
|
+
super(task_name, app)
|
67
|
+
@default_gem_name = 'sprout-flashplayer-tool'
|
68
|
+
@default_result_file = 'AsUnitResults.xml'
|
69
|
+
@inside_test_result = false
|
70
|
+
end
|
60
71
|
|
61
72
|
def self.define_task(args, &block)
|
62
73
|
t = super
|
63
74
|
yield t if block_given?
|
64
75
|
t.define
|
65
76
|
end
|
66
|
-
|
67
|
-
def initialize_task
|
68
|
-
end
|
69
77
|
|
70
|
-
|
71
|
-
@swf ||= nil
|
72
|
-
if(@swf.nil?)
|
73
|
-
prerequisites.each do |req|
|
74
|
-
if(req.index('.swf'))
|
75
|
-
@swf = req.to_s
|
76
|
-
break
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
return @swf
|
81
|
-
end
|
82
|
-
|
83
|
-
def define
|
84
|
-
CLEAN.add(test_result_file)
|
85
|
-
end
|
86
|
-
|
87
|
-
def test_result_file
|
88
|
-
@test_result_file ||= 'AsUnitResults.xml'
|
89
|
-
end
|
90
|
-
|
91
|
-
def test_result
|
92
|
-
@test_result ||= ''
|
93
|
-
end
|
94
|
-
|
78
|
+
# Local system path to the Flash Player Trust file
|
95
79
|
def FlashPlayerTask.trust
|
96
80
|
if(@@trust)
|
97
81
|
return @@trust
|
@@ -100,6 +84,7 @@ module Sprout
|
|
100
84
|
return @@trust
|
101
85
|
end
|
102
86
|
|
87
|
+
# Local system path to where the Flash Player stores trace output logs and trust files
|
103
88
|
def FlashPlayerTask.home
|
104
89
|
if(@@home)
|
105
90
|
return @@home
|
@@ -117,7 +102,7 @@ module Sprout
|
|
117
102
|
return @@home
|
118
103
|
end
|
119
104
|
|
120
|
-
#
|
105
|
+
# Collection of the potential locations of the Flash Player Home
|
121
106
|
# For each supported Platform, the first existing location
|
122
107
|
# will be used.
|
123
108
|
def FlashPlayerTask.home_paths
|
@@ -127,10 +112,97 @@ module Sprout
|
|
127
112
|
File.join(User.home, '.macromedia', 'Flash_Player')]
|
128
113
|
end
|
129
114
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
115
|
+
# The swf parameter can be set explicitly in the block sent to this task as in:
|
116
|
+
#
|
117
|
+
# flashplayer :run do |t|
|
118
|
+
# t.swf = 'bin/SomeProject.swf'
|
119
|
+
# end
|
120
|
+
#
|
121
|
+
# Or it can be set implicitly as a rake prerequisite as follows:
|
122
|
+
#
|
123
|
+
# flashplayer :run => 'bin/SomeProject' do |t|
|
124
|
+
# end
|
125
|
+
#
|
126
|
+
def swf(swf)
|
127
|
+
@swf = swf
|
128
|
+
end
|
129
|
+
|
130
|
+
def swf
|
131
|
+
@swf ||= nil
|
132
|
+
if(@swf.nil?)
|
133
|
+
prerequisites.each do |req|
|
134
|
+
if(req.index('.swf'))
|
135
|
+
@swf = req.to_s
|
136
|
+
break
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
return @swf
|
141
|
+
end
|
142
|
+
|
143
|
+
# By default, the Flash Player should be given focus after being launched. Unfortunately,
|
144
|
+
# this doesn't work properly on OS X, so we needed to do some hackery in order to make it
|
145
|
+
# happen. This in turn can lead to multiple instances of the Player being instantiated.
|
146
|
+
# In the case of running a test harness, this is absolutely not desirable, so we had
|
147
|
+
# expose a parameter that allows us to prevent auto-focus of the player.
|
148
|
+
def do_not_focus=(focus)
|
149
|
+
@do_not_focus = focus
|
150
|
+
end
|
151
|
+
|
152
|
+
def do_not_focus
|
153
|
+
@do_not_focus ||= nil
|
154
|
+
end
|
155
|
+
|
156
|
+
# The gem version of the sprout-flashplayer-tool RubyGem to download.
|
157
|
+
#
|
158
|
+
# It's important to note that this version number
|
159
|
+
# will differ slightly from the actual player version in that the final revision
|
160
|
+
# (the last of three numbers), is the gem version, while the first two describe the player
|
161
|
+
# version being downloaded.
|
162
|
+
# The exact gem version that you would like the ToolTask to execute. By default this value
|
163
|
+
# should be nil and will download the latest version of the gem that is available unless
|
164
|
+
# there is a version already installed on your system.
|
165
|
+
#
|
166
|
+
# This attribute could be an easy
|
167
|
+
# way to update your local gem to the latest version without leaving your build file,
|
168
|
+
# but it's primary purpose is to allow you to specify very specific versions of the tools
|
169
|
+
# that your project depends on. This way your team can rest assured that they are all
|
170
|
+
# working with the same tools.
|
171
|
+
def gem_version=(version)
|
172
|
+
@gem_version = version
|
173
|
+
end
|
174
|
+
|
175
|
+
def gem_version
|
176
|
+
return @gem_version ||= nil
|
177
|
+
end
|
178
|
+
|
179
|
+
# Full name of the sprout tool gem that this tool task will use.
|
180
|
+
# This defaults to sprout-flashplayer-tool
|
181
|
+
def gem_name=(name)
|
182
|
+
@gem_name = name
|
183
|
+
end
|
184
|
+
|
185
|
+
def gem_name
|
186
|
+
return @gem_name ||= @default_gem_name
|
187
|
+
end
|
188
|
+
|
189
|
+
# The File where JUnit test results should be written. This value
|
190
|
+
# defaults to 'AsUnitResults.xml'
|
191
|
+
#
|
192
|
+
def test_result_file=(file)
|
193
|
+
@test_result_file = file
|
194
|
+
end
|
195
|
+
|
196
|
+
def test_result_file
|
197
|
+
@test_result_file ||= @default_result_file
|
198
|
+
end
|
199
|
+
|
200
|
+
def test_result
|
201
|
+
@test_result ||= ''
|
202
|
+
end
|
203
|
+
|
204
|
+
def define # :nodoc:
|
205
|
+
CLEAN.add(test_result_file)
|
134
206
|
end
|
135
207
|
|
136
208
|
def execute(*args)
|
@@ -157,7 +229,7 @@ module Sprout
|
|
157
229
|
end
|
158
230
|
|
159
231
|
@running_process = nil
|
160
|
-
@thread = run(
|
232
|
+
@thread = run(gem_name, gem_version, swf)
|
161
233
|
read_log(@thread, log_file)
|
162
234
|
@thread.join
|
163
235
|
end
|
@@ -170,8 +242,8 @@ module Sprout
|
|
170
242
|
end
|
171
243
|
end
|
172
244
|
|
173
|
-
def run(tool,
|
174
|
-
path_to_exe = Sprout.get_executable(tool, nil,
|
245
|
+
def run(tool, gem_version, swf)
|
246
|
+
path_to_exe = Sprout.get_executable(tool, nil, gem_version)
|
175
247
|
target = User.clean_path(path_to_exe)
|
176
248
|
@player_pid = nil
|
177
249
|
|
@@ -192,6 +264,7 @@ module Sprout
|
|
192
264
|
end
|
193
265
|
|
194
266
|
def focus_player_on_mac(out, exe)
|
267
|
+
return if do_not_focus
|
195
268
|
begin
|
196
269
|
if(User.new.is_a?(OSXUser))
|
197
270
|
require 'appscript'
|
@@ -227,7 +300,7 @@ module Sprout
|
|
227
300
|
end
|
228
301
|
end
|
229
302
|
end
|
230
|
-
|
303
|
+
|
231
304
|
# Returns true if inside of a test result
|
232
305
|
def parse_test_result(line, thread)
|
233
306
|
if(@inside_test_result)
|
@@ -235,6 +308,7 @@ module Sprout
|
|
235
308
|
@inside_test_result = false
|
236
309
|
write_test_result(test_result)
|
237
310
|
close
|
311
|
+
examine_test_result test_result
|
238
312
|
return true
|
239
313
|
else
|
240
314
|
test_result << line
|
@@ -254,6 +328,35 @@ module Sprout
|
|
254
328
|
f.puts(result)
|
255
329
|
end
|
256
330
|
end
|
331
|
+
|
332
|
+
def examine_test_result(result)
|
333
|
+
require 'rexml/document'
|
334
|
+
doc = nil
|
335
|
+
begin
|
336
|
+
doc = REXML::Document.new(result)
|
337
|
+
rescue REXML::ParseException => e
|
338
|
+
puts "[WARNING] Invalid test results encountered"
|
339
|
+
return
|
340
|
+
end
|
341
|
+
|
342
|
+
# Handle JUnit Failures
|
343
|
+
failures = []
|
344
|
+
|
345
|
+
doc.elements.each('/testsuites/testsuite/testsuite/testcase/error') do |element|
|
346
|
+
failures << element.text
|
347
|
+
end
|
348
|
+
|
349
|
+
doc.elements.each("/testsuites/testsuite/testsuite/testcase/failure") do |element|
|
350
|
+
failures << element.text
|
351
|
+
end
|
352
|
+
|
353
|
+
if(failures.size > 0)
|
354
|
+
raise AssertionFailure.new("Test Failures Encountered #{failures.join("\n")}")
|
355
|
+
end
|
356
|
+
|
357
|
+
end
|
358
|
+
|
359
|
+
|
257
360
|
end
|
258
361
|
|
259
362
|
##########################################
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sprout-flashplayer-bundle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.115.
|
4
|
+
version: 9.115.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pattern Park
|
@@ -9,7 +9,7 @@ autorequire: sprout/flashplayer
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-02-
|
12
|
+
date: 2008-02-20 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|