class Rubyfuu::Builder

Public Class Methods

new(compiler = nil) click to toggle source
# File lib/rubyfuu.rb, line 16
def initialize(compiler = nil)
  unless compiler
    compiler = OS.osx? ? OSXAssembly32 : LinuxAssembly32
  end

  @compiler = compiler
end

Public Instance Methods

build(source_path, destination = nil) click to toggle source
# File lib/rubyfuu.rb, line 24
def build(source_path, destination = nil)
  base = source_path.chomp(File.extname(source_path) )

  destination ||= File.basename(base)

  writer = FileWriter.new
  reader = File.open(source_path, 'r')

  compiler = @compiler.new(reader, writer)
  compiler.build(destination)
end
run(source_path) click to toggle source
# File lib/rubyfuu.rb, line 36
def run(source_path)
  tmp = Tempfile.new("out")
  tmp.close
  out_path = tmp.path
  build(source_path, out_path)
  system out_path
  tmp.unlink
end