Sha256: c7e985871877bb8c5bc660fd457be034958590b9aa6f55acdaebd2642af2c127

Contents?: true

Size: 1.78 KB

Versions: 3

Compression:

Stored size: 1.78 KB

Contents

module Airake #:nodoc:
  
  module Commands #:nodoc:
    
    # AMXMLC (AIR MXML compiler)
    #
    # http://livedocs.adobe.com/labs/air/1/devappsflex/help.html?content=CommandLineTools_2.html#1032546
    class Amxmlc < Base
      
      attr_reader :amxmlc_path, :amxmlc_extra_opts, :swf_path, :mxml_path, :lib_dir, :src_dirs, :debug
      
      # Build with options:
      #
      #   amxmlc_path: Path to flex compiler, defaults to 'mxmlc +configname=air'
      #   swf_path: Path to generated swf (required)
      #   mxml_path: Path to mxml (required)
      #   lib_dir: Path to lib directory. Will load swc files from here or source directories
      #   src_dirs: Path to source directories (required)
      #   amxmlc_extra_opts: Extra options to pass to compiler
      #
      def initialize(options = {})
        assert_required(options, [ :swf_path, :mxml_path, :src_dirs ])
        with_options(options, { :amxmlc_path => "mxmlc +configname=air" })               
        
        @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
            
      # Get the amxmlc compile command
      def compile
        command = []
        command << @amxmlc_path
        command << @amxmlc_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(@mxml_path)
        process(command)
      end
      
    end
    
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
airake-0.2.13 lib/airake/commands/amxmlc.rb
airake-0.2.14 lib/airake/commands/amxmlc.rb
airake-0.3.1 lib/airake/commands/amxmlc.rb