Class: Fcsh
- Inherits:
-
Object
- Object
- Fcsh
- Defined in:
- lib/fcsh.rb
Overview
Abstraction of flex fcsh command
Defined Under Namespace
Classes: CompileError
Class Attribute Summary collapse
-
.location ⇒ Object
Returns the value of attribute location.
Instance Method Summary collapse
- #clear(target_id) ⇒ Object
- #compile(target_id) ⇒ Object
- #errors ⇒ Object
-
#initialize ⇒ Fcsh
constructor
Run the flex command.
-
#mxmlc(command) ⇒ Object
run mxmlc with a command, returns the id of the assigned target e.g.
Constructor Details
#initialize ⇒ Fcsh
Run the flex command. Make sure fcsh is in the path, else set Fcsh.BIN_FILE = ‘/path/to/fcsh’
8 9 10 11 12 |
# File 'lib/fcsh.rb', line 8 def initialize fcsh_command = defined?(self.location) ? location : 'fcsh' @stdin, @stdout, @stderr = Open3.popen3(fcsh_command) wait_for_on_stdout(/^\(fcsh\)/) end |
Class Attribute Details
.location ⇒ Object
Returns the value of attribute location.
144 145 146 |
# File 'lib/fcsh.rb', line 144 def location @location end |
Instance Method Details
#clear(target_id) ⇒ Object
42 43 44 45 |
# File 'lib/fcsh.rb', line 42 def clear(target_id) puts "Clearing target id" if $DEBUG @stdin.puts "clear %d" % target_id.to_i end |
#compile(target_id) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/fcsh.rb', line 33 def compile(target_id) puts "Compiling target: " + target_id if $DEBUG @stdout.flush @stderr.flush @stdin.puts "compile %d" % target_id.to_i @errors_last_run = capture_error_output end |
#errors ⇒ Object
48 49 50 |
# File 'lib/fcsh.rb', line 48 def errors return MxmlcOutputReader.new(@errors_last_run) end |
#mxmlc(command) ⇒ Object
run mxmlc with a command, returns the id of the assigned target
e.g. fcsh.new.mxmlc(""
can run an CompileError when compile errors are found
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/fcsh.rb', line 17 def mxmlc(command) puts "mxmlc %s" % command if $DEBUG @stdin.puts "mxmlc %s" % command target_id = nil @stdout.each_line do |line| if line =~ /fcsh: Assigned (\d) as the compile target id/ target_id = $1 end break end @errors_last_run = capture_error_output return target_id end |