Class: Airake::Commands::Mxmlc
- Defined in:
- lib/airake/commands/mxmlc.rb
Overview
MXMLC (MXML compiler)
Instance Attribute Summary collapse
-
#config_name ⇒ Object
readonly
Returns the value of attribute config_name.
-
#debug ⇒ Object
readonly
Returns the value of attribute debug.
-
#lib_dir ⇒ Object
readonly
Returns the value of attribute lib_dir.
-
#mxmlc_extra_opts ⇒ Object
readonly
Returns the value of attribute mxmlc_extra_opts.
-
#mxmlc_path ⇒ Object
readonly
Returns the value of attribute mxmlc_path.
-
#src_dirs ⇒ Object
readonly
Returns the value of attribute src_dirs.
-
#swf_path ⇒ Object
readonly
Returns the value of attribute swf_path.
-
#target_file ⇒ Object
readonly
Returns the value of attribute target_file.
Instance Method Summary collapse
-
#compile ⇒ Object
Get the mxmlc compile command.
-
#initialize(options = {}) ⇒ Mxmlc
constructor
Create MXMLC command.
Methods inherited from Base
#assert_not_blank, #assert_required, #escape, #include_classes, #library_paths, #process, #relative_path, #source_paths, #windows?, #with_options
Constructor Details
#initialize(options = {}) ⇒ Mxmlc
Create MXMLC command.
Options
mxmlc_path
-
Path to flex compiler, defaults to ‘mxmlc’
swf_path
-
Path to generated swf (required)
target_file
-
Path to target file (.mxml file) (required)
lib_dir
-
Path to lib directory. Will load swc files from here or source directories
src_dirs
-
Path to source directories (required)
config_name
-
Config name, like ‘air’
mxmlc_extra_opts
-
Extra options to pass to compiler
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/airake/commands/mxmlc.rb', line 22 def initialize( = {}) assert_required(, [ :swf_path, :target_file, :src_dirs ]) default_mxmlc_path = [:config_name].blank? ? "mxmlc" : "mxmlc +configname=#{[:config_name]}" (, { :mxmlc_path => default_mxmlc_path }) @source_paths = source_paths(@src_dirs, @lib_dir) raise ArgumentError, "There aren't any valid source directories to compile" if @source_paths.empty? @library_path = escape(@lib_dir) if @lib_dir and File.directory?(@lib_dir) end |
Instance Attribute Details
#config_name ⇒ Object (readonly)
Returns the value of attribute config_name.
9 10 11 |
# File 'lib/airake/commands/mxmlc.rb', line 9 def config_name @config_name end |
#debug ⇒ Object (readonly)
Returns the value of attribute debug.
8 9 10 |
# File 'lib/airake/commands/mxmlc.rb', line 8 def debug @debug end |
#lib_dir ⇒ Object (readonly)
Returns the value of attribute lib_dir.
8 9 10 |
# File 'lib/airake/commands/mxmlc.rb', line 8 def lib_dir @lib_dir end |
#mxmlc_extra_opts ⇒ Object (readonly)
Returns the value of attribute mxmlc_extra_opts.
8 9 10 |
# File 'lib/airake/commands/mxmlc.rb', line 8 def mxmlc_extra_opts @mxmlc_extra_opts end |
#mxmlc_path ⇒ Object (readonly)
Returns the value of attribute mxmlc_path.
8 9 10 |
# File 'lib/airake/commands/mxmlc.rb', line 8 def mxmlc_path @mxmlc_path end |
#src_dirs ⇒ Object (readonly)
Returns the value of attribute src_dirs.
8 9 10 |
# File 'lib/airake/commands/mxmlc.rb', line 8 def src_dirs @src_dirs end |
#swf_path ⇒ Object (readonly)
Returns the value of attribute swf_path.
8 9 10 |
# File 'lib/airake/commands/mxmlc.rb', line 8 def swf_path @swf_path end |
#target_file ⇒ Object (readonly)
Returns the value of attribute target_file.
8 9 10 |
# File 'lib/airake/commands/mxmlc.rb', line 8 def target_file @target_file end |
Instance Method Details
#compile ⇒ Object
Get the mxmlc compile command
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/airake/commands/mxmlc.rb', line 35 def compile command = [] command << @mxmlc_path command << @mxmlc_extra_opts command << "-source-path #{@source_paths.join(" ")}" command << "-library-path+=#{@library_path}" unless @library_path.blank? command << "-output" command << escape(@swf_path) command << "-debug=#{@debug}" unless @debug.nil? command << "--" command << escape(@target_file) process(command) end |