module Neutron::Valac

Public Class Methods

compile(*files, **opts) click to toggle source
# File lib/neutron/valac.rb, line 4
def self.compile(*files, **opts)
  o = {
    prog: 'valac',
    debug: false,
    type: :object,
    args: ''
  }.merge(opts)

  specific = ''
  
  if o[:debug]
    specific << ' -g'
  end

  case o[:type]
  when :object
    specific << ' -c'
  else
    raise TypeError, "Invalid output type: #{o[:type]}!"
  end

  files.each do |file|
    file = File.expand_path(file)
    
    Neutron.execute("#{o[:prog]} #{file} #{specific} -b ./ --thread #{o[:args]}", must_success: true)
  end
end