Class: Sprout::MXMLCTask
- Inherits:
-
Rake::Task
- Object
- Rake::Task
- Sprout::MXMLCTask
- Defined in:
- lib/sprout/mxmlc_task.rb
Instance Attribute Summary collapse
-
#accessible ⇒ Object
Returns the value of attribute accessible.
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#default_background_color ⇒ Object
Returns the value of attribute default_background_color.
-
#default_frame_rate ⇒ Object
Returns the value of attribute default_frame_rate.
-
#default_script_limits ⇒ Object
Returns the value of attribute default_script_limits.
-
#default_size ⇒ Object
Returns the value of attribute default_size.
-
#external_library_path ⇒ Object
Returns the value of attribute external_library_path.
-
#fcsh_ip ⇒ Object
Returns the value of attribute fcsh_ip.
-
#fcsh_port ⇒ Object
Returns the value of attribute fcsh_port.
-
#frames ⇒ Object
Returns the value of attribute frames.
-
#incremental ⇒ Object
Returns the value of attribute incremental.
-
#input ⇒ Object
Returns the value of attribute input.
-
#library_path ⇒ Object
Returns the value of attribute library_path.
-
#link_report ⇒ Object
Returns the value of attribute link_report.
-
#load_externs ⇒ Object
Returns the value of attribute load_externs.
-
#locale ⇒ Object
Returns the value of attribute locale.
-
#optimize ⇒ Object
Returns the value of attribute optimize.
-
#output ⇒ Object
Returns the value of attribute output.
-
#runtime_shared_libraries ⇒ Object
Returns the value of attribute runtime_shared_libraries.
-
#show_actionscript_warnings ⇒ Object
Returns the value of attribute show_actionscript_warnings.
-
#source_path ⇒ Object
Returns the value of attribute source_path.
-
#theme ⇒ Object
Returns the value of attribute theme.
-
#use_fcsh ⇒ Object
Returns the value of attribute use_fcsh.
-
#use_network ⇒ Object
Returns the value of attribute use_network.
-
#warnings ⇒ Object
Returns the value of attribute warnings.
Class Method Summary collapse
Instance Method Summary collapse
- #add_path(path) ⇒ Object
- #add_path_list(list) ⇒ Object
- #clean_path(path) ⇒ Object
- #compile ⇒ Object
- #define ⇒ Object
- #el ⇒ Object
- #has_fork ⇒ Object
-
#initialize(task_name, app) ⇒ MXMLCTask
constructor
A new instance of MXMLCTask.
- #l ⇒ Object
- #option_list ⇒ Object
- #rsl ⇒ Object
- #sp ⇒ Object
Constructor Details
#initialize(task_name, app) ⇒ MXMLCTask
Returns a new instance of MXMLCTask.
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/sprout/mxmlc_task.rb', line 58 def initialize(task_name, app) super(task_name, app) @use_fcsh = true @fcsh_ip = "127.0.0.1" @fcsh_port = 20569 = [] @source_path = [] @warnings = false @external_library_path = [] @frames = [] @library_path = [] @theme = [] @runtime_shared_libraries = [] @incremental = false @optimize = false @name = name @input = nil @output = nil end |
Instance Attribute Details
#accessible ⇒ Object
Returns the value of attribute accessible.
32 33 34 |
# File 'lib/sprout/mxmlc_task.rb', line 32 def accessible @accessible end |
#debug ⇒ Object
Returns the value of attribute debug.
32 33 34 |
# File 'lib/sprout/mxmlc_task.rb', line 32 def debug @debug end |
#default_background_color ⇒ Object
Returns the value of attribute default_background_color.
32 33 34 |
# File 'lib/sprout/mxmlc_task.rb', line 32 def default_background_color @default_background_color end |
#default_frame_rate ⇒ Object
Returns the value of attribute default_frame_rate.
32 33 34 |
# File 'lib/sprout/mxmlc_task.rb', line 32 def default_frame_rate @default_frame_rate end |
#default_script_limits ⇒ Object
Returns the value of attribute default_script_limits.
32 33 34 |
# File 'lib/sprout/mxmlc_task.rb', line 32 def default_script_limits @default_script_limits end |
#default_size ⇒ Object
Returns the value of attribute default_size.
32 33 34 |
# File 'lib/sprout/mxmlc_task.rb', line 32 def default_size @default_size end |
#external_library_path ⇒ Object
Returns the value of attribute external_library_path.
32 33 34 |
# File 'lib/sprout/mxmlc_task.rb', line 32 def external_library_path @external_library_path end |
#fcsh_ip ⇒ Object
Returns the value of attribute fcsh_ip.
32 33 34 |
# File 'lib/sprout/mxmlc_task.rb', line 32 def fcsh_ip @fcsh_ip end |
#fcsh_port ⇒ Object
Returns the value of attribute fcsh_port.
32 33 34 |
# File 'lib/sprout/mxmlc_task.rb', line 32 def fcsh_port @fcsh_port end |
#frames ⇒ Object
Returns the value of attribute frames.
32 33 34 |
# File 'lib/sprout/mxmlc_task.rb', line 32 def frames @frames end |
#incremental ⇒ Object
Returns the value of attribute incremental.
32 33 34 |
# File 'lib/sprout/mxmlc_task.rb', line 32 def incremental @incremental end |
#input ⇒ Object
Returns the value of attribute input.
32 33 34 |
# File 'lib/sprout/mxmlc_task.rb', line 32 def input @input end |
#library_path ⇒ Object
Returns the value of attribute library_path.
32 33 34 |
# File 'lib/sprout/mxmlc_task.rb', line 32 def library_path @library_path end |
#link_report ⇒ Object
Returns the value of attribute link_report.
32 33 34 |
# File 'lib/sprout/mxmlc_task.rb', line 32 def link_report @link_report end |
#load_externs ⇒ Object
Returns the value of attribute load_externs.
32 33 34 |
# File 'lib/sprout/mxmlc_task.rb', line 32 def load_externs @load_externs end |
#locale ⇒ Object
Returns the value of attribute locale.
32 33 34 |
# File 'lib/sprout/mxmlc_task.rb', line 32 def locale @locale end |
#optimize ⇒ Object
Returns the value of attribute optimize.
32 33 34 |
# File 'lib/sprout/mxmlc_task.rb', line 32 def optimize @optimize end |
#output ⇒ Object
Returns the value of attribute output.
32 33 34 |
# File 'lib/sprout/mxmlc_task.rb', line 32 def output @output end |
#runtime_shared_libraries ⇒ Object
Returns the value of attribute runtime_shared_libraries.
32 33 34 |
# File 'lib/sprout/mxmlc_task.rb', line 32 def runtime_shared_libraries @runtime_shared_libraries end |
#show_actionscript_warnings ⇒ Object
Returns the value of attribute show_actionscript_warnings.
32 33 34 |
# File 'lib/sprout/mxmlc_task.rb', line 32 def show_actionscript_warnings @show_actionscript_warnings end |
#source_path ⇒ Object
Returns the value of attribute source_path.
32 33 34 |
# File 'lib/sprout/mxmlc_task.rb', line 32 def source_path @source_path end |
#theme ⇒ Object
Returns the value of attribute theme.
32 33 34 |
# File 'lib/sprout/mxmlc_task.rb', line 32 def theme @theme end |
#use_fcsh ⇒ Object
Returns the value of attribute use_fcsh.
32 33 34 |
# File 'lib/sprout/mxmlc_task.rb', line 32 def use_fcsh @use_fcsh end |
#use_network ⇒ Object
Returns the value of attribute use_network.
32 33 34 |
# File 'lib/sprout/mxmlc_task.rb', line 32 def use_network @use_network end |
#warnings ⇒ Object
Returns the value of attribute warnings.
32 33 34 |
# File 'lib/sprout/mxmlc_task.rb', line 32 def warnings @warnings end |
Class Method Details
.define_task(args) {|t| ... } ⇒ Object
78 79 80 81 82 |
# File 'lib/sprout/mxmlc_task.rb', line 78 def self.define_task(args, &block) t = super yield t if block_given? t.define end |
Instance Method Details
#add_path(path) ⇒ Object
194 195 196 197 198 199 200 |
# File 'lib/sprout/mxmlc_task.rb', line 194 def add_path(path) ['*.mxml', '*.as'].each do |type| input_files = FileList[File.dirname(path) + '/**/*' + type] file input_files file @output => input_files end end |
#add_path_list(list) ⇒ Object
187 188 189 190 191 192 |
# File 'lib/sprout/mxmlc_task.rb', line 187 def add_path_list(list) list.collect do |path| add_path(path) clean_path(path) end end |
#clean_path(path) ⇒ Object
202 203 204 205 206 207 |
# File 'lib/sprout/mxmlc_task.rb', line 202 def clean_path(path) if(!path.index(' ').nil?) path = %{"#{path}"} end return path end |
#compile ⇒ Object
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/sprout/mxmlc_task.rb', line 127 def compile if(use_fcsh && has_fork) fcsh = FCSH.new(fcsh_ip, fcsh_port) fcsh.execute("mxmlc #{option_list.join(' ')}") else begin User.execute('mxmlc', option_list.join(' ')) rescue ExecutionError => e if(e..index('Warning:')) Log.puts(e..gsub('[ERROR]', '[WARNING]')) else raise end end end end |
#define ⇒ Object
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/sprout/mxmlc_task.rb', line 84 def define @external_library_path = add_path_list(@external_library_path) if @external_library_path.size > 0 @library_path = add_path_list(@library_path) if @library_path.size > 0 @source_path = add_path_list(@source_path) if @source_path.size > 0 @theme.collect do |item| file item file @output => item end if(!@input.nil?) add_path(File.dirname(@input)) end file @output do |f| # Execute the mxmlc tool sprout by name # This will perform binary execution in # a platform independent manner compile end # TODO: Add dependency back in so # that edits to the rakefile force # a new build #file @output => Sprout.rakefile CLEAN.add(@output) if(@incremental) CLEAN.add(FileList['**/**/*.cache']) end task @name => [@output] end |
#el ⇒ Object
148 149 150 |
# File 'lib/sprout/mxmlc_task.rb', line 148 def el return @external_library_path end |
#has_fork ⇒ Object
118 119 120 121 122 123 124 125 |
# File 'lib/sprout/mxmlc_task.rb', line 118 def has_fork if(!(RUBY_PLATFORM =~ /vista/i) && !(RUBY_PLATFORM =~ /mswin/i)) return false else require 'task/fcsh' return true end end |
#l ⇒ Object
156 157 158 |
# File 'lib/sprout/mxmlc_task.rb', line 156 def l return @library_path end |
#option_list ⇒ Object
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
# File 'lib/sprout/mxmlc_task.rb', line 160 def option_list result = .dup result << "-accessible" if accessible result << "-debug" if debug result << "-optimize" if optimize result << "-warnings=#{warnings}" result << "-use-network" if use_network result << "-show-actionscript-warnings" if show_actionscript_warnings result << "-locale" << locale if locale result << "-default-frame-rate" << default_frame_rate if default_frame_rate result << "-default-background-color=" + default_background_color if default_background_color result << "-default-script-limits" << default_script_limits if default_script_limits result << "-default-size" << default_size if default_size result << "-load-externs" << load_externs if load_externs result << "-link-report" << link_report if link_report result << "-output" << clean_path(output) if output result << "-theme " + theme.join(" -theme ") if theme.size > 0 result << "-frame " + frames.join(" -frame ") if frames.size > 0 result << "-rsl=" + runtime_shared_libraries.join(" -rsl=") if runtime_shared_libraries.size > 0 result << "-el+=" + external_library_path.join(" -el+=") if external_library_path.size > 0 result << "-l=" + library_path.join(" -l=") if library_path.size > 0 result << "-sp=" + source_path.join(" -sp=") if source_path.size > 0 result << "-incremental" if incremental result << clean_path(input) return result end |
#rsl ⇒ Object
152 153 154 |
# File 'lib/sprout/mxmlc_task.rb', line 152 def rsl return @runtime_shared_libraries end |
#sp ⇒ Object
144 145 146 |
# File 'lib/sprout/mxmlc_task.rb', line 144 def sp return @source_path end |