Class: AsProject::FCSH

Inherits:
MXMLC show all
Defined in:
lib/tasks/fcsh.rb

Overview

TODO: Add new task as a clean dependency That will call the fcshs and tell it to release all in-memory compilations

Instance Attribute Summary collapse

Attributes inherited from MXMLC

#accessible, #debug, #default_background_color, #default_frame_rate, #default_script_limits, #default_size, #external_library_path, #frames, #incremental, #input, #library_path, #link_report, #load_externs, #locale, #optimize, #output, #runtime_shared_libraries, #show_actionscript_warnings, #source_path, #theme, #use_network, #warnings

Attributes inherited from EnvTask

#name, #target

Instance Method Summary collapse

Methods inherited from MXMLC

#add_path, #add_path_list, #clean_path, #define, #el, #l, #option_list, #rsl, #sp

Methods inherited from EnvTask

#define, #target_not_found

Constructor Details

#initialize(name = :fcsh, ip = nil, port = nil) ⇒ FCSH

Returns a new instance of FCSH.



14
15
16
17
18
# File 'lib/tasks/fcsh.rb', line 14

def initialize(name=:fcsh, ip=nil, port=nil)
  @ip = (ip.nil?) ? "127.0.0.1" : ip
  @port = (port.nil?) ? 20569 : port
  super(name)
end

Instance Attribute Details

#ipObject

Returns the value of attribute ip.



11
12
13
# File 'lib/tasks/fcsh.rb', line 11

def ip
  @ip
end

#portObject

Returns the value of attribute port.



11
12
13
# File 'lib/tasks/fcsh.rb', line 11

def port
  @port
end

Instance Method Details

#execute(cmd, args, retries = 0) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/tasks/fcsh.rb', line 20

def execute(cmd, args, retries=0)
  retries = retries+1
  if(retries > 3)
    puts "fcsh task was unable to connect to fcshs, please try starting this service by opening a new terminal and typing 'fcshs' (without quotes)"
    return
  end
  begin
    @socket = TCPSocket.open(@ip, @port) do |s|
      s.puts Dir.pwd
      s.puts "#{cmd} #{args}"
      s.close_write
      while(line = s.gets)
        if(line.match(/^0xE/))
          s.close
          break
        end
        puts line
      end
    end
  rescue StandardError
#        IO.popen("fcshs &", "a+")
#        execute(cmd, args, retries)
  end
end