=begin
Copyright (c) 2007 Pattern Park
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
=end
module Sprout # :nodoc:
class MTASCError < StandardError #:nodoc:
end
# Compile sources using the Motion Twin ActionScript Compiler (MTASC[http://www.mtasc.org]).
#
# Like standard Rake file tasks, the name given to the MTASCTask instance should be the
# file that the task is epected to create. This value can be overridden in the configuration
# block by using the -output parameter.
#
# mtasc 'bin/SomeProject.swf' do |t|
# t.main = true
# t.header = '800:600:24'
# t.input = 'src/SomeProject.as'
# end
#
# The above MTASCTask can be aliased for easier typing on the command line as follows:
#
# desc "Compile SomeProject.swf"
# task :compile => 'bin/SomeProject.swf'
#
# If the MTASCTask has a SWFMillTask as a prerequisite, it will automatically set that task output
# as the value of the -swf paramter. Additionally, when MTASC pulls in an existing SWF file
# you no longer need to define the -header parameter as it will use the dimensions and frame rate
# found in the loaded SWF file. If the -header parameter is set, it will override
# whatever settings are in the loaded SWF. Following is a short example:
#
# swfmill 'bin/SomeProjectSkin.swf' do |t|
# t.input = 'assets/skin'
# end
#
# mtasc 'bin/SomeProject.swf' => 'bin/SomeProjectSkin.swf' do |t|
# t.main = true
# t.input = 'src/SomeProject.as'
# end
#
# Any LibraryTask instances that are added as prerequisites to the MTASCTask will be automatically
# added to the class_path in the order they are declared as prerequisites.
#
# The following example will add the imaginary libraries :somelib, :otherlib and :yourlib to the class_path in that order.
#
# library :yourlib
# library :otherlib
# library :somelib
#
# mtasc 'bin/SomeProjectRunner.swf' => [:somelib, :otherlib, :yourlib] do |t|
# t.main = true
# t.header = '800:600:24'
# t.input = 'src/SomeProjectRunner.as'
# end
#
# At this time, MTASC does not support libraries that are packaged as SWC files. We are considering
# adding support for SWC files in the near future, if you're interested in contributing to this
# feature, please let us know.
#
class MTASCTask < ToolTask
# Automatically include the installation MTASC 'std' library to the class_path.
attr_accessor :include_std
def initialize_task # :nodoc:
@include_std = false
@default_gem_name = 'sprout-mtasc-tool'
add_param(:cp, :paths) do |p|
p.delimiter = ' '
p.description =<