Sha256: 0224d374573643f3aa4aca510390ee86e465e612544d7e9f8ac4748c6de3555b

Contents?: true

Size: 1.9 KB

Versions: 2

Compression:

Stored size: 1.9 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 :path, :extra_opts, :swf_path, :mxml_path, :lib_dir, :src_dir, :test_dir, :debug_option
      
      # options:: :amxmlc_path, :amxmlc_extra_opts, :swf_path, :mxml_path, :lib_dir, :src_dir, :test_dir, :debug_option
      def initialize(options = {})
        @path = options[:amxmlc_path] || "mxmlc +configname=air"
        @extra_opts = options[:amxmlc_extra_opts]
        with_options(options)        
      end
            
      # Get the amxmlc compile command
      def compile
        command = []
        command << path
        command << source_path_option
        command << library_path_option
        command << "-output"
        command << escape(swf_path)
        command << debug_option
        command << extra_opts      
        #command << "-disable-incremental-optimizations=true"  
        command << "--"
        command << escape(mxml_path)
        process(command)
      end
      
    protected
      
      def source_path_option      
        # List of directories in lib/ for source_path +=
        lib_source_paths = Dir["#{lib_dir}/*"].collect { |f| escape(f) if File.directory?(f) }.compact       
        lib_source_paths << escape(test_dir) if test_dir and File.directory?(test_dir)
        lib_source_paths << escape(src_dir) if src_dir and File.directory?(src_dir)

        source_paths ||= lib_source_paths
        source_paths.empty? ? "" : "-source-path #{source_paths.join(" ")}"
      end

      def library_path_option
        library_paths = []      
        library_paths << escape(lib_dir) if lib_dir and File.directory?(lib_dir)
        library_paths.empty? ? "" : "-library-path+=#{library_paths.join(" ")}"
      end
      
    end
    
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
airake-0.2.8 lib/airake/commands/amxmlc.rb
airake-0.2.7 lib/airake/commands/amxmlc.rb