Class: MRuby::Command::Mrbc
- Inherits:
-
MRuby::Command
- Object
- MRuby::Command
- MRuby::Command::Mrbc
- Defined in:
- ext/enterprise_script_service/mruby/lib/mruby/build/command.rb
Constant Summary
Constants inherited from MRuby::Command
Instance Attribute Summary collapse
-
#compile_options ⇒ Object
Returns the value of attribute compile_options.
Attributes inherited from MRuby::Command
Instance Method Summary collapse
-
#initialize(build) ⇒ Mrbc
constructor
A new instance of Mrbc.
- #run(out, infiles, funcname) ⇒ Object
Methods inherited from MRuby::Command
Constructor Details
#initialize(build) ⇒ Mrbc
Returns a new instance of Mrbc.
326 327 328 329 330 |
# File 'ext/enterprise_script_service/mruby/lib/mruby/build/command.rb', line 326 def initialize(build) super @command = nil @compile_options = "-B%{funcname} -o-" end |
Instance Attribute Details
#compile_options ⇒ Object
Returns the value of attribute compile_options.
324 325 326 |
# File 'ext/enterprise_script_service/mruby/lib/mruby/build/command.rb', line 324 def @compile_options end |
Instance Method Details
#run(out, infiles, funcname) ⇒ Object
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 |
# File 'ext/enterprise_script_service/mruby/lib/mruby/build/command.rb', line 332 def run(out, infiles, funcname) @command ||= @build.mrbcfile infiles = [infiles].flatten infiles.each do |f| _pp "MRBC", f.relative_path, nil, :indent => 2 end cmd = "#{filename @command} #{@compile_options % {:funcname => funcname}} #{filename(infiles).join(' ')}" print("#{cmd}\n") if $verbose IO.popen(cmd, 'r+') do |io| out.puts io.read end # if mrbc execution fail, drop the file if $?.exitstatus != 0 File.delete(out.path) exit(-1) end end |