flashsdk 1.0.18.pre → 1.0.20.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/Gemfile.lock +3 -3
- data/POSTINSTALL.rdoc +3 -0
- data/VERSION +1 -1
- data/lib/flashplayer/system_mixins.rb +10 -0
- data/lib/flashplayer/task.rb +53 -3
- data/lib/flashsdk/fcsh.rb +11 -1
- data/lib/flashsdk/fcsh_socket.rb +8 -3
- data/lib/flashsdk/fdb.rb +7 -2
- data/lib/flashsdk/mxmlc.rb +14 -0
- data/test/fixtures/flashplayer/AsUnit Runner.swf +0 -0
- data/test/unit/amxmlc_test.rb +1 -1
- data/test/unit/fcsh_socket_test.rb +15 -1
- data/test/unit/fcsh_test.rb +1 -1
- data/test/unit/fdb_test.rb +4 -2
- data/test/unit/flashplayer_task_test.rb +7 -1
- data/test/unit/mxmlc_test.rb +1 -1
- metadata +8 -5
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -2,13 +2,13 @@ GEM
|
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
4
|
archive-tar-minitar (0.5.2)
|
5
|
-
mocha (0.9.
|
5
|
+
mocha (0.9.10)
|
6
6
|
rake
|
7
7
|
open4 (1.0.1)
|
8
8
|
rake (0.8.7)
|
9
9
|
rubyzip (0.9.4)
|
10
10
|
shoulda (2.11.3)
|
11
|
-
sprout (1.1.
|
11
|
+
sprout (1.1.10.pre)
|
12
12
|
archive-tar-minitar (= 0.5.2)
|
13
13
|
bundler (>= 0.9.19)
|
14
14
|
open4 (>= 0.9.6)
|
@@ -21,4 +21,4 @@ PLATFORMS
|
|
21
21
|
DEPENDENCIES
|
22
22
|
mocha
|
23
23
|
shoulda
|
24
|
-
sprout (>= 1.1.
|
24
|
+
sprout (>= 1.1.8.pre)
|
data/POSTINSTALL.rdoc
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.20.pre
|
@@ -63,6 +63,7 @@ module Sprout
|
|
63
63
|
class UnixSystem
|
64
64
|
|
65
65
|
def open_flashplayer_with exe, swf
|
66
|
+
player_open = false
|
66
67
|
trap("INT") {
|
67
68
|
close_flashplayer
|
68
69
|
@player_thread.kill
|
@@ -71,8 +72,17 @@ module Sprout
|
|
71
72
|
@player_thread = Thread.new {
|
72
73
|
require 'open4'
|
73
74
|
@player_pid, stdin, stdout, stderr = Open4.popen4("#{exe} #{swf}")
|
75
|
+
player_open = true
|
74
76
|
stdout.read
|
75
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
|
76
86
|
end
|
77
87
|
|
78
88
|
private
|
data/lib/flashplayer/task.rb
CHANGED
@@ -7,17 +7,22 @@ module FlashPlayer
|
|
7
7
|
attr_accessor :pkg_name
|
8
8
|
attr_accessor :pkg_version
|
9
9
|
|
10
|
+
attr_accessor :stdout
|
11
|
+
attr_accessor :stderr
|
12
|
+
|
10
13
|
##
|
11
14
|
# This is the Rake::Task constructor
|
12
15
|
# signature...
|
13
16
|
def initialize task_name, rake_application
|
14
17
|
super
|
15
|
-
@logger = $stdout
|
16
18
|
@mm_config = MMConfig.new
|
17
19
|
@reader = LogFile.new
|
18
20
|
@trust_config = Trust.new
|
19
21
|
@process = nil
|
20
22
|
@input = task_name
|
23
|
+
@stdout = $stdout
|
24
|
+
@stderr = $stderr
|
25
|
+
@logger = $stdout
|
21
26
|
|
22
27
|
@pkg_name = FlashPlayer::NAME
|
23
28
|
@pkg_version = FlashPlayer::VERSION
|
@@ -30,8 +35,13 @@ module FlashPlayer
|
|
30
35
|
update_mm_config
|
31
36
|
update_trust_config_with input
|
32
37
|
end
|
33
|
-
|
34
|
-
|
38
|
+
|
39
|
+
if use_fdb?
|
40
|
+
launch_fdb_and_player_with input
|
41
|
+
else
|
42
|
+
player_thread = launch_player_with input
|
43
|
+
tail_flashlog player_thread
|
44
|
+
end
|
35
45
|
end
|
36
46
|
|
37
47
|
def logger=(logger)
|
@@ -47,6 +57,46 @@ module FlashPlayer
|
|
47
57
|
|
48
58
|
private
|
49
59
|
|
60
|
+
def use_fdb?
|
61
|
+
# Check as string b/c this is
|
62
|
+
# how the boolean value comes
|
63
|
+
# accross the command line input.
|
64
|
+
ENV['USE_FDB'].to_s == 'true'
|
65
|
+
end
|
66
|
+
|
67
|
+
def launch_fdb_and_player_with input
|
68
|
+
# Keep getting a fatal lock error which I believe
|
69
|
+
# is being caused by the FlashPlayer and FDB attempting
|
70
|
+
# to write to stdout simultaneously.
|
71
|
+
# Trying to give fdb a fake stream until after the
|
72
|
+
# player is launched...
|
73
|
+
fake_out = Sprout::OutputBuffer.new
|
74
|
+
fake_err = Sprout::OutputBuffer.new
|
75
|
+
|
76
|
+
fdb_instance = FlashSDK::FDB.new
|
77
|
+
fdb_instance.stdout = fake_out
|
78
|
+
fdb_instance.stderr = fake_err
|
79
|
+
fdb_instance.execute false
|
80
|
+
fdb_instance.run
|
81
|
+
player_thread = launch_player_with input
|
82
|
+
|
83
|
+
# Emit whatever messages have been passed:
|
84
|
+
stdout.puts fake_out.read
|
85
|
+
stdout.flush
|
86
|
+
stderr.puts fake_err.read
|
87
|
+
stdout.flush
|
88
|
+
# Replace the fdb instance streams with
|
89
|
+
# the real ones:
|
90
|
+
fdb_instance.stdout = stdout
|
91
|
+
fdb_instance.stderr = stderr
|
92
|
+
|
93
|
+
# Let the user interact with fdb:
|
94
|
+
fdb_instance.handle_user_input
|
95
|
+
|
96
|
+
fdb_instance.wait
|
97
|
+
player_thread.join if player_thread.alive?
|
98
|
+
end
|
99
|
+
|
50
100
|
def execute_safely
|
51
101
|
begin
|
52
102
|
Thread.abort_on_exception = true
|
data/lib/flashsdk/fcsh.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
module FlashSDK
|
3
3
|
|
4
|
-
class FCSH < Sprout::
|
4
|
+
class FCSH < Sprout::Executable::Session
|
5
5
|
|
6
6
|
##
|
7
7
|
# The the Ruby file that will load the expected
|
@@ -61,6 +61,16 @@ module FlashSDK
|
|
61
61
|
# Exit FCSH
|
62
62
|
add_action :quit
|
63
63
|
|
64
|
+
|
65
|
+
def system_execute binary, params
|
66
|
+
params ||= ''
|
67
|
+
##
|
68
|
+
# Combine stdout and stderr for FCSH
|
69
|
+
# so that they both arrive on stdout
|
70
|
+
params << ' 2<&1'
|
71
|
+
super binary, params
|
72
|
+
end
|
73
|
+
|
64
74
|
end
|
65
75
|
end
|
66
76
|
|
data/lib/flashsdk/fcsh_socket.rb
CHANGED
@@ -41,7 +41,7 @@ module FlashSDK
|
|
41
41
|
Sprout.stdout.puts "FCSH socket open with: #{fcsh.pkg_name} and #{fcsh.pkg_version}, waiting for connections on port #{port}"
|
42
42
|
Sprout.stdout.puts ""
|
43
43
|
|
44
|
-
# Start up the FCSH
|
44
|
+
# Start up the FCSH Session:
|
45
45
|
fcsh.execute false
|
46
46
|
|
47
47
|
# Create a readable IO pipe:
|
@@ -72,6 +72,8 @@ module FlashSDK
|
|
72
72
|
fcsh.send method
|
73
73
|
end
|
74
74
|
|
75
|
+
fcsh.wait_for_prompt
|
76
|
+
|
75
77
|
if method == "clear"
|
76
78
|
clear_requests
|
77
79
|
end
|
@@ -111,7 +113,10 @@ module FlashSDK
|
|
111
113
|
session.close
|
112
114
|
end
|
113
115
|
end
|
114
|
-
|
116
|
+
|
117
|
+
if command.match /^mxmlc|^compc/
|
118
|
+
Sprout.stdout.puts "[FCSH] complete in #{(Time.now - start).seconds} seconds."
|
119
|
+
end
|
115
120
|
end
|
116
121
|
|
117
122
|
private
|
@@ -137,7 +142,7 @@ module FlashSDK
|
|
137
142
|
# indices.
|
138
143
|
|
139
144
|
new_requests = {}
|
140
|
-
@requests.
|
145
|
+
@requests.each do |item|
|
141
146
|
new_requests["removed-item"] = "removed-item"
|
142
147
|
end
|
143
148
|
@requests = new_requests
|
data/lib/flashsdk/fdb.rb
CHANGED
@@ -12,7 +12,7 @@ module FlashSDK
|
|
12
12
|
# SWF manually on the desktop or the browser - as long
|
13
13
|
# as you run it in a Debug Flash Player.
|
14
14
|
#
|
15
|
-
class FDB < Sprout::
|
15
|
+
class FDB < Sprout::Executable::Session
|
16
16
|
|
17
17
|
set :default_prefix, '-'
|
18
18
|
|
@@ -28,7 +28,7 @@ module FlashSDK
|
|
28
28
|
# The default executable target
|
29
29
|
set :executable, :fdb
|
30
30
|
|
31
|
-
set :prompt, /^\(fdb\) |\(y or n\) /
|
31
|
+
set :prompt, /^\(fdb\) |\(y or n\) |Waiting for Player to connect/
|
32
32
|
|
33
33
|
##
|
34
34
|
# Print a backtrace of all stack frames
|
@@ -765,3 +765,8 @@ def fdb *args, &block
|
|
765
765
|
fdb_tool
|
766
766
|
end
|
767
767
|
|
768
|
+
desc "Make subsequent FlashPlayer task(s) use FDB"
|
769
|
+
task :fdb do
|
770
|
+
ENV['USE_FDB'] = 'true'
|
771
|
+
end
|
772
|
+
|
data/lib/flashsdk/mxmlc.rb
CHANGED
@@ -76,6 +76,20 @@ module FlashSDK
|
|
76
76
|
#
|
77
77
|
set :executable, :mxmlc
|
78
78
|
|
79
|
+
def execute
|
80
|
+
start = Time.now
|
81
|
+
super
|
82
|
+
duration = (Time.now - start).seconds
|
83
|
+
Sprout.stdout.puts "[MXMLC] Compilation complete in #{duration} seconds." unless use_fcsh?
|
84
|
+
end
|
85
|
+
|
86
|
+
def use_fcsh?
|
87
|
+
# Check as string b/c this is
|
88
|
+
# how the boolean value comes
|
89
|
+
# accross the command line input.
|
90
|
+
ENV['USE_FCSH'].to_s == 'true'
|
91
|
+
end
|
92
|
+
|
79
93
|
end
|
80
94
|
end
|
81
95
|
|
File without changes
|
data/test/unit/amxmlc_test.rb
CHANGED
@@ -25,10 +25,10 @@ class AMXMLCTest < Test::Unit::TestCase
|
|
25
25
|
end
|
26
26
|
|
27
27
|
should "compile a swf" do
|
28
|
-
insert_fake_executable File.join(fixtures, 'sdk', 'mxmlc')
|
29
28
|
FileUtils.mkdir_p File.dirname(@expected_output)
|
30
29
|
|
31
30
|
amxmlc = FlashSDK::AMXMLC.new
|
31
|
+
amxmlc.binary_path = File.join fixtures, 'sdk', 'mxmlc'
|
32
32
|
amxmlc.input = @input
|
33
33
|
amxmlc.output = @expected_output
|
34
34
|
amxmlc.execute
|
@@ -6,28 +6,42 @@ class FCSHSocketTest < Test::Unit::TestCase
|
|
6
6
|
context "a new fcsh server" do
|
7
7
|
|
8
8
|
setup do
|
9
|
+
# Uncomment to see output:
|
9
10
|
#Sprout.stdout = $stdout
|
10
11
|
#Sprout.stderr = $stderr
|
12
|
+
|
11
13
|
@input = File.join(fixtures, 'mxmlc', 'simple', 'SomeFile.as')
|
14
|
+
@test_port = 12543
|
12
15
|
end
|
13
16
|
|
14
17
|
should "be instantiable" do
|
18
|
+
service_ready = false
|
19
|
+
# Create the remote side of the connection:
|
15
20
|
t = Thread.new do
|
16
21
|
Thread.current.abort_on_exception = true
|
17
22
|
server = FlashSDK::FCSHSocket.new
|
23
|
+
server.port = @test_port
|
24
|
+
service_ready = true
|
18
25
|
server.listen
|
19
26
|
end
|
20
27
|
|
21
|
-
|
28
|
+
# Wait for the remote connection to exist
|
29
|
+
while !service_ready
|
30
|
+
sleep 0.1
|
31
|
+
end
|
32
|
+
|
33
|
+
sleep 2.0
|
22
34
|
|
23
35
|
mxmlc = FlashSDK::MXMLC.new
|
24
36
|
mxmlc.input = @input
|
25
37
|
|
26
38
|
client = FlashSDK::FCSHSocket.new
|
39
|
+
client.port = @test_port
|
27
40
|
client.execute "mxmlc #{mxmlc.to_shell}"
|
28
41
|
FileUtils.touch @input
|
29
42
|
client.execute "mxmlc #{mxmlc.to_shell}"
|
30
43
|
client.execute "quit"
|
44
|
+
|
31
45
|
t.join
|
32
46
|
end
|
33
47
|
end
|
data/test/unit/fcsh_test.rb
CHANGED
@@ -31,7 +31,7 @@ class FCSHTest < Test::Unit::TestCase
|
|
31
31
|
fcsh.wait
|
32
32
|
|
33
33
|
expected_error_message = '1 Error: Syntax error: expecting rightbrace before end of program'
|
34
|
-
assert_matches /#{expected_error_message}/, Sprout.
|
34
|
+
assert_matches /#{expected_error_message}/, Sprout.stdout.read
|
35
35
|
end
|
36
36
|
|
37
37
|
should "spin up FCSH" do
|
data/test/unit/fdb_test.rb
CHANGED
@@ -6,9 +6,11 @@ class FDBTest < Test::Unit::TestCase
|
|
6
6
|
context "a new fdb task" do
|
7
7
|
|
8
8
|
setup do
|
9
|
+
path = File.join fixtures, 'sdk', 'fdb'
|
10
|
+
FlashSDK::FDB.any_instance.stubs(:binary_path).returns path
|
11
|
+
|
9
12
|
#Sprout.stdout = $stdout
|
10
13
|
#Sprout.stderr = $stderr
|
11
|
-
insert_fake_executable File.join(fixtures, 'sdk', 'fdb')
|
12
14
|
end
|
13
15
|
|
14
16
|
should "execute without shell params" do
|
@@ -37,7 +39,7 @@ class FDBTest < Test::Unit::TestCase
|
|
37
39
|
|
38
40
|
# NOTE: If this call raises, then the
|
39
41
|
# Executable.update_rake_task_name method
|
40
|
-
# must have changed, and the
|
42
|
+
# must have changed, and the Session override
|
41
43
|
# is no longer preventing non-File tasks
|
42
44
|
# from being added to the CLEAN collection.
|
43
45
|
#
|
@@ -14,14 +14,18 @@ class TaskTest < Test::Unit::TestCase
|
|
14
14
|
@swf = File.join(fixtures, 'flashplayer', 'AsUnit Runner.swf')
|
15
15
|
@missing_home = File.join(fixtures, 'missing_folder')
|
16
16
|
@config_path = File.join(@missing_home, 'fp_config', 'mm.cfg')
|
17
|
+
|
18
|
+
Sprout.stdout = $stdout
|
19
|
+
Sprout.stderr = $stderr
|
17
20
|
end
|
18
21
|
|
19
22
|
teardown do
|
20
23
|
remove_file @missing_home
|
24
|
+
ENV['USE_FDB'] = 'false'
|
21
25
|
end
|
22
26
|
|
23
|
-
=begin
|
24
27
|
## THIS METHOD WAS COMMENTED OUT....
|
28
|
+
=begin
|
25
29
|
should "wait for SWF even if clean system" do
|
26
30
|
# No creation of expected FlashPlayer folders...
|
27
31
|
|
@@ -30,6 +34,8 @@ class TaskTest < Test::Unit::TestCase
|
|
30
34
|
FlashPlayer::MMConfig.any_instance.stubs(:config_path).returns @config_path
|
31
35
|
FlashPlayer::MMConfig.any_instance.stubs(:user_confirmation?).returns false
|
32
36
|
|
37
|
+
ENV['USE_FDB'] = 'true'
|
38
|
+
|
33
39
|
as_a_mac_system do
|
34
40
|
t = flashplayer @swf
|
35
41
|
t.invoke
|
data/test/unit/mxmlc_test.rb
CHANGED
@@ -27,8 +27,8 @@ class MXMLCTest < Test::Unit::TestCase
|
|
27
27
|
end
|
28
28
|
|
29
29
|
should "compile a swf" do
|
30
|
-
insert_fake_executable File.join(fixtures, 'sdk', 'mxmlc')
|
31
30
|
mxmlc = FlashSDK::MXMLC.new
|
31
|
+
mxmlc.binary_path = File.join fixtures, 'sdk', 'mxmlc'
|
32
32
|
mxmlc.input = @input
|
33
33
|
mxmlc.execute
|
34
34
|
assert_file @expected_output
|
metadata
CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 20
|
9
9
|
- pre
|
10
|
-
version: 1.0.
|
10
|
+
version: 1.0.20.pre
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Luke Bayes
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-01-18 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -28,9 +28,9 @@ dependencies:
|
|
28
28
|
segments:
|
29
29
|
- 1
|
30
30
|
- 1
|
31
|
-
-
|
31
|
+
- 8
|
32
32
|
- pre
|
33
|
-
version: 1.1.
|
33
|
+
version: 1.1.8.pre
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: *id001
|
@@ -195,6 +195,9 @@ post_install_message: |+
|
|
195
195
|
++++++++++++++++++++++++++++++++
|
196
196
|
Issues or Questions?
|
197
197
|
|
198
|
+
Troubleshooting at:
|
199
|
+
http://projectsprouts.org/troubleshooting.html
|
200
|
+
|
198
201
|
Email us at:
|
199
202
|
projectsprouts@googlegroups.com
|
200
203
|
|