Sha256: 466f825e36c18a14e86906c849ebe98a2f270eac4f89c01071f1b2995bb5526e

Contents?: true

Size: 1.78 KB

Versions: 1

Compression:

Stored size: 1.78 KB

Contents

module Airake
  
  module Commands
    
    # AMXMLC (AIR MXML compiler)
    #
    # http://livedocs.adobe.com/labs/air/1/devappsflex/help.html?content=CommandLineTools_2.html#1032546
    class Amxmlc < Base
      
      attr_reader :project, :path, :extra_opts
      
      # options:: :amxmlc_path, :amxmlc_extra_opts
      def initialize(project, options = {})
        @project = project
        @path = options[:amxmlc_path] || "amxmlc"
        @extra_opts = options[:amxmlc_extra_opts]
      end
            
      # Get the amxmlc compile command
      def compile
        command = []
        command << @path
        command << source_path_option
        command << library_path_option
        command << "-output"
        command << escape(project.swf_path)
        command << project.debug_option
        command << @extra_opts
        command << "-disable-incremental-optimizations=true"
        command << "--"
        command << escape(project.mxml_path)
        process(command)
      end
      
    protected
      
      def source_path_option      
        # List of directories in lib/ for source_path +=
        lib_source_paths = Dir["#{project.lib_dir}/*"].collect { |f| escape(f) if File.directory?(f) }.compact       
        lib_source_paths << escape(project.test_dir) if File.directory?(project.test_dir)
        lib_source_paths << escape(project.src_dir) if File.directory?(project.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(project.lib_dir) if File.directory?(project.lib_dir)
        library_paths.empty? ? "" : "-library-path+=#{library_paths.join(" ")}"
      end
      
    end
    
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
airake-0.2.5 lib/airake/commands/amxmlc.rb