Skip to content

Instantly share code, notes, and snippets.

@Lytol
Created April 8, 2009 05:56
Show Gist options
  • Save Lytol/91654 to your computer and use it in GitHub Desktop.
Save Lytol/91654 to your computer and use it in GitHub Desktop.
namespace :flex do
FLEX_SRC = File.join(Rails.root,"src")
FLEX_LIB = File.join(Rails.root,"vendor/lib")
FLEX_BIN = File.join(Rails.root,"public/assets")
desc "Compile the Flex app and run the test suite"
task :build => [:compile, :test]
desc "Compile the Flex app"
task :compile do
Dir.chdir(FLEX_SRC) do
Dir["*.mxml"].each do |source_file|
output_file = source_file.gsub(/mxml$/,'swf')
puts "Compiling #{source_file} => #{output_file}"
sh %{ mxmlc --show-actionscript-warnings=true --strict=true -locale en_US -library-path+=#{FLEX_LIB} #{source_file} }
move output_file, "#{FLEX_BIN}/", :verbose => true
end
end
end
desc "Build and run the test suite"
task :test => ["test:build", "test:run"]
namespace :test do
desc "Build the test suite runner"
task :build do
sh %{ mxmlc --show-actionscript-warnings=true --strict=true -locale en_US -library-path+=#{FLEX_LIB} #{FLEX_SRC}/test/TestRunner.mxml }
end
desc "Run the test suite"
task :run do
sh %{ open #{FLEX_SRC}/test/TestRunner.swf -a "Flash Player" }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment