namespace :air do task :settings do ENV["FCSH_IP"] ||= "127.0.0.1" ENV["FCSH_PORT"] ||= "20569" end desc "Compile" task :compile => :settings do begin project = Airake::Project.new(ENV["BASE_DIR"], ENV["MXML"], ENV) fcsh = FCSH.new(ENV["FCSH_IP"], ENV["FCSH_PORT"].to_i) fcsh.execute([ project.base_dir, project.mxmlc_command ]) rescue FCSHConnectError => e puts "Cannot connect to FCSHD (start by running: rake air:fcshd); Continuing compilation..." project.run_mxmlc end end desc "Test" task :test => :settings do test_project = Airake::Project.new(ENV["BASE_DIR"], ENV["MXML_TEST"], ENV) test_project.run_mxmlc test_project.run_adl end desc "Package" task :package => :compile do project = Airake::Project.new(ENV["BASE_DIR"], ENV["MXML"], ENV) project.run_adt end desc "Apollo Debug Luncher" task :adl => :compile do project = Airake::Project.new(ENV["BASE_DIR"], ENV["MXML"], ENV) project.run_adl end desc "Start the FCSHD process (or use air:fcshd)" task :start_fcshd => :settings do puts "Starting FCSHD @ #{ENV["FCSH_IP"]}:#{ENV["FCSH_PORT"].to_i}" FCSHD.new(ENV["FCSH_IP"], ENV["FCSH_PORT"].to_i) end desc "Stop the FCSHD process" task :stop_fcshd => :settings do fcsh = FCSH.new(ENV["FCSH_IP"], ENV["FCSH_PORT"].to_i) fcsh.stop end desc "Restart the FCSHD process" task :restart_fcsh => :settings do Rake::Task[:stop_fcshd].invoke rescue puts "Could not stop FCSHD" sleep 1 Rake::Task[:start_fcshd].invoke end # Aliases task :fcshd => :start_fcshd end