module Airake #:nodoc: module Commands #:nodoc: # ADT (Adobe Developer Tool) # # http://livedocs.adobe.com/labs/air/1/devappsflex/help.html?content=CommandLineTools_5.html class Adt < Base attr_reader :path, :certificate, :extra_opts, :assets, :air_path, :appxml_path, :swf_path, :base_dir # options:: :adt_path, :certificate, :adt_extra_opts, :assets, :air_path, :appxml_path, :swf_path, :base_dir def initialize(options = {}) @path = options[:adt_path] || "adt" @extra_opts = options[:adt_extra_opts] with_options(options) end # Get the ADT package command def package raise ArgumentError, "Must specify :base_dir" unless base_dir command = [] command << path command << extra_opts command << "-package" command << "-certificate #{certificate}" unless certificate.blank? command << escape(relative_path(air_path, base_dir)) command << escape(relative_path(appxml_path, base_dir)) command << escape(relative_path(swf_path, base_dir)) 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:: :org_unit, :org, :country # # Example result: adt -certificate -cn ADigitalID 1024-RSA SigningCert.pfx 39#wnetx3tl def generate_certificate(common_name, pfx_file, key_type, password, optionals = {}) command = [] command << path command << "-certificate" command << "-cn #{common_name}" command << "-ou #{optionals[:org_unit]}" if !optionals[:org_unit].blank? command << "-o #{optionals[:org]}" if !optionals[:org].blank? command << "-c #{optionals[:country]}" if !optionals[:country].blank? command << key_type command << escape(pfx_file) command << password process(command) end end end end