| Class | Sprout::FCSHService |
| In: |
bundles/as3/lib/sprout/fcsh_service.rb
|
| Parent: | Object |
# File bundles/as3/lib/sprout/fcsh_service.rb, line 36 def initialize(out=nil) @out = out || $stdout @tasks = [] @lexer = FCSHLexer.new @out # TODO: This should use configurable SDK destinations: exe = Sprout.get_executable('sprout-flex3sdk-tool', 'bin/fcsh') @process = User.execute_silent(exe) response = '' @lexer.scan_process(@process).each do |token| response << token[:output] end out.puts response end
Temporarily pulled support for clear - since it‘s easier to just stop and start the server. The clear feature continues to increment task ids and requires deeper changes for full support… def clear
@tasks.each_index do |index|
write("clear #{index+1}")
end
@tasks = []
return "[fcsh] All tasks have been cleared"
end
# File bundles/as3/lib/sprout/fcsh_service.rb, line 64 def execute(request) # if(request =~ /^clear/) # return clear # end hashed = Digest::MD5.hexdigest(request) # First, see if we've already received a task with this # Exact command: @tasks.each_index do |index| task = @tasks[index] if(task[:hash] == hashed) out.puts "[fcsh] #{request})" # Compile with an existing task at index+1 return write("compile #{index+1}") end end # No existing task found with this hash, create a new # task, store it for later, execute and return the result: task = {:hash => hashed, :request => request, :executed => false} @tasks << task return write(task[:request]) end