Sha256: 3a0bf76134fb28cb8440ea69c04dab90038b3a9024487b7a4f0e6bf15ab973da

Contents?: true

Size: 1.95 KB

Versions: 2

Compression:

Stored size: 1.95 KB

Contents

module Airake
  
  module Commands
    
    # ADT (Adobe Developer Tool)
    #
    # http://livedocs.adobe.com/labs/air/1/devappsflex/help.html?content=CommandLineTools_5.html
    class Adt < Base
      
      attr_reader :project, :path, :certificate, :extra_opts, :assets
      
      # options:: :adt_path, :certificate, :adt_extra_opts, :assets
      def initialize(project, options = {})
        @project = project
        @path = options[:adt_path] || "adt"
        @certificate = options[:certificate]
        @extra_opts = options[:adt_extra_opts]
        @assets = options[:assets]
      end
            
      # Get the ADT package command
      def package
        command = []
        command << @path
        command << @extra_opts
        command << "-package"
        command << "-certificate #{@certificate}"        
        command << escape(project.relative_path(project.air_path))
        command << escape(project.relative_path(project.appxml_path))
        command << escape(project.relative_path(project.swf_path))
        command << @assets
        process(command)
      end
      
      # Get the ADT certificate command to generate a certificate
      #
      # cn:: Common name
      # pfx_file:: Output certificate path
      # key_type:: 1024-RSA, 2048-RSA
      # password:: Password
      # optionals:: :ou, :o, :c
      #
      # Example result: adt -certificate -cn ADigitalID 1024-RSA SigningCert.pfx 39#wnetx3tl
      def certificate(cn, pfx_file, key_type, password, optionals = {})
        command = []
        command << @path
        command << "-certificate"
        command << "-cn #{cn}"
        command << "-ou #{optionals[:ou]}" if !optionals[:ou].blank?
        command << "-o #{optionals[:o]}" if !optionals[:o].blank?
        command << "-c #{optionals[:c]}" if !optionals[:c].blank?
        command << key_type
        command << escape(pfx_file)
        command << password
        process(command)
      end      
      
    end
    
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
airake-0.2.5 lib/airake/commands/adt.rb
airake-0.2.6 lib/airake/commands/adt.rb