Sha256: 4cf8f92f3b525d8b604f90980e061a87776f3c173e96cfe95dd27af95ebf3f73
Contents?: true
Size: 880 Bytes
Versions: 1
Compression:
Stored size: 880 Bytes
Contents
#!/usr/bin/env ruby require 'tempfile' require 'mruby_tools' # args like: file1.rb file2.rb -o outfile # possibly: file1.rb -o outfile file2.rb -c generated.c opts = MRubyTools::CLI.args(ARGV) MRubyTools::CLI.usage if opts[:help] mrb = MRubyTools.new(opts[:mruby_dir]) # nil is fine begin mrb.validate! rescue MRubyTools::MRubyNotFound => e warn "#{e.class}: can't find #{e}" exit 1 end rb_files = opts.fetch(:rb_files) MRubyTools::CLI.usage("no .rb files provided") if rb_files.empty? c_code = MRubyTools::C.wrapper(rb_files) puts c_code + "\n" if opts[:verbose] c_file = opts.fetch(:c_file) c_file.write(c_code) c_file.close puts "generated #{c_file.path}" if opts[:verbose] out_file = opts.fetch(:out_file) puts "compiling..." if mrb.compile(c_file.path, out_file) puts "created binary executable: #{out_file}" else warn "FATAL: compile failed" exit 1 end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mruby_tools-0.0.3.1 | bin/mrbt |