flashplayer 10.1.3.pre → 10.1.6.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/VERSION +1 -1
- data/lib/flashplayer/clix_wrapper.rb +1 -1
- data/lib/flashplayer/log_file.rb +24 -19
- data/lib/flashplayer/mm_config.rb +16 -8
- data/lib/flashplayer/module.rb +5 -1
- data/lib/flashplayer/task.rb +12 -2
- data/lib/flashplayer/trust.rb +2 -1
- data/test/unit/mm_config_test.rb +42 -15
- data/test/unit/task_test.rb +26 -1
- data/test/unit/trust_test.rb +4 -5
- metadata +4 -3
data/Gemfile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
10.1.
|
1
|
+
10.1.6.pre
|
@@ -17,6 +17,6 @@ begin
|
|
17
17
|
# Open the SWF:
|
18
18
|
Appscript.app(player).open(MacTypes::Alias.path(swf))
|
19
19
|
rescue LoadError => e
|
20
|
-
raise "\n\n[ERROR] You must install the rb-appscript gem to use the desktop debug Flash Player, you do this by running:\n\
|
20
|
+
raise "\n\n[ERROR] You must install the rb-appscript gem to use the desktop debug Flash Player, you do this by running:\n\ngem install rb-appscript"
|
21
21
|
end
|
22
22
|
|
data/lib/flashplayer/log_file.rb
CHANGED
@@ -6,12 +6,10 @@ module FlashPlayer
|
|
6
6
|
attr_accessor :logger
|
7
7
|
|
8
8
|
def initialize
|
9
|
-
@config = MMConfig.new
|
10
9
|
@logger = $stdout
|
11
10
|
end
|
12
11
|
|
13
12
|
def tail thread
|
14
|
-
@config.create
|
15
13
|
tail_path flashlog_path, thread
|
16
14
|
end
|
17
15
|
|
@@ -31,17 +29,7 @@ module FlashPlayer
|
|
31
29
|
trap("INT") { thread.kill }
|
32
30
|
|
33
31
|
while thread.alive? do
|
34
|
-
|
35
|
-
lines_read = 0
|
36
|
-
file.readlines.each do |line|
|
37
|
-
if(lines_read >= lines_put)
|
38
|
-
logger.puts "[trace] #{line}"
|
39
|
-
logger.flush
|
40
|
-
lines_put += 1
|
41
|
-
end
|
42
|
-
lines_read += 1
|
43
|
-
end
|
44
|
-
end
|
32
|
+
lines_put = read_from_file path, lines_put
|
45
33
|
logger.flush
|
46
34
|
sleep(0.2)
|
47
35
|
end
|
@@ -50,8 +38,27 @@ module FlashPlayer
|
|
50
38
|
logger.puts ">> Exiting from tailing '#{path}' at user request"
|
51
39
|
end
|
52
40
|
|
41
|
+
def read_from_file path, lines_put
|
42
|
+
File.open(path, 'r') do |file|
|
43
|
+
lines_read = 0
|
44
|
+
file.readlines.each do |line|
|
45
|
+
if(lines_read >= lines_put)
|
46
|
+
logger.puts "[trace] #{line}"
|
47
|
+
logger.flush
|
48
|
+
lines_put += 1
|
49
|
+
end
|
50
|
+
lines_read += 1
|
51
|
+
end
|
52
|
+
end unless !File.exists?(path)
|
53
|
+
lines_put
|
54
|
+
end
|
55
|
+
|
53
56
|
def flashlog_path
|
54
|
-
|
57
|
+
begin
|
58
|
+
FlashPlayer.flashlog
|
59
|
+
rescue FlashPlayer::PathError
|
60
|
+
"/dev/null"
|
61
|
+
end
|
55
62
|
end
|
56
63
|
|
57
64
|
def clear_flashlog_at path
|
@@ -71,9 +78,7 @@ module FlashPlayer
|
|
71
78
|
end
|
72
79
|
|
73
80
|
desc "Tail the flashlog.txt and block"
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
reader.tail
|
78
|
-
end
|
81
|
+
task :flashlog do
|
82
|
+
reader = FlashPlayer::LogFile.new
|
83
|
+
reader.tail
|
79
84
|
end
|
@@ -18,11 +18,9 @@ module FlashPlayer
|
|
18
18
|
private
|
19
19
|
|
20
20
|
def create_if_necessary_at path
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
def flashplayer_home
|
25
|
-
FlashPlayer.home
|
21
|
+
if(File.exists?(File.dirname(path)))
|
22
|
+
write_config(path, content(flashlog_path)) if(file_blank?(path))
|
23
|
+
end
|
26
24
|
end
|
27
25
|
|
28
26
|
def config_path
|
@@ -33,28 +31,38 @@ module FlashPlayer
|
|
33
31
|
end
|
34
32
|
end
|
35
33
|
|
34
|
+
def flashplayer_home
|
35
|
+
FlashPlayer.home
|
36
|
+
end
|
37
|
+
|
38
|
+
def flashlog_path
|
39
|
+
FlashPlayer.flashlog
|
40
|
+
end
|
41
|
+
|
36
42
|
def file_blank?(file)
|
37
43
|
!File.exists?(file) || File.read(file).empty?
|
38
44
|
end
|
39
45
|
|
40
46
|
def write_config(location, content)
|
41
47
|
if(user_confirmation?(location))
|
48
|
+
FileUtils.makedirs File.dirname(location)
|
49
|
+
|
42
50
|
File.open(location, 'w') do |f|
|
43
51
|
f.write(content)
|
44
52
|
end
|
45
53
|
logger.puts ">> Created file: " + File.expand_path(location)
|
46
54
|
location
|
47
55
|
else
|
48
|
-
raise FlashPlayer::PathError.new("Unable to create #{
|
56
|
+
raise FlashPlayer::PathError.new("Unable to create #{location}")
|
49
57
|
end
|
50
58
|
end
|
51
59
|
|
52
|
-
def content(
|
60
|
+
def content(flashlog)
|
53
61
|
return <<EOF
|
54
62
|
ErrorReportingEnable=1
|
55
63
|
MaxWarnings=0
|
56
64
|
TraceOutputEnable=1
|
57
|
-
TraceOutputFileName=#{
|
65
|
+
TraceOutputFileName=#{flashlog}
|
58
66
|
EOF
|
59
67
|
end
|
60
68
|
|
data/lib/flashplayer/module.rb
CHANGED
@@ -21,7 +21,11 @@ module FlashPlayer
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def trust
|
24
|
-
File.join
|
24
|
+
File.join home, '#Security', 'FlashPlayerTrust', 'sprout.cfg'
|
25
|
+
end
|
26
|
+
|
27
|
+
def flashlog
|
28
|
+
File.join home, 'Logs', 'flashlog.txt'
|
25
29
|
end
|
26
30
|
|
27
31
|
private
|
data/lib/flashplayer/task.rb
CHANGED
@@ -27,8 +27,10 @@ module FlashPlayer
|
|
27
27
|
super
|
28
28
|
#puts ">> invoke with: #{args} and input: #{input}"
|
29
29
|
update_input_if_necessary
|
30
|
-
|
31
|
-
|
30
|
+
execute_safely do
|
31
|
+
update_mm_config
|
32
|
+
update_trust_config_with input
|
33
|
+
end
|
32
34
|
player_thread = launch_player_with input
|
33
35
|
tail_flashlog player_thread
|
34
36
|
end
|
@@ -46,6 +48,14 @@ module FlashPlayer
|
|
46
48
|
|
47
49
|
private
|
48
50
|
|
51
|
+
def execute_safely
|
52
|
+
begin
|
53
|
+
yield if block_given?
|
54
|
+
rescue FlashPlayer::PathError => e
|
55
|
+
logger.puts ">> [WARNING] It seems this was the first time FlashPlayer was launched on this system and as a result, the expected folders were not found. Please close the Player and run again - this message should only ever be displayed once."
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
49
59
|
def update_input_if_necessary
|
50
60
|
return if input.match(/\.swf$/)
|
51
61
|
prerequisites.each do |prereq|
|
data/lib/flashplayer/trust.rb
CHANGED
data/test/unit/mm_config_test.rb
CHANGED
@@ -6,35 +6,62 @@ class MMConfigTest < Test::Unit::TestCase
|
|
6
6
|
context "An MMConfig" do
|
7
7
|
|
8
8
|
setup do
|
9
|
-
@
|
10
|
-
@
|
9
|
+
@home = File.join(fixtures, 'home')
|
10
|
+
@osx_fp = File.join(@home, 'Application Support', 'Macromedia')
|
11
|
+
@linux_fp = File.join(@home, '.macromedia', 'Flash_Player')
|
11
12
|
|
12
|
-
FileUtils.mkdir_p @
|
13
|
-
FlashPlayer::MMConfig.any_instance.stubs(:user_confirmation?).returns true
|
13
|
+
FileUtils.mkdir_p @home
|
14
14
|
|
15
15
|
@mm_config = FlashPlayer::MMConfig.new
|
16
|
+
@mm_config.stubs(:user_confirmation?).returns true
|
16
17
|
@mm_config.logger = StringIO.new
|
17
18
|
end
|
18
19
|
|
19
20
|
teardown do
|
20
|
-
remove_file @
|
21
|
+
remove_file @home
|
21
22
|
end
|
22
23
|
|
23
|
-
should "
|
24
|
-
|
24
|
+
should "ignore failure if flashplayer has never run" do
|
25
|
+
# No creation of expected FlashPlayer folders...
|
26
|
+
|
27
|
+
as_a_mac_system do
|
28
|
+
@mm_config.stubs(:system_library).returns @home
|
29
|
+
@mm_config.stubs(:flashplayer_home).returns @osx_fp
|
30
|
+
@mm_config.create
|
31
|
+
end
|
32
|
+
end
|
25
33
|
|
26
|
-
|
27
|
-
|
28
|
-
@
|
34
|
+
should "create a config file on OS X with FP 9" do
|
35
|
+
FileUtils.mkdir_p @osx_fp
|
36
|
+
flashlog = File.expand_path(File.join(@osx_fp, 'Logs', 'flashlog.txt'))
|
29
37
|
|
30
|
-
|
38
|
+
as_a_mac_system do
|
39
|
+
@mm_config.stubs(:system_library).returns @home
|
40
|
+
@mm_config.stubs(:flashplayer_home).returns @osx_fp
|
41
|
+
@mm_config.stubs(:flashlog_path).returns flashlog
|
42
|
+
@mm_config.create
|
43
|
+
mm_cfg = File.join(@osx_fp, mm_config_file)
|
44
|
+
assert_file mm_cfg do |content|
|
45
|
+
assert_matches /#{@flashlog}/, content
|
46
|
+
end
|
47
|
+
end
|
31
48
|
end
|
32
49
|
|
33
|
-
should "create a config file on
|
34
|
-
|
35
|
-
@
|
50
|
+
should "create a config file on linux" do
|
51
|
+
FileUtils.mkdir_p @linux_fp
|
52
|
+
flashlog = File.expand_path(File.join(@linux_fp, 'Logs', 'flashlog.txt'))
|
36
53
|
|
37
|
-
|
54
|
+
as_a_unix_system do
|
55
|
+
@mm_config.stubs(:system_library).returns @home
|
56
|
+
@mm_config.stubs(:system_home).returns @home
|
57
|
+
@mm_config.stubs(:flashlog_path).returns flashlog
|
58
|
+
@mm_config.stubs(:flashplayer_home).returns @linux_fp
|
59
|
+
@mm_config.create
|
60
|
+
mm_cfg = File.join(@home, mm_config_file)
|
61
|
+
assert_file mm_cfg do |content|
|
62
|
+
assert_matches /#{flashlog}/, content
|
63
|
+
end
|
64
|
+
end
|
38
65
|
end
|
39
66
|
end
|
40
67
|
|
data/test/unit/task_test.rb
CHANGED
@@ -11,9 +11,31 @@ class FlashPlayerTaskTest < Test::Unit::TestCase
|
|
11
11
|
# Executable.clear_entities! but 'require'
|
12
12
|
# only runs once per VM run...
|
13
13
|
load 'flashplayer/specification.rb'
|
14
|
-
@swf
|
14
|
+
@swf = File.join(fixtures, 'AsUnit4.swf')
|
15
|
+
@missing_home = File.join(fixtures, 'missing_folder')
|
16
|
+
@config_path = File.join(@missing_home, 'fp_config', 'mm.cfg')
|
15
17
|
end
|
16
18
|
|
19
|
+
teardown do
|
20
|
+
remove_file @missing_home
|
21
|
+
end
|
22
|
+
|
23
|
+
=begin
|
24
|
+
should "wait for SWF even if clean system" do
|
25
|
+
# No creation of expected FlashPlayer folders...
|
26
|
+
|
27
|
+
FlashPlayer.stubs(:home).returns @missing_home
|
28
|
+
FlashPlayer::MMConfig.any_instance.stubs(:system_home).returns @missing_home
|
29
|
+
FlashPlayer::MMConfig.any_instance.stubs(:config_path).returns @config_path
|
30
|
+
FlashPlayer::MMConfig.any_instance.stubs(:user_confirmation?).returns false
|
31
|
+
|
32
|
+
as_a_mac_system do
|
33
|
+
t = flashplayer @swf
|
34
|
+
t.invoke
|
35
|
+
end
|
36
|
+
end
|
37
|
+
=end
|
38
|
+
|
17
39
|
should "work with swf as task name" do
|
18
40
|
t = flashplayer @swf
|
19
41
|
configure_task t
|
@@ -24,6 +46,7 @@ class FlashPlayerTaskTest < Test::Unit::TestCase
|
|
24
46
|
t = flashplayer :run do |t|
|
25
47
|
t.input = @swf
|
26
48
|
end
|
49
|
+
file @swf
|
27
50
|
configure_task t
|
28
51
|
t.invoke
|
29
52
|
assert_equal @swf, t.input
|
@@ -31,6 +54,7 @@ class FlashPlayerTaskTest < Test::Unit::TestCase
|
|
31
54
|
|
32
55
|
should "work with swf as prerequisite" do
|
33
56
|
t = flashplayer :run => @swf
|
57
|
+
file @swf
|
34
58
|
configure_task t
|
35
59
|
t.invoke
|
36
60
|
assert_equal @swf, t.input
|
@@ -38,6 +62,7 @@ class FlashPlayerTaskTest < Test::Unit::TestCase
|
|
38
62
|
|
39
63
|
should "fire when declared as a dependency" do
|
40
64
|
t = flashplayer :run => @swf
|
65
|
+
file @swf
|
41
66
|
configure_task t
|
42
67
|
other = task :parent => :run
|
43
68
|
other.invoke
|
data/test/unit/trust_test.rb
CHANGED
@@ -6,11 +6,10 @@ class TrustTest < Test::Unit::TestCase
|
|
6
6
|
context "A Trust instance" do
|
7
7
|
|
8
8
|
setup do
|
9
|
-
@fixture
|
10
|
-
@file
|
11
|
-
@project
|
12
|
-
|
13
|
-
@trust = FlashPlayer::Trust.new
|
9
|
+
@fixture = File.join fixtures, 'trust'
|
10
|
+
@file = File.join @fixture, 'trust.cfg'
|
11
|
+
@project = File.join fixtures, 'SomeProject'
|
12
|
+
@trust = FlashPlayer::Trust.new
|
14
13
|
@trust.logger = StringIO.new
|
15
14
|
@trust.stubs(:trust_file).returns @file
|
16
15
|
end
|
metadata
CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 10
|
7
7
|
- 1
|
8
|
-
-
|
8
|
+
- 6
|
9
9
|
- pre
|
10
|
-
version: 10.1.
|
10
|
+
version: 10.1.6.pre
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Luke Bayes
|
@@ -27,8 +27,9 @@ dependencies:
|
|
27
27
|
segments:
|
28
28
|
- 1
|
29
29
|
- 0
|
30
|
+
- 11
|
30
31
|
- pre
|
31
|
-
version: 1.0.pre
|
32
|
+
version: 1.0.11.pre
|
32
33
|
type: :runtime
|
33
34
|
prerelease: false
|
34
35
|
version_requirements: *id001
|