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) ⇒ FCSH

Returns a new instance of FCSH.



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

def initialize(name=:fcsh)
  @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.



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

def ip
  @ip
end

#portObject

Returns the value of attribute port.



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

def port
  @port
end

Instance Method Details

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



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

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)
        puts line
      end
    end
    puts 'finished!'
  rescue StandardError
#        IO.popen("fcshs &", "r")
#        execute(cmd, args, retries)
  end
end