sprout-flashplayer-bundle 9.151.1 → 10.22.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/clix_flash_player.rb +83 -0
- data/lib/clix_wrapper.rb +24 -0
- data/lib/sprout/flashplayer/version.rb +3 -3
- data/lib/sprout/tasks/flashplayer_task.rb +30 -28
- data/rakefile.rb +5 -0
- metadata +29 -12
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'open4'
|
3
|
+
|
4
|
+
$CLIX_WRAPPER_TARGET = File.join(File.expand_path(File.dirname(__FILE__)), 'clix_wrapper.rb')
|
5
|
+
|
6
|
+
$:.unshift(File.dirname(__FILE__)) unless
|
7
|
+
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
8
|
+
|
9
|
+
class CLIXFlashPlayerError < StandardError; end
|
10
|
+
|
11
|
+
class CLIXFlashPlayer
|
12
|
+
VERSION = '0.1.0'
|
13
|
+
|
14
|
+
def initialize
|
15
|
+
@activate_pid = nil
|
16
|
+
@player_pid = nil
|
17
|
+
@thread = nil
|
18
|
+
end
|
19
|
+
|
20
|
+
def execute(player, swf)
|
21
|
+
cleanup
|
22
|
+
player = clean_path(player)
|
23
|
+
swf = clean_path(swf)
|
24
|
+
validate(player, swf)
|
25
|
+
|
26
|
+
if(!player.match('Contents/MacOS'))
|
27
|
+
player = File.join(player, 'Contents', 'MacOS', 'Flash Player')
|
28
|
+
end
|
29
|
+
|
30
|
+
setup_trap
|
31
|
+
@thread = Thread.new {
|
32
|
+
@player_pid = open4.popen4("#{player.split(' ').join('\ ')}")[0]
|
33
|
+
raise "clix_wrapper.rb could not be found at: #{wrapper}" if !File.exists?($CLIX_WRAPPER_TARGET)
|
34
|
+
command = "ruby #{$CLIX_WRAPPER_TARGET} '#{player}' '#{swf}'"
|
35
|
+
@activate_pid = open4.popen4(command)[0]
|
36
|
+
Process.wait(@player_pid)
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
def kill
|
41
|
+
system("kill -9 #{@player_pid}")
|
42
|
+
end
|
43
|
+
|
44
|
+
def join
|
45
|
+
@thread.join
|
46
|
+
end
|
47
|
+
|
48
|
+
def alive?
|
49
|
+
return @thread.alive?
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def clean_path(path)
|
55
|
+
File.expand_path(path.gsub("'", '').gsub("\\", ''))
|
56
|
+
end
|
57
|
+
|
58
|
+
def cleanup
|
59
|
+
if(@thread && @thread.alive?)
|
60
|
+
kill
|
61
|
+
@thread.join
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def validate(player, swf)
|
66
|
+
raise CLIXFlashPlayerError.new("Player must not be nil") if(player.nil? || player == '')
|
67
|
+
raise CLIXFlashPlayerError.new("Player cannot be found: '#{player}'") if(!File.exists?(player))
|
68
|
+
raise CLIXFlashPlayerError.new("SWF must not be nil") if(swf.nil? || swf == '')
|
69
|
+
raise CLIXFlashPlayerError.new("SWF cannot be found: '#{swf}'") if(!File.exists?(swf))
|
70
|
+
end
|
71
|
+
|
72
|
+
def setup_trap
|
73
|
+
# Trap the CTRL+C Interrupt signal
|
74
|
+
# Which prevents nasty exception messages
|
75
|
+
Kernel.trap('INT') do
|
76
|
+
if(@thread.alive?)
|
77
|
+
@thread.kill
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
|
data/lib/clix_wrapper.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
require 'rubygems'
|
3
|
+
require 'appscript'
|
4
|
+
|
5
|
+
player = ARGV[0]
|
6
|
+
swf = ARGV[1]
|
7
|
+
|
8
|
+
if(player.nil?)
|
9
|
+
raise "CLIXWrapper requires 'player' argument like:\nruby clix_wrapper [player] [swf]"
|
10
|
+
end
|
11
|
+
|
12
|
+
if(swf.nil?)
|
13
|
+
raise "CLIXWrapper requires 'swf' argument like:\nruby clix_wrapper [player] [swf]"
|
14
|
+
end
|
15
|
+
|
16
|
+
begin
|
17
|
+
# Give the player focus:
|
18
|
+
Appscript.app(player).activate
|
19
|
+
# Open the SWF:
|
20
|
+
Appscript.app(player).open(MacTypes::Alias.path(swf))
|
21
|
+
rescue LoadError => e
|
22
|
+
raise 'You must install the rb-appscript gem to use the desktop debug Flash Player'
|
23
|
+
end
|
24
|
+
|
@@ -21,6 +21,8 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
21
21
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
22
|
=end
|
23
23
|
|
24
|
+
require 'clix_flash_player'
|
25
|
+
|
24
26
|
module Sprout
|
25
27
|
|
26
28
|
class FlashPlayerError < StandardError #:nodoc:
|
@@ -65,6 +67,7 @@ module Sprout
|
|
65
67
|
def initialize(task_name, app)
|
66
68
|
super(task_name, app)
|
67
69
|
@default_gem_name = 'sprout-flashplayer-tool'
|
70
|
+
@default_gem_version = '10.22.0'
|
68
71
|
@default_result_file = 'AsUnitResults.xml'
|
69
72
|
@inside_test_result = false
|
70
73
|
end
|
@@ -145,8 +148,11 @@ module Sprout
|
|
145
148
|
# happen. This in turn can lead to multiple instances of the Player being instantiated.
|
146
149
|
# In the case of running a test harness, this is absolutely not desirable, so we had
|
147
150
|
# expose a parameter that allows us to prevent auto-focus of the player.
|
151
|
+
#
|
152
|
+
# This feature is deprecated in current versions of the FlashPlayerTask
|
148
153
|
def do_not_focus=(focus)
|
149
154
|
@do_not_focus = focus
|
155
|
+
puts "[WARNING] Thanks to fixes in the FlashPlayer task, do_not_focus is deprecated and no longer needs to be used"
|
150
156
|
end
|
151
157
|
|
152
158
|
def do_not_focus
|
@@ -221,10 +227,10 @@ module Sprout
|
|
221
227
|
f.write('')
|
222
228
|
end
|
223
229
|
else
|
224
|
-
FileUtils.
|
230
|
+
FileUtils.makedirs(File.dirname(log_file))
|
225
231
|
FileUtils.touch(log_file)
|
226
232
|
end
|
227
|
-
rescue
|
233
|
+
rescue StandardError => e
|
228
234
|
puts '[WARNING] FlashPlayer encountered an error working with the mm.cfg log and/or editing the Trust file'
|
229
235
|
end
|
230
236
|
|
@@ -233,14 +239,6 @@ module Sprout
|
|
233
239
|
read_log(@thread, log_file)
|
234
240
|
@thread.join
|
235
241
|
end
|
236
|
-
|
237
|
-
def close
|
238
|
-
if(User.new().is_a?(WinUser))
|
239
|
-
Thread.kill(@thread)
|
240
|
-
else
|
241
|
-
Process.kill("SIGALRM", @player_pid)
|
242
|
-
end
|
243
|
-
end
|
244
242
|
|
245
243
|
def run(tool, gem_version, swf)
|
246
244
|
path_to_exe = Sprout.get_executable(tool, nil, gem_version)
|
@@ -250,31 +248,35 @@ module Sprout
|
|
250
248
|
thread_out = $stdout
|
251
249
|
command = "#{target} #{User.clean_path(swf)}"
|
252
250
|
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
251
|
+
usr = User.new()
|
252
|
+
if(usr.is_a?(WinUser) && !usr.is_a?(CygwinUser))
|
253
|
+
return Thread.new {
|
254
|
+
system command
|
255
|
+
}
|
256
|
+
elsif usr.is_a?(OSXUser)
|
257
|
+
@clix_player = CLIXFlashPlayer.new
|
258
|
+
@clix_player.execute(target, swf)
|
259
|
+
return @clix_player
|
260
|
+
else
|
261
|
+
return Thread.new {
|
258
262
|
require 'open4'
|
259
263
|
@player_pid, stdin, stdout, stderr = Open4.popen4(command)
|
260
|
-
focus_player_on_mac(thread_out, path_to_exe)
|
261
264
|
stdout.read
|
262
|
-
|
263
|
-
|
265
|
+
}
|
266
|
+
end
|
264
267
|
end
|
265
268
|
|
266
|
-
def
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
puts "[WARNING] Cannot focus Flash Player without rb-appscript gem"
|
269
|
+
def close
|
270
|
+
usr = User.new
|
271
|
+
if(usr.is_a?(WinUser))
|
272
|
+
Thread.kill(@thread)
|
273
|
+
elsif(usr.is_a?(OSXUser))
|
274
|
+
@thread.kill
|
275
|
+
else
|
276
|
+
Process.kill("SIGALRM", @player_pid)
|
275
277
|
end
|
276
278
|
end
|
277
|
-
|
279
|
+
|
278
280
|
def read_log(thread, log_file)
|
279
281
|
lines_put = 0
|
280
282
|
|
data/rakefile.rb
CHANGED
@@ -42,6 +42,11 @@ spec = Gem::Specification.new do |s|
|
|
42
42
|
s.files = PKG_LIST.to_a
|
43
43
|
|
44
44
|
s.add_dependency('sprout', '>= 0.7.189')
|
45
|
+
s.add_dependency('sprout-flashplayer-tool', '>= 10.22.0')
|
46
|
+
|
47
|
+
if RUBY_PLATFORM.match('darwin')
|
48
|
+
s.add_dependency('rb-appscript', '>= 0.5.1')
|
49
|
+
end
|
45
50
|
end
|
46
51
|
|
47
52
|
Rake::GemPackageTask.new(spec) do |p|
|
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:
|
4
|
+
version: 10.22.0
|
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: 2009-
|
12
|
+
date: 2009-05-21 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -22,6 +22,26 @@ dependencies:
|
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: 0.7.189
|
24
24
|
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: sprout-flashplayer-tool
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 10.22.0
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: rb-appscript
|
37
|
+
type: :runtime
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 0.5.1
|
44
|
+
version:
|
25
45
|
description: Shared Project to support the Flash Player task
|
26
46
|
email: projectsprouts@googlegroups.com
|
27
47
|
executables: []
|
@@ -31,19 +51,16 @@ extensions: []
|
|
31
51
|
extra_rdoc_files: []
|
32
52
|
|
33
53
|
files:
|
34
|
-
- lib
|
35
|
-
- pkg
|
36
54
|
- rakefile.rb
|
37
|
-
-
|
38
|
-
-
|
39
|
-
- lib/sprout
|
40
|
-
- lib/sprout/flashplayer
|
55
|
+
- lib/clix_flash_player.rb
|
56
|
+
- lib/clix_wrapper.rb
|
41
57
|
- lib/sprout/flashplayer/version.rb
|
42
58
|
- lib/sprout/flashplayer.rb
|
43
|
-
- lib/sprout/tasks
|
44
59
|
- lib/sprout/tasks/flashplayer_task.rb
|
45
|
-
has_rdoc:
|
60
|
+
has_rdoc: true
|
46
61
|
homepage: http://www.projectsprouts.org
|
62
|
+
licenses: []
|
63
|
+
|
47
64
|
post_install_message:
|
48
65
|
rdoc_options: []
|
49
66
|
|
@@ -64,9 +81,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
81
|
requirements: []
|
65
82
|
|
66
83
|
rubyforge_project: sprout
|
67
|
-
rubygems_version: 1.3.
|
84
|
+
rubygems_version: 1.3.3
|
68
85
|
signing_key:
|
69
|
-
specification_version:
|
86
|
+
specification_version: 3
|
70
87
|
summary: Supporting tasks for Flash Player Rake integration
|
71
88
|
test_files: []
|
72
89
|
|