Sha256: b2ed669d954373ad27c6a08cfeb3a501e6925a89ed94c9457ac266866c111891

Contents?: true

Size: 1.6 KB

Versions: 1

Compression:

Stored size: 1.6 KB

Contents

module Airake
  
  module Commands
    
    class Amxmlc < Airake::Commands::Base
      
      attr_reader :project, :path, :extra_opts
      
      def initialize(project, options = {})
        @project = project
        @path = options[:amxmlc_path] || "amxmlc"
        @extra_opts = options[:amxmlc_extra_opts]
      end
            
      # Get the amxmlc 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.2 lib/airake/commands/amxmlc.rb