#!/usr/bin/env ruby require File.expand_path(File.dirname(__FILE__) + '/../lib/listener.rb') directory = Dir.pwd options = { :spec => 'Preloader.as', :strict => true, :network => false, :optimize => true, :incremental => true, :path => { :source => "#{directory}/lib", :release => "#{directory}/release", :options => [ File.expand_path("~/as3-autocompile.opts"), "#{directory}/as3-autocompile.opts" ] } } command = 'mxmlc' command += " -strict=#{options[:strict]}" command += " -use-network=#{options[:network]}" command += " -optimize=#{options[:optimize]}" command += " -incremental=#{options[:incremental]}" command += " -output '#{options[:path][:release]}/compiled.swf'" command += " -file-specs '#{options[:path][:source]}/#{options[:spec]}'" options[:path][:options].each do |filename| if File.exists?(filename) command += " " command += File.new(filename).readlines.map { |line| line.chomp }.join(' ') end end command += " #{ARGV.join(' ')}" Listener.new(options[:path][:source]) do system command end