flashsdk 1.0.14.pre → 1.0.15.pre
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 +1 -1
- data/VERSION +1 -1
- data/lib/flashsdk/compc.rb +31 -1
- data/lib/flashsdk/compiler_base.rb +22 -3
- data/lib/flashsdk/fcsh.rb +98 -0
- data/lib/flashsdk/fcsh_socket.rb +148 -0
- data/lib/flashsdk/generators/templates/rakefile.rb +30 -2
- data/lib/flashsdk.rb +1 -0
- data/test/fixtures/mxmlc/broken/SomeFile.as +10 -0
- data/test/fixtures/sdk/fdb +48 -20
- data/test/unit/fcsh_socket_test.rb +35 -0
- data/test/unit/fcsh_test.rb +23 -3
- data/test/unit/fdb_test.rb +3 -0
- metadata +8 -8
- data/lib/flashsdk/fcsh_client.rb +0 -36
- data/test-stderr.log +0 -1
- data/test-stdout.log +0 -58
data/Gemfile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.15.pre
|
data/lib/flashsdk/compc.rb
CHANGED
@@ -1,15 +1,32 @@
|
|
1
1
|
module FlashSDK
|
2
2
|
|
3
|
+
##
|
4
|
+
# The COMPC compiler is a tool that creates SWC libraries from source code.
|
5
|
+
#
|
6
|
+
# Following is an example of the creation of a simple SWC file:
|
7
|
+
#
|
8
|
+
# compc 'bin/SomeProject.swc' do |t|
|
9
|
+
# t.include_classes << 'SomeProject'
|
10
|
+
# t.source_path << 'src'
|
11
|
+
# end
|
12
|
+
#
|
13
|
+
# desc 'Compile the SWC'
|
14
|
+
# task :swc => 'bin/SomeProject.swc'
|
15
|
+
#
|
3
16
|
class COMPC < CompilerBase
|
4
17
|
|
5
18
|
##
|
6
|
-
# Outputs the SWC
|
19
|
+
# Outputs the SWC content as a SWF into an open directory format rather than a SWC file.
|
20
|
+
#
|
21
|
+
# This is especially useful for creating Runtime Shared Libraries.
|
7
22
|
#
|
8
23
|
# compc "bin/rsls/foo" do |t|
|
9
24
|
# t.directory = true
|
10
25
|
# t.include_sources = 'src'
|
11
26
|
# end
|
12
27
|
#
|
28
|
+
# @see Sprout::COMPC#include_sources
|
29
|
+
#
|
13
30
|
add_param :directory, Boolean
|
14
31
|
|
15
32
|
##
|
@@ -56,6 +73,13 @@ module FlashSDK
|
|
56
73
|
#
|
57
74
|
# If you specify a directory, this option includes all files with an MXML or AS extension, and ignores all other files.
|
58
75
|
#
|
76
|
+
# compc "bin/SomeProject.swc" do |t|
|
77
|
+
# t.include_sources << 'src'
|
78
|
+
# t.library_path << 'lib/somelib.swc'
|
79
|
+
# end
|
80
|
+
#
|
81
|
+
# You'll need to be sure your source path and library path are both set up properly for this work.
|
82
|
+
#
|
59
83
|
add_param :include_sources, Paths
|
60
84
|
|
61
85
|
##
|
@@ -63,6 +87,12 @@ module FlashSDK
|
|
63
87
|
#
|
64
88
|
add_param :namespace, String
|
65
89
|
|
90
|
+
##
|
91
|
+
# Main source Class to send compiler.
|
92
|
+
# If used, this should be the last item in the list
|
93
|
+
add_param :input_class, String, { :hidden_name => true }
|
94
|
+
|
95
|
+
|
66
96
|
##
|
67
97
|
# The the Ruby file that will load the expected
|
68
98
|
# Sprout::Specification.
|
@@ -638,6 +638,19 @@ module FlashSDK
|
|
638
638
|
#
|
639
639
|
attr_accessor :use_fcsh
|
640
640
|
|
641
|
+
##
|
642
|
+
# The FCSH port to use for connections. If you are building from
|
643
|
+
# multiple different directories, you will need to start up the
|
644
|
+
# FCSH servers on different ports. This can be done like:
|
645
|
+
#
|
646
|
+
# rake fcsh:start FCSH_PORT=12322
|
647
|
+
#
|
648
|
+
# and in another terminal:
|
649
|
+
#
|
650
|
+
# rake fcsh mxmlc FCSH_PORT=12322
|
651
|
+
#
|
652
|
+
attr_accessor :fcsh_port
|
653
|
+
|
641
654
|
##
|
642
655
|
# Temporary override while waiting for integration of next version!
|
643
656
|
# TODO: Remove this method override.
|
@@ -666,7 +679,7 @@ module FlashSDK
|
|
666
679
|
end
|
667
680
|
|
668
681
|
##
|
669
|
-
#
|
682
|
+
# override
|
670
683
|
def prepare
|
671
684
|
# Check for USE_FCSH on the environment
|
672
685
|
# variable hash, update instance value
|
@@ -674,17 +687,23 @@ module FlashSDK
|
|
674
687
|
if ENV['USE_FCSH'].to_s == 'true'
|
675
688
|
self.use_fcsh = true
|
676
689
|
end
|
690
|
+
|
691
|
+
if !ENV['FCSH_PORT'].nil?
|
692
|
+
self.fcsh_port = ENV['FCSH_PORT']
|
693
|
+
end
|
694
|
+
|
677
695
|
super
|
678
696
|
end
|
679
697
|
|
680
698
|
##
|
681
|
-
#
|
699
|
+
# override
|
682
700
|
def execute_delegate
|
683
701
|
(use_fcsh) ? execute_with_fcsh : super
|
684
702
|
end
|
685
703
|
|
686
704
|
def execute_with_fcsh
|
687
|
-
|
705
|
+
client = FlashSDK::FCSHSocket.new
|
706
|
+
client.execute "#{executable.to_s} #{to_shell}", ENV['FCSH_PORT']
|
688
707
|
end
|
689
708
|
|
690
709
|
end
|
data/lib/flashsdk/fcsh.rb
CHANGED
@@ -60,6 +60,104 @@ module FlashSDK
|
|
60
60
|
##
|
61
61
|
# Exit FCSH
|
62
62
|
add_action :quit
|
63
|
+
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
##
|
68
|
+
# Rake task that will make any subsequent
|
69
|
+
# mxmlc or compc tasks use the FCSH compiler.
|
70
|
+
#
|
71
|
+
# You can use this task by inserting it
|
72
|
+
# before the task you're calling on the
|
73
|
+
# command line like:
|
74
|
+
#
|
75
|
+
# rake fcsh test
|
76
|
+
#
|
77
|
+
# or:
|
78
|
+
#
|
79
|
+
# rake fcsh debug
|
80
|
+
#
|
81
|
+
# Or you can add this task as a prerequisite
|
82
|
+
# to your build tasks directly like:
|
83
|
+
#
|
84
|
+
# mxmlc 'bin/SomeProject.swf' => :fcsh do |t|
|
85
|
+
# ...
|
86
|
+
# end
|
87
|
+
#
|
88
|
+
desc "Make subsequent MXMLC or COMPC tasks use FCSH"
|
89
|
+
task :fcsh do
|
90
|
+
ENV['USE_FCSH'] = 'true'
|
91
|
+
end
|
92
|
+
|
93
|
+
##
|
94
|
+
# Rake task that will make any subsequent
|
95
|
+
# mxmlc or compc tasks use the FCSH compiler.
|
96
|
+
#
|
97
|
+
# You can use this task by inserting it
|
98
|
+
# before the task you're calling on the
|
99
|
+
# command line like:
|
100
|
+
#
|
101
|
+
# rake fcsh test
|
102
|
+
#
|
103
|
+
# or:
|
104
|
+
#
|
105
|
+
# rake fcsh debug
|
106
|
+
#
|
107
|
+
# Or you can add this task as a prerequisite
|
108
|
+
# to your build tasks directly like:
|
109
|
+
#
|
110
|
+
# mxmlc 'bin/SomeProject.swf' => :fcsh do |t|
|
111
|
+
# ...
|
112
|
+
# end
|
113
|
+
#
|
114
|
+
desc "Make subsequent MXMLC or COMPC tasks use FCSH"
|
115
|
+
task :fcsh do
|
116
|
+
ENV['USE_FCSH'] = 'true'
|
117
|
+
end
|
118
|
+
##
|
119
|
+
# Rake task that will make any subsequent
|
120
|
+
# mxmlc or compc tasks use the FCSH compiler.
|
121
|
+
#
|
122
|
+
# You can use this task by inserting it
|
123
|
+
# before the task you're calling on the
|
124
|
+
# command line like:
|
125
|
+
#
|
126
|
+
# rake fcsh test
|
127
|
+
#
|
128
|
+
# or:
|
129
|
+
#
|
130
|
+
# rake fcsh debug
|
131
|
+
#
|
132
|
+
# Or you can add this task as a prerequisite
|
133
|
+
# to your build tasks directly like:
|
134
|
+
#
|
135
|
+
# mxmlc 'bin/SomeProject.swf' => :fcsh do |t|
|
136
|
+
# ...
|
137
|
+
# end
|
138
|
+
#
|
139
|
+
desc "Make subsequent MXMLC or COMPC tasks use FCSH"
|
140
|
+
task :fcsh do
|
141
|
+
ENV['USE_FCSH'] = 'true'
|
142
|
+
end
|
143
|
+
|
144
|
+
namespace :fcsh do
|
145
|
+
desc "Start the FCSH server"
|
146
|
+
task :start do
|
147
|
+
server = FlashSDK::FCSHSocket.new
|
148
|
+
server.listen ENV['FCSH_PKG_NAME'], ENV['FCSH_PKG_VERSION'], ENV['FCSH_PORT']
|
149
|
+
end
|
150
|
+
|
151
|
+
desc "Clear the cached compilation data"
|
152
|
+
task :clear do
|
153
|
+
client = FlashSDK::FCSHSocket.new
|
154
|
+
client.execute "clear", ENV['FCSH_PORT']
|
155
|
+
end
|
156
|
+
|
157
|
+
desc "Quit the fcsh server"
|
158
|
+
task :quit do
|
159
|
+
client = FlashSDK::FCSHSocket.new
|
160
|
+
client.execute "quit", ENV['FCSH_PORT']
|
63
161
|
end
|
64
162
|
end
|
65
163
|
|
@@ -0,0 +1,148 @@
|
|
1
|
+
|
2
|
+
module FlashSDK
|
3
|
+
|
4
|
+
##
|
5
|
+
# This is a client to the long-running FCSH process.
|
6
|
+
#
|
7
|
+
# The server side of this connection should be
|
8
|
+
# started before starting the client.
|
9
|
+
#
|
10
|
+
# To do this, just open a new terminal, cd into your
|
11
|
+
# project directory, and run:
|
12
|
+
#
|
13
|
+
# rake fcsh:start
|
14
|
+
#
|
15
|
+
class FCSHSocket
|
16
|
+
|
17
|
+
##
|
18
|
+
# The default TCP port that FCSH will use
|
19
|
+
# to connect.
|
20
|
+
DEFAULT_PORT = 12321
|
21
|
+
|
22
|
+
attr_accessor :port
|
23
|
+
|
24
|
+
attr_reader :requests
|
25
|
+
|
26
|
+
##
|
27
|
+
# Create a new FCSHClient
|
28
|
+
def initialize
|
29
|
+
@port = DEFAULT_PORT
|
30
|
+
@requests = {}
|
31
|
+
end
|
32
|
+
|
33
|
+
def listen pkg_name=nil, pkg_version=nil, port=nil
|
34
|
+
port = port || @port
|
35
|
+
# Instantiate FCSH:
|
36
|
+
fcsh = FlashSDK::FCSH.new
|
37
|
+
fcsh.pkg_name = pkg_name unless pkg_name.nil?
|
38
|
+
fcsh.pkg_version = pkg_version unless pkg_version.nil?
|
39
|
+
|
40
|
+
# Notify the outer shell that we're ready:
|
41
|
+
Sprout.stdout.puts "FCSH socket open with: #{fcsh.pkg_name} and #{fcsh.pkg_version}, waiting for connections on port #{port}"
|
42
|
+
Sprout.stdout.puts ""
|
43
|
+
|
44
|
+
# Start up the FCSH Daemon:
|
45
|
+
fcsh.execute false
|
46
|
+
|
47
|
+
# Create a readable IO pipe:
|
48
|
+
output = Sprout::OutputBuffer.new
|
49
|
+
# Associate the IO pipe with our
|
50
|
+
# outputs so that FCSH will write
|
51
|
+
# to it.
|
52
|
+
Sprout.stdout = output
|
53
|
+
Sprout.stderr = output
|
54
|
+
|
55
|
+
server = TCPServer.new 'localhost', port
|
56
|
+
|
57
|
+
# Create a thread that will exit
|
58
|
+
# when FCSH exits.
|
59
|
+
t = Thread.new do
|
60
|
+
fcsh.wait
|
61
|
+
end
|
62
|
+
|
63
|
+
while t.alive? do
|
64
|
+
Sprout.stdout.puts ""
|
65
|
+
session = server.accept
|
66
|
+
rendered = render_request session.gets
|
67
|
+
parts = rendered.split(" ")
|
68
|
+
method = parts.shift.strip
|
69
|
+
if parts.size > 0
|
70
|
+
fcsh.send method, parts.join(" ")
|
71
|
+
else
|
72
|
+
fcsh.send method
|
73
|
+
end
|
74
|
+
|
75
|
+
if method == "clear"
|
76
|
+
clear_requests
|
77
|
+
end
|
78
|
+
|
79
|
+
response = output.read
|
80
|
+
session.puts response.gsub(fcsh.prompt, "\n")
|
81
|
+
session.flush
|
82
|
+
session.close
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def execute command, port=nil
|
87
|
+
start = Time.now
|
88
|
+
port = port || @port
|
89
|
+
begin
|
90
|
+
session = TCPSocket.new 'localhost', port
|
91
|
+
session.puts command
|
92
|
+
response = session.read
|
93
|
+
if response.match /Error/
|
94
|
+
raise Sprout::Errors::UsageError.new "[FCSH] #{response}"
|
95
|
+
else
|
96
|
+
Sprout.stdout.puts "[FCSH] #{response}"
|
97
|
+
end
|
98
|
+
response
|
99
|
+
rescue Errno::ECONNREFUSED => e
|
100
|
+
message = "[ERROR] "
|
101
|
+
message << e.message
|
102
|
+
message << ": Could not connect to an FCSH server on port: #{port} at: #{Dir.pwd}.\n\n"
|
103
|
+
message << "This is probably because one has not been started. To start a new FCSH server, open a new "
|
104
|
+
message << "terminal and run the following:\n\n"
|
105
|
+
message << "cd #{Dir.pwd}\n"
|
106
|
+
message << "rake fcsh:start\n"
|
107
|
+
raise Sprout::Errors::UsageError.new message
|
108
|
+
ensure
|
109
|
+
if !session.nil? && !session.closed?
|
110
|
+
session.flush
|
111
|
+
session.close
|
112
|
+
end
|
113
|
+
end
|
114
|
+
Sprout.stdout.puts "[FCSH] Compilation complete in #{(Time.now - start).seconds} seconds."
|
115
|
+
end
|
116
|
+
|
117
|
+
private
|
118
|
+
|
119
|
+
def render_request request
|
120
|
+
hash = Digest::MD5.hexdigest request
|
121
|
+
if request.match /^mxmlc|^compc/
|
122
|
+
if requests[hash].nil?
|
123
|
+
requests[hash] = requests.size + 1
|
124
|
+
request
|
125
|
+
else
|
126
|
+
"compile #{requests[hash]}"
|
127
|
+
end
|
128
|
+
else
|
129
|
+
request
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
def clear_requests
|
134
|
+
# Clear the cached requests,
|
135
|
+
# but leave them in place, the underlying
|
136
|
+
# FCSH implementation continues incrementing
|
137
|
+
# indices.
|
138
|
+
|
139
|
+
new_requests = {}
|
140
|
+
@requests.each_key do |key|
|
141
|
+
new_requests["removed-item"] = "removed-item"
|
142
|
+
end
|
143
|
+
@requests = new_requests
|
144
|
+
end
|
145
|
+
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
@@ -6,6 +6,23 @@ require 'rake/clean'
|
|
6
6
|
require 'flashsdk'
|
7
7
|
require 'asunit4'
|
8
8
|
|
9
|
+
##
|
10
|
+
# Set USE_FCSH to true in order to use FCSH for all compile tasks.
|
11
|
+
#
|
12
|
+
# You can also set this value by calling the :fcsh task
|
13
|
+
# manually like:
|
14
|
+
#
|
15
|
+
# rake fcsh run
|
16
|
+
#
|
17
|
+
# These values can also be sent from the command line like:
|
18
|
+
#
|
19
|
+
# rake run FCSH_PKG_NAME=flex3
|
20
|
+
#
|
21
|
+
# ENV['USE_FCSH'] = true
|
22
|
+
# ENV['FCSH_PKG_NAME'] = 'flex4'
|
23
|
+
# ENV['FCSH_PKG_VERSION'] = '1.0.14.pre'
|
24
|
+
# ENV['FCSH_PORT'] = 12321
|
25
|
+
|
9
26
|
##############################
|
10
27
|
# Debug
|
11
28
|
|
@@ -16,7 +33,18 @@ mxmlc "<%= bin %>/<%= debug_swf_name %>" do |t|
|
|
16
33
|
end
|
17
34
|
|
18
35
|
desc "Compile and run the debug swf"
|
19
|
-
flashplayer :
|
36
|
+
flashplayer :run => "<%= bin %>/<%= debug_swf_name %>"
|
37
|
+
|
38
|
+
##############################
|
39
|
+
# SWC
|
40
|
+
|
41
|
+
compc "<%= bin %>/<%= class_name %>.swc" do |t|
|
42
|
+
t.input_class = "<%= class_name %>"
|
43
|
+
t.source_path << 'src'
|
44
|
+
end
|
45
|
+
|
46
|
+
desc "Compile the SWC file"
|
47
|
+
task :swc => '<%= bin %>/<%= class_name %>.swc'
|
20
48
|
|
21
49
|
##############################
|
22
50
|
# Test
|
@@ -33,5 +61,5 @@ end
|
|
33
61
|
desc "Compile and run the test swf"
|
34
62
|
flashplayer :test => "<%= bin %>/<%= test_swf_name %>"
|
35
63
|
|
36
|
-
task :default => :
|
64
|
+
task :default => :run
|
37
65
|
|
data/lib/flashsdk.rb
CHANGED
@@ -9,6 +9,7 @@ require 'flashsdk/generators/class_generator'
|
|
9
9
|
require 'flashsdk/generators/project_generator'
|
10
10
|
require 'flashsdk/generators/flex_project_generator'
|
11
11
|
require 'flashsdk/fcsh'
|
12
|
+
require 'flashsdk/fcsh_socket'
|
12
13
|
require 'flashsdk/compiler_base'
|
13
14
|
require 'flashsdk/mxmlc'
|
14
15
|
require 'flashsdk/compc'
|
data/test/fixtures/sdk/fdb
CHANGED
@@ -1,9 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
##
|
4
|
-
# This is a Fake executable that will behave
|
5
|
-
# exactly like a real FDB executable for a
|
6
|
-
# specific, expected set of steps.
|
7
3
|
class FakeFDB
|
8
4
|
|
9
5
|
def initialize
|
@@ -17,22 +13,33 @@ class FakeFDB
|
|
17
13
|
def gather_input
|
18
14
|
$stdout.flush
|
19
15
|
command = $stdin.gets.chomp!
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
16
|
+
parts = command.split(' ')
|
17
|
+
name = parts.shift
|
18
|
+
|
19
|
+
case name
|
20
|
+
when "run"
|
21
|
+
handle_run parts
|
22
|
+
when "break"
|
23
|
+
handle_break parts
|
24
|
+
when "continue"
|
25
|
+
handle_continue parts
|
26
|
+
when "kill"
|
27
|
+
handle_kill parts
|
28
|
+
when "y"
|
29
|
+
handle_confirmation parts
|
30
|
+
when "quit"
|
31
|
+
handle_quit parts
|
32
|
+
when "run_with_error"
|
33
|
+
handle_run_with_error parts
|
28
34
|
else
|
29
|
-
puts ""
|
30
|
-
|
35
|
+
puts "FAKE FDB doesn't know how to respond to #{command}"
|
36
|
+
exit 1
|
31
37
|
end
|
38
|
+
|
32
39
|
gather_input
|
33
40
|
end
|
34
41
|
|
35
|
-
def handle_run
|
42
|
+
def handle_run args
|
36
43
|
str = "Waiting for Player to connect\n"
|
37
44
|
str << "Player connected; session starting.\n"
|
38
45
|
str << "Set breakpoints and then type 'continue' to resume the session.\n"
|
@@ -41,22 +48,43 @@ class FakeFDB
|
|
41
48
|
printf str
|
42
49
|
end
|
43
50
|
|
44
|
-
def
|
51
|
+
def handle_break args
|
45
52
|
str = "Breakpoint 1, AsUnitRunner() at AsUnitRunner.as:12\n"
|
46
53
|
str << "12 core = new TextCore();\n"
|
47
54
|
str << "(fdb) "
|
48
55
|
printf str
|
49
56
|
end
|
50
57
|
|
51
|
-
def
|
58
|
+
def handle_continue args
|
59
|
+
str = "Continuing now\n"
|
60
|
+
str << "(fdb) "
|
61
|
+
printf str
|
62
|
+
end
|
63
|
+
|
64
|
+
def handle_kill args
|
52
65
|
printf "Kill the program being debugged? (y or n) "
|
53
66
|
end
|
54
67
|
|
55
|
-
def
|
56
|
-
|
68
|
+
def handle_confirmation args
|
69
|
+
str = "Confirmation accepted\n"
|
70
|
+
str << "(fdb) "
|
71
|
+
printf str
|
72
|
+
end
|
73
|
+
|
74
|
+
def handle_run_with_error args
|
75
|
+
str = "This is an error!\n"
|
76
|
+
str << "This is more details about the error!\n"
|
77
|
+
str << "Here are even more details!\n"
|
78
|
+
$stderr.printf str
|
79
|
+
printf "(fdb) "
|
80
|
+
end
|
81
|
+
|
82
|
+
def handle_quit args
|
83
|
+
puts ">> EXITING NOW!\n"
|
84
|
+
exit! 0
|
57
85
|
end
|
58
86
|
|
59
87
|
end
|
60
88
|
|
61
|
-
|
89
|
+
fake_fdb = FakeFDB.new
|
62
90
|
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class FCSHSocketTest < Test::Unit::TestCase
|
4
|
+
include Sprout::TestHelper
|
5
|
+
|
6
|
+
context "a new fcsh server" do
|
7
|
+
|
8
|
+
setup do
|
9
|
+
#Sprout.stdout = $stdout
|
10
|
+
#Sprout.stderr = $stderr
|
11
|
+
@input = File.join(fixtures, 'mxmlc', 'simple', 'SomeFile.as')
|
12
|
+
end
|
13
|
+
|
14
|
+
should "be instantiable" do
|
15
|
+
t = Thread.new do
|
16
|
+
Thread.current.abort_on_exception = true
|
17
|
+
server = FlashSDK::FCSHSocket.new
|
18
|
+
server.listen
|
19
|
+
end
|
20
|
+
|
21
|
+
sleep(3)
|
22
|
+
|
23
|
+
mxmlc = FlashSDK::MXMLC.new
|
24
|
+
mxmlc.input = @input
|
25
|
+
|
26
|
+
client = FlashSDK::FCSHSocket.new
|
27
|
+
client.execute "mxmlc #{mxmlc.to_shell}"
|
28
|
+
FileUtils.touch @input
|
29
|
+
client.execute "mxmlc #{mxmlc.to_shell}"
|
30
|
+
client.execute "quit"
|
31
|
+
t.join
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
data/test/unit/fcsh_test.rb
CHANGED
@@ -6,15 +6,34 @@ class FCSHTest < Test::Unit::TestCase
|
|
6
6
|
context "associate FCSH with an MXMLC task" do
|
7
7
|
|
8
8
|
setup do
|
9
|
-
@fixture = File.join fixtures, 'mxmlc'
|
10
|
-
@input = File.join @fixture, 'SomeFile.as'
|
11
|
-
@
|
9
|
+
@fixture = File.join fixtures, 'mxmlc'
|
10
|
+
@input = File.join @fixture, 'simple', 'SomeFile.as'
|
11
|
+
@broken_input = File.join @fixture, 'broken', 'SomeFile.as'
|
12
|
+
@expected_output = File.join @fixture, 'simple', 'SomeFile.swf'
|
13
|
+
|
14
|
+
# Uncomment following to see output:
|
15
|
+
#Sprout.stdout = $stdout
|
16
|
+
#Sprout.stderr = $stderr
|
12
17
|
end
|
13
18
|
|
14
19
|
teardown do
|
15
20
|
remove_file @expected_output
|
16
21
|
end
|
17
22
|
|
23
|
+
should "collect errors as needed" do
|
24
|
+
mxmlc = FlashSDK::MXMLC.new
|
25
|
+
mxmlc.input = @broken_input
|
26
|
+
|
27
|
+
fcsh = FlashSDK::FCSH.new
|
28
|
+
fcsh.execute false
|
29
|
+
fcsh.mxmlc mxmlc.to_shell
|
30
|
+
fcsh.quit
|
31
|
+
fcsh.wait
|
32
|
+
|
33
|
+
expected_error_message = '1 Error: Syntax error: expecting rightbrace before end of program'
|
34
|
+
assert_matches /#{expected_error_message}/, Sprout.stderr.read
|
35
|
+
end
|
36
|
+
|
18
37
|
should "spin up FCSH" do
|
19
38
|
mxmlc = FlashSDK::MXMLC.new
|
20
39
|
mxmlc.input = @input
|
@@ -22,6 +41,7 @@ class FCSHTest < Test::Unit::TestCase
|
|
22
41
|
fcsh = FlashSDK::FCSH.new
|
23
42
|
fcsh.execute false
|
24
43
|
fcsh.mxmlc mxmlc.to_shell
|
44
|
+
|
25
45
|
FileUtils.touch @input
|
26
46
|
fcsh.compile 1
|
27
47
|
fcsh.quit
|
data/test/unit/fdb_test.rb
CHANGED
@@ -6,6 +6,8 @@ class FDBTest < Test::Unit::TestCase
|
|
6
6
|
context "a new fdb task" do
|
7
7
|
|
8
8
|
setup do
|
9
|
+
#Sprout.stdout = $stdout
|
10
|
+
#Sprout.stderr = $stderr
|
9
11
|
insert_fake_executable File.join(fixtures, 'sdk', 'fdb')
|
10
12
|
end
|
11
13
|
|
@@ -17,6 +19,7 @@ class FDBTest < Test::Unit::TestCase
|
|
17
19
|
@fdb.kill
|
18
20
|
@fdb.confirm
|
19
21
|
@fdb.quit
|
22
|
+
|
20
23
|
@fdb.execute
|
21
24
|
end
|
22
25
|
|
metadata
CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 15
|
9
9
|
- pre
|
10
|
-
version: 1.0.
|
10
|
+
version: 1.0.15.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: 2010-12-
|
18
|
+
date: 2010-12-29 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
|
+
- 3
|
32
32
|
- pre
|
33
|
-
version: 1.1.
|
33
|
+
version: 1.1.3.pre
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: *id001
|
@@ -98,7 +98,7 @@ files:
|
|
98
98
|
- lib/flashsdk/compc.rb
|
99
99
|
- lib/flashsdk/compiler_base.rb
|
100
100
|
- lib/flashsdk/fcsh.rb
|
101
|
-
- lib/flashsdk/
|
101
|
+
- lib/flashsdk/fcsh_socket.rb
|
102
102
|
- lib/flashsdk/fdb.rb
|
103
103
|
- lib/flashsdk/generators/class_generator.rb
|
104
104
|
- lib/flashsdk/generators/flash_helper.rb
|
@@ -130,6 +130,7 @@ files:
|
|
130
130
|
- test/fixtures/air/simple/SomeProject.xml
|
131
131
|
- test/fixtures/compc/simple/SomeFile.as
|
132
132
|
- test/fixtures/flashplayer/AsUnit Runner.swf
|
133
|
+
- test/fixtures/mxmlc/broken/SomeFile.as
|
133
134
|
- test/fixtures/mxmlc/simple/SomeFile.as
|
134
135
|
- test/fixtures/sdk/fdb
|
135
136
|
- test/fixtures/sdk/mxmlc
|
@@ -138,6 +139,7 @@ files:
|
|
138
139
|
- test/unit/amxmlc_test.rb
|
139
140
|
- test/unit/class_generator_test.rb
|
140
141
|
- test/unit/compc_test.rb
|
142
|
+
- test/unit/fcsh_socket_test.rb
|
141
143
|
- test/unit/fcsh_test.rb
|
142
144
|
- test/unit/fdb_test.rb
|
143
145
|
- test/unit/flash_helper_test.rb
|
@@ -150,8 +152,6 @@ files:
|
|
150
152
|
- test/unit/mxmlc_test.rb
|
151
153
|
- test/unit/project_generator_test.rb
|
152
154
|
- test/unit/test_helper.rb
|
153
|
-
- test-stderr.log
|
154
|
-
- test-stdout.log
|
155
155
|
- VERSION
|
156
156
|
has_rdoc: true
|
157
157
|
homepage: http://www.adobe.com/products/flex
|
data/lib/flashsdk/fcsh_client.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
|
2
|
-
module FlashSDK
|
3
|
-
|
4
|
-
class FCSHClient
|
5
|
-
|
6
|
-
def execute executable, path, command
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
##
|
12
|
-
# Rake task that will make any subsequent
|
13
|
-
# mxmlc or compc tasks use the FCSH compiler.
|
14
|
-
#
|
15
|
-
# You can use this task by inserting it
|
16
|
-
# before the task you're calling on the
|
17
|
-
# command line like:
|
18
|
-
#
|
19
|
-
# rake fcsh test
|
20
|
-
#
|
21
|
-
# or:
|
22
|
-
#
|
23
|
-
# rake fcsh debug
|
24
|
-
#
|
25
|
-
# Or you can add this task as a prerequisite
|
26
|
-
# to your build tasks directly like:
|
27
|
-
#
|
28
|
-
# mxmlc 'bin/SomeProject.swf' => :fcsh do |t|
|
29
|
-
# ...
|
30
|
-
# end
|
31
|
-
#
|
32
|
-
desc "Make subsequent MXMLC or COMPC tasks use FCSH"
|
33
|
-
task :fcsh do
|
34
|
-
ENV['USE_FCSH'] = 'true'
|
35
|
-
end
|
36
|
-
|
data/test-stderr.log
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# Logfile created on 2010-12-28 11:30:47 -0800 by logger.rb/25413
|
data/test-stdout.log
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
# Logfile created on 2010-12-28 11:30:47 -0800 by logger.rb/25413
|
2
|
-
I, [2010-12-28T11:30:47.951179 #27514] INFO -- : test/fixtures/sdk/mxmlc -output=test/fixtures/air/simple/bin/SomeProject.swf -static-link-runtime-shared-libraries test/fixtures/air/simple/SomeProject.as
|
3
|
-
I, [2010-12-28T11:30:48.943281 #27514] INFO -- : /Users/lbayes/Projects/Sprouts/flashsdk/test/fixtures/air/simple/bin/SomeProject.swf (349868)
|
4
|
-
|
5
|
-
I, [2010-12-28T11:30:49.017059 #27514] INFO -- : /Users/lbayes/Library/Sprouts/1.1/cache/flex4/4.1.0.16076/bin/compc --output=test/fixtures/compc/simple/SomeFile.swc --static-link-runtime-shared-libraries --include-sources+=test/fixtures/compc/simple
|
6
|
-
I, [2010-12-28T11:30:53.600260 #27514] INFO -- : Loading configuration file /Users/lbayes/Library/Sprouts/1.1/cache/flex4/4.1.0.16076/frameworks/flex-config.xml
|
7
|
-
/Users/lbayes/Projects/Sprouts/flashsdk/test/fixtures/compc/simple/SomeFile.swc (1943 bytes)
|
8
|
-
|
9
|
-
I, [2010-12-28T11:30:54.160306 #27514] INFO -- : Adobe Flex Compiler SHell (fcsh)
|
10
|
-
|
11
|
-
I, [2010-12-28T11:30:54.161083 #27514] INFO -- : Version 4.1.0 build 16076
|
12
|
-
|
13
|
-
I, [2010-12-28T11:30:54.161738 #27514] INFO -- : Copyright (c) 2004-2007 Adobe Systems, Inc. All rights reserved.
|
14
|
-
|
15
|
-
I, [2010-12-28T11:30:54.161820 #27514] INFO -- :
|
16
|
-
|
17
|
-
I, [2010-12-28T11:30:54.162752 #27514] INFO -- : mxmlc -static-link-runtime-shared-libraries test/fixtures/mxmlc/simple/SomeFile.as
|
18
|
-
I, [2010-12-28T11:30:54.175180 #27514] INFO -- : (fcsh) fcsh: Assigned 1 as the compile target id
|
19
|
-
|
20
|
-
I, [2010-12-28T11:30:54.252985 #27514] INFO -- : Loading configuration file /Users/lbayes/Library/Sprouts/1.1/cache/flex4/4.1.0.16076/frameworks/flex-config.xml
|
21
|
-
|
22
|
-
I, [2010-12-28T11:30:56.109517 #27514] INFO -- : /Users/lbayes/Projects/Sprouts/flashsdk/test/fixtures/mxmlc/simple/SomeFile.swf (555 bytes)
|
23
|
-
|
24
|
-
I, [2010-12-28T11:30:56.109995 #27514] INFO -- : compile 1
|
25
|
-
I, [2010-12-28T11:30:56.118715 #27514] INFO -- : (fcsh) Loading configuration file /Users/lbayes/Library/Sprouts/1.1/cache/flex4/4.1.0.16076/frameworks/flex-config.xml
|
26
|
-
|
27
|
-
I, [2010-12-28T11:30:56.163790 #27514] INFO -- : Recompile: /Users/lbayes/Projects/Sprouts/flashsdk/test/fixtures/mxmlc/simple/SomeFile.as
|
28
|
-
|
29
|
-
I, [2010-12-28T11:30:56.164540 #27514] INFO -- : Reason: The source file or one of the included files has been updated.
|
30
|
-
|
31
|
-
I, [2010-12-28T11:30:56.178214 #27514] INFO -- : Files changed: 1 Files affected: 0
|
32
|
-
|
33
|
-
I, [2010-12-28T11:30:56.222191 #27514] INFO -- : /Users/lbayes/Projects/Sprouts/flashsdk/test/fixtures/mxmlc/simple/SomeFile.swf (554 bytes)
|
34
|
-
|
35
|
-
I, [2010-12-28T11:30:56.222379 #27514] INFO -- : quit
|
36
|
-
I, [2010-12-28T11:30:57.249856 #27514] INFO -- : (fcsh) Adobe fdb (Flash Player Debugger) [build 16076]
|
37
|
-
|
38
|
-
I, [2010-12-28T11:30:57.250823 #27514] INFO -- : Copyright (c) 2004-2007 Adobe, Inc. All rights reserved.
|
39
|
-
|
40
|
-
I, [2010-12-28T11:30:57.251158 #27514] INFO -- : run
|
41
|
-
I, [2010-12-28T11:30:57.252208 #27514] INFO -- : (fdb) [SWF] Users:lbayes:Projects:AsUnit-P2:asunit-4.0:bin:AsUnitRunner.swf - 226,833 bytes after decompression
|
42
|
-
|
43
|
-
I, [2010-12-28T11:30:57.252312 #27514] INFO -- : break AsUnitRunner:12
|
44
|
-
I, [2010-12-28T11:30:57.261920 #27514] INFO -- : (fdb)
|
45
|
-
|
46
|
-
I, [2010-12-28T11:30:58.233569 #27514] INFO -- : Adobe fdb (Flash Player Debugger) [build 16076]
|
47
|
-
|
48
|
-
I, [2010-12-28T11:30:58.234467 #27514] INFO -- : Copyright (c) 2004-2007 Adobe, Inc. All rights reserved.
|
49
|
-
|
50
|
-
I, [2010-12-28T11:30:58.234810 #27514] INFO -- : run
|
51
|
-
I, [2010-12-28T11:30:58.235909 #27514] INFO -- : (fdb) [SWF] Users:lbayes:Projects:AsUnit-P2:asunit-4.0:bin:AsUnitRunner.swf - 226,833 bytes after decompression
|
52
|
-
|
53
|
-
I, [2010-12-28T11:30:58.236041 #27514] INFO -- : break AsUnitRunner:12
|
54
|
-
I, [2010-12-28T11:30:58.244454 #27514] INFO -- : (fdb)
|
55
|
-
|
56
|
-
I, [2010-12-28T11:30:58.365701 #27514] INFO -- : test/fixtures/sdk/mxmlc -static-link-runtime-shared-libraries test/fixtures/mxmlc/simple/SomeFile.as
|
57
|
-
I, [2010-12-28T11:30:59.347250 #27514] INFO -- : /Users/lbayes/Projects/Sprouts/flashsdk/test/fixtures/mxmlc/simple/SomeFile.swf (349868)
|
58
|
-
|