Class: AsProject::MXMLC
Direct Known Subclasses
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.
-
#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_network ⇒ Object
Returns the value of attribute use_network.
-
#warnings ⇒ Object
Returns the value of attribute warnings.
Attributes inherited from EnvTask
Instance Method Summary collapse
- #add_path(path) ⇒ Object
- #add_path_list(list) ⇒ Object
- #clean_path(path) ⇒ Object
- #define ⇒ Object
- #el ⇒ Object
- #execute(cmd, args, retries = 0) ⇒ Object
-
#initialize(name = :mxmlc) {|_self| ... } ⇒ MXMLC
constructor
A new instance of MXMLC.
- #l ⇒ Object
- #option_list ⇒ Object
- #rsl ⇒ Object
- #sp ⇒ Object
Methods inherited from EnvTask
Constructor Details
#initialize(name = :mxmlc) {|_self| ... } ⇒ MXMLC
Returns a new instance of MXMLC.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/tasks/mxmlc.rb', line 27 def initialize(name=:mxmlc) @options = [] @source_path = [] @external_library_path = [] @frames = [] @library_path = [] @theme = [] @runtime_shared_libraries = [] @incremental = false @optimize = false path_finder = PathFinder.new @target = path_finder.mxmlc @name = name yield self if block_given? define end |
Instance Attribute Details
#accessible ⇒ Object
Returns the value of attribute accessible.
4 5 6 |
# File 'lib/tasks/mxmlc.rb', line 4 def accessible @accessible end |
#debug ⇒ Object
Returns the value of attribute debug.
4 5 6 |
# File 'lib/tasks/mxmlc.rb', line 4 def debug @debug end |
#default_background_color ⇒ Object
Returns the value of attribute default_background_color.
4 5 6 |
# File 'lib/tasks/mxmlc.rb', line 4 def default_background_color @default_background_color end |
#default_frame_rate ⇒ Object
Returns the value of attribute default_frame_rate.
4 5 6 |
# File 'lib/tasks/mxmlc.rb', line 4 def default_frame_rate @default_frame_rate end |
#default_script_limits ⇒ Object
Returns the value of attribute default_script_limits.
4 5 6 |
# File 'lib/tasks/mxmlc.rb', line 4 def default_script_limits @default_script_limits end |
#default_size ⇒ Object
Returns the value of attribute default_size.
4 5 6 |
# File 'lib/tasks/mxmlc.rb', line 4 def default_size @default_size end |
#external_library_path ⇒ Object
Returns the value of attribute external_library_path.
4 5 6 |
# File 'lib/tasks/mxmlc.rb', line 4 def external_library_path @external_library_path end |
#frames ⇒ Object
Returns the value of attribute frames.
4 5 6 |
# File 'lib/tasks/mxmlc.rb', line 4 def frames @frames end |
#incremental ⇒ Object
Returns the value of attribute incremental.
4 5 6 |
# File 'lib/tasks/mxmlc.rb', line 4 def incremental @incremental end |
#input ⇒ Object
Returns the value of attribute input.
4 5 6 |
# File 'lib/tasks/mxmlc.rb', line 4 def input @input end |
#library_path ⇒ Object
Returns the value of attribute library_path.
4 5 6 |
# File 'lib/tasks/mxmlc.rb', line 4 def library_path @library_path end |
#link_report ⇒ Object
Returns the value of attribute link_report.
4 5 6 |
# File 'lib/tasks/mxmlc.rb', line 4 def link_report @link_report end |
#load_externs ⇒ Object
Returns the value of attribute load_externs.
4 5 6 |
# File 'lib/tasks/mxmlc.rb', line 4 def load_externs @load_externs end |
#locale ⇒ Object
Returns the value of attribute locale.
4 5 6 |
# File 'lib/tasks/mxmlc.rb', line 4 def locale @locale end |
#optimize ⇒ Object
Returns the value of attribute optimize.
4 5 6 |
# File 'lib/tasks/mxmlc.rb', line 4 def optimize @optimize end |
#output ⇒ Object
Returns the value of attribute output.
4 5 6 |
# File 'lib/tasks/mxmlc.rb', line 4 def output @output end |
#runtime_shared_libraries ⇒ Object
Returns the value of attribute runtime_shared_libraries.
4 5 6 |
# File 'lib/tasks/mxmlc.rb', line 4 def runtime_shared_libraries @runtime_shared_libraries end |
#show_actionscript_warnings ⇒ Object
Returns the value of attribute show_actionscript_warnings.
4 5 6 |
# File 'lib/tasks/mxmlc.rb', line 4 def show_actionscript_warnings @show_actionscript_warnings end |
#source_path ⇒ Object
Returns the value of attribute source_path.
4 5 6 |
# File 'lib/tasks/mxmlc.rb', line 4 def source_path @source_path end |
#theme ⇒ Object
Returns the value of attribute theme.
4 5 6 |
# File 'lib/tasks/mxmlc.rb', line 4 def theme @theme end |
#use_network ⇒ Object
Returns the value of attribute use_network.
4 5 6 |
# File 'lib/tasks/mxmlc.rb', line 4 def use_network @use_network end |
#warnings ⇒ Object
Returns the value of attribute warnings.
4 5 6 |
# File 'lib/tasks/mxmlc.rb', line 4 def warnings @warnings end |
Instance Method Details
#add_path(path) ⇒ Object
138 139 140 141 142 |
# File 'lib/tasks/mxmlc.rb', line 138 def add_path(path) input_files = FileList[File.dirname(path) + '/**/*.as'] file input_files file @output => input_files end |
#add_path_list(list) ⇒ Object
131 132 133 134 135 136 |
# File 'lib/tasks/mxmlc.rb', line 131 def add_path_list(list) list.collect do |path| add_path(path) clean_path(path) end end |
#clean_path(path) ⇒ Object
144 145 146 147 148 149 |
# File 'lib/tasks/mxmlc.rb', line 144 def clean_path(path) if(!path.index(' ').nil?) path = %{"#{path}"} end return path end |
#define ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/tasks/mxmlc.rb', line 44 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 |t| execute(@target, option_list.join(' ')) end CLEAN.add(@output) if(@incremental) CLEAN.add(FileList['**/**/*.cache']) end desc "Compile #{@name} using MXMLC" task @name => [@output] end |
#el ⇒ Object
92 93 94 |
# File 'lib/tasks/mxmlc.rb', line 92 def el return @external_library_path end |
#execute(cmd, args, retries = 0) ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/tasks/mxmlc.rb', line 70 def execute(cmd, args, retries=0) begin sh("#{cmd} #{args}") rescue default_mxmlc_osx_path = "/Applications/Adobe\ Flex\ Builder\ 2/Flex\ SDK\ 2/bin" default_flex_home_path = File.join(ENV['FLEX_HOME'], 'bin', cmd) if(retries == 0 && File.exists?(default_mxmlc_osx_path)) ENV['PATH'] = ENV['PATH'] + ':' + default_mxmlc_osx_path execute(cmd, args, 1) return elsif(retries == 0 && File.exists?(default_flex_home_path)) execute("'#{default_flex_home_path}'", args, 1) return end puts 'There was an error executing mxmlc, please make sure mxmlc is in your class path and can be executed from the same environment this rake task was run from' end end |
#l ⇒ Object
100 101 102 |
# File 'lib/tasks/mxmlc.rb', line 100 def l return @library_path end |
#option_list ⇒ Object
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/tasks/mxmlc.rb', line 104 def option_list result = @options.dup result << "-accessible" if accessible result << "-debug" if debug result << "-optimize" if optimize result << "-warnings" if 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
96 97 98 |
# File 'lib/tasks/mxmlc.rb', line 96 def rsl return @runtime_shared_libraries end |
#sp ⇒ Object
88 89 90 |
# File 'lib/tasks/mxmlc.rb', line 88 def sp return @source_path end |