Class: AsProject::MTASC
- Inherits:
-
RemoteFileTask
- Object
- Rake::TaskLib
- RemoteFileTask
- AsProject::MTASC
- Defined in:
- lib/tasks/mtasc.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#class_path ⇒ Object
Returns the value of attribute class_path.
-
#compiler_version ⇒ Object
Returns the value of attribute compiler_version.
-
#frame ⇒ Object
Returns the value of attribute frame.
-
#header ⇒ Object
Returns the value of attribute header.
-
#input ⇒ Object
Returns the value of attribute input.
-
#input_swf ⇒ Object
Returns the value of attribute input_swf.
-
#main ⇒ Object
Returns the value of attribute main.
-
#mx ⇒ Object
Returns the value of attribute mx.
-
#name ⇒ Object
Returns the value of attribute name.
-
#output ⇒ Object
Returns the value of attribute output.
-
#verbose ⇒ Object
Returns the value of attribute verbose.
-
#version ⇒ Object
Returns the value of attribute version.
Attributes inherited from RemoteFileTask
#osx_extracted_file, #osx_url, #unix_extracted_file, #unix_url, #user_task, #win_extracted_file, #win_url
Instance Method Summary collapse
- #add_path(path, list) ⇒ Object
- #compile_task_desc ⇒ Object
-
#define ⇒ Object
Create the tasks defined by this task lib.
-
#initialize(name = :compile, do_not_define = false) ⇒ MTASC
constructor
A new instance of MTASC.
- #option_list ⇒ Object
- #recurse_exclude_path(dir) ⇒ Object
- #remote_task_name ⇒ Object
Methods inherited from RemoteFileTask
#clean_path, #define_user_task, #execute
Constructor Details
#initialize(name = :compile, do_not_define = false) ⇒ MTASC
Returns a new instance of MTASC.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/tasks/mtasc.rb', line 22 def initialize(name=:compile, do_not_define=false) @compiler_version = '1.13' @options = [] @class_path = [] @user_task = nil @win_url = "http://www.mtasc.org/zip/mtasc-#{compiler_version}.zip" @win_extracted_file = "/mtasc-#{compiler_version}/mtasc.exe" @osx_url = "http://www.mtasc.org/zip/mtasc-#{compiler_version}.dmg" @osx_extracted_file = "/mtasc-#{compiler_version}/mtasc.app" @unix_url = "http://www.mtasc.org/zip/mtasc-#{compiler_version}.tar.gz" @unix_extracted_file = "/mtasc-#{compiler_version}/mtasc" super(name, true) define unless do_not_define end |
Instance Attribute Details
#class_path ⇒ Object
Returns the value of attribute class_path.
9 10 11 |
# File 'lib/tasks/mtasc.rb', line 9 def class_path @class_path end |
#compiler_version ⇒ Object
Returns the value of attribute compiler_version.
9 10 11 |
# File 'lib/tasks/mtasc.rb', line 9 def compiler_version @compiler_version end |
#frame ⇒ Object
Returns the value of attribute frame.
9 10 11 |
# File 'lib/tasks/mtasc.rb', line 9 def frame @frame end |
#header ⇒ Object
Returns the value of attribute header.
9 10 11 |
# File 'lib/tasks/mtasc.rb', line 9 def header @header end |
#input ⇒ Object
Returns the value of attribute input.
9 10 11 |
# File 'lib/tasks/mtasc.rb', line 9 def input @input end |
#input_swf ⇒ Object
Returns the value of attribute input_swf.
9 10 11 |
# File 'lib/tasks/mtasc.rb', line 9 def input_swf @input_swf end |
#main ⇒ Object
Returns the value of attribute main.
9 10 11 |
# File 'lib/tasks/mtasc.rb', line 9 def main @main end |
#mx ⇒ Object
Returns the value of attribute mx.
9 10 11 |
# File 'lib/tasks/mtasc.rb', line 9 def mx @mx end |
#name ⇒ Object
Returns the value of attribute name.
9 10 11 |
# File 'lib/tasks/mtasc.rb', line 9 def name @name end |
#output ⇒ Object
Returns the value of attribute output.
9 10 11 |
# File 'lib/tasks/mtasc.rb', line 9 def output @output end |
#verbose ⇒ Object
Returns the value of attribute verbose.
9 10 11 |
# File 'lib/tasks/mtasc.rb', line 9 def verbose @verbose end |
#version ⇒ Object
Returns the value of attribute version.
9 10 11 |
# File 'lib/tasks/mtasc.rb', line 9 def version @version end |
Instance Method Details
#add_path(path, list) ⇒ Object
85 86 87 88 89 90 91 92 93 94 |
# File 'lib/tasks/mtasc.rb', line 85 def add_path(path, list) as_files = FileList[path + '/**/**/*.as'] file as_files file output => as_files xml_files = FileList[path + '/**/**/*.xml'] file xml_files file output => xml_files list << clean_path(path) end |
#compile_task_desc ⇒ Object
41 42 43 |
# File 'lib/tasks/mtasc.rb', line 41 def compile_task_desc return "Compile #{name} using MTASC" end |
#define ⇒ Object
Create the tasks defined by this task lib.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/tasks/mtasc.rb', line 46 def define super # if(!input_swf && !header && pack_path.size == 0) # raise MTASCError.new('MTASC task must be provided with an input_swf, a header argument, or at least one pack_path') # end # if(header && !input_swf && output) # raise MTASCError.new('It looks like you used the output parameter where you should have used the swf parameter') # end desc compile_task_desc task name => [output] CLEAN.add(output) if(input_swf) file input_swf task name => [input_swf] end @cleaned_class_paths = [] class_path.each do |path| add_path(path, @cleaned_class_paths) end file output do |f| user_task.execute(option_list.join(' ')) end self end |
#option_list ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/tasks/mtasc.rb', line 96 def option_list result = @options.dup result << "-header" << header if header result << "-mx" if mx result << "-v" if verbose result << "-frame" << frame if frame result << "-cp " + @cleaned_class_paths.join(" -cp ") if class_path.size > 0 result << "-swf" << clean_path(input_swf) if input_swf result << "-out" << clean_path(output) if output result << "-main" if main result << clean_path(input) if input return result end |
#recurse_exclude_path(dir) ⇒ Object
75 76 77 78 79 80 81 82 83 |
# File 'lib/tasks/mtasc.rb', line 75 def recurse_exclude_path(dir) paths = [dir] Dir[dir + '/*'].each do |f| if(File.directory?(f)) paths << recurse_exclude_path(f) end end return paths end |
#remote_task_name ⇒ Object
37 38 39 |
# File 'lib/tasks/mtasc.rb', line 37 def remote_task_name return "mtasc-#{compiler_version}" end |