Skip to content

Instantly share code, notes, and snippets.

@lukebayes
Created October 29, 2009 16:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lukebayes/221569 to your computer and use it in GitHub Desktop.
Save lukebayes/221569 to your computer and use it in GitHub Desktop.
Default AS3 Rakefile - without Task Helpers
require 'sprout'
# Load gems from a server other than rubyforge:
set_sources 'http://gems.gemcutter.org'
sprout 'as3'
############################################
# Configure ProjectModel to be used by
# script/generate for appropriate bundles.
project_model :model do |m|
m.project_name = 'SomeProject'
m.language = 'as3'
end
############################################
# Configure CompilerModel to be shared with
# whichever tasks add it as a prerequisite.
tool_task_model :compiler_model do |m|
m.source_path = []
m.source_path << 'src'
m.source_path << 'assets'
m.input = 'src/SomeProject.as'
m.default_size = '970 550'
m.default_background_color = '#ffffff'
m.debug = true
end
############################################
# Configure :debug
# http://projectsprouts.org/rdoc/classes/Sprout/MXMLCTask.html
# http://projectsprouts.org/rdoc/classes/Sprout/FlashPlayerTask.html
mxmlc 'bin/SomeProject-debug.swf' => :compiler_model do |t|
end
desc 'Compile and debug the application'
flashplayer :debug => 'bin/SomeProject-debug.swf'
# set :debug as the :default task
task :default => :debug
############################################
# Configure :test
# http://projectsprouts.org/rdoc/classes/Sprout/MXMLCTask.html
# http://projectsprouts.org/rdoc/classes/Sprout/FlashPlayerTask.html
library :asunit3
mxmlc 'bin/SomeProjectRunner.swf' => [:compiler_model, :asunit3] do |t|
t.source_path << 'test'
t.input = 'src/SomeProjectRunner.as'
end
desc 'Compile and debug the test harness'
flashplayer :test => 'bin/SomeProjectRunner.swf'
############################################
# Configure :deploy
# http://projectsprouts.org/rdoc/classes/Sprout/MXMLCTask.html
# http://projectsprouts.org/rdoc/classes/Sprout/FlashPlayerTask.html
mxmlc 'bin/SomeProject.swf' => :compiler_model do |t|
t.debug = false
t.optimize = true
end
desc 'Compile the optimized SWF for deployment'
task :deploy => [:clean, 'bin/SomeProject.swf']
############################################
# Configure :swc
# http://projectsprouts.org/rdoc/classes/Sprout/COMPCTask.html
compc 'bin/SomeProject.swc' => :compiler_model do |t|
t.input = 'SomeProject'
end
desc 'Compile the project as a SWC'
task :swc => 'bin/SomeProject.swc'
############################################
# Configure AsDoc
# http://projectsprouts.org/rdoc/classes/Sprout/AsDocTask.html
asdoc :doc => [:clean, :compiler_model] do |t|
t.doc_sources << 'src/SomeProject.as'
end
############################################
# Configure :cruise to compile and run
# test harness, then write results to disk
# and close the Flash Player.
#
# http://projectsprouts.org/rdoc/classes/Sprout/MXMLCTask.html
# http://projectsprouts.org/rdoc/classes/Sprout/FDBTask.html
#
# NOTE: The FDBTask cannot target a specific player, it
# will launch whatever player is the default on your system.
# You may need to ensure your system default player is configured
# correctly.
mxmlc 'bin/SomeProjectXMLRunner.swf' => [:compiler_model, :asunit3] do |t|
t.source_path << 'test'
t.input = 'src/SomeProjectXMLRunner.as'
end
desc 'Compile and run the CI task'
fdb :cruise => 'bin/SomeProjectXMLRunner.swf' do |t|
t.file = 'bin/SomeProjectXMLRunner.swf'
t.kill_on_fault = true
t.run
# You can set breakpoints in here like:
# t.break = 'SomeProjectXMLRunner:13'
t.continue
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment