Class: Airake::Commands::Adt

Inherits:
Base show all
Defined in:
lib/airake/commands/adt.rb

Overview

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#assert_not_blank, #assert_required, #escape, #include_classes, #library_paths, #process, #relative_path, #source_paths, #windows?, #with_options

Constructor Details

#initialize(options = {}) ⇒ Adt

Create ADT command.

Options

adt_path

Path to adt, defaults to ‘adt’

base_dir

Root directory for project (required). Directories like src, lib and bin should be visible from here.

air_path

Path to generated AIR file (required)

appxml_path

Path to application xml descriptor (required)

swf_path

Path to compiled SWF file (required)

assets

Path to any assets. Should a string with asset files and directories separated by spaces: ‘assets/icons/foo.png assets/images’

cert

Path to certificate

adt_extra_opts

Extra options for command line



24
25
26
# File 'lib/airake/commands/adt.rb', line 24

def initialize(options = {})        
  with_options(options, { :adt_path => "adt" })
end

Instance Attribute Details

#adt_extra_optsObject (readonly)

Returns the value of attribute adt_extra_opts.



10
11
12
# File 'lib/airake/commands/adt.rb', line 10

def adt_extra_opts
  @adt_extra_opts
end

#adt_pathObject (readonly)

Returns the value of attribute adt_path.



10
11
12
# File 'lib/airake/commands/adt.rb', line 10

def adt_path
  @adt_path
end

#air_pathObject (readonly)

Returns the value of attribute air_path.



10
11
12
# File 'lib/airake/commands/adt.rb', line 10

def air_path
  @air_path
end

#appxml_pathObject (readonly)

Returns the value of attribute appxml_path.



10
11
12
# File 'lib/airake/commands/adt.rb', line 10

def appxml_path
  @appxml_path
end

#assetsObject (readonly)

Returns the value of attribute assets.



10
11
12
# File 'lib/airake/commands/adt.rb', line 10

def assets
  @assets
end

#base_dirObject (readonly)

Returns the value of attribute base_dir.



10
11
12
# File 'lib/airake/commands/adt.rb', line 10

def base_dir
  @base_dir
end

#certObject (readonly)

Returns the value of attribute cert.



10
11
12
# File 'lib/airake/commands/adt.rb', line 10

def cert
  @cert
end

#swf_pathObject (readonly)

Returns the value of attribute swf_path.



10
11
12
# File 'lib/airake/commands/adt.rb', line 10

def swf_path
  @swf_path
end

Instance Method Details

#certificate(common_name, pfx_file, key_type, password, optionals = {}) ⇒ Object

ADT certificate command

  • cn: Common name

  • pfx_file: Output certificate path

  • key_type: 1024-RSA, 2048-RSA

  • password: Password

  • optionals:

    • org: Organization. ‘Adobe’

    • org_unit: Orginizational unit. ‘AIR Team’

    • country: Country. ‘USA’

Example result:

adt -certificate -cn ADigitalID 1024-RSA SigningCert.pfx 39#wnetx3tl


62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/airake/commands/adt.rb', line 62

def certificate(common_name, pfx_file, key_type, password, optionals = {})
  command = []
  command << @adt_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

#packageObject

Package



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/airake/commands/adt.rb', line 29

def package
  assert_not_blank(:air_path, :appxml_path, :swf_path)
  
  command = []
  command << @adt_path        
  command << "-package"        
  command << @adt_extra_opts
  
  unless @cert.blank?
    command << "-keystore #{@cert}" 
    command << "-storetype pkcs12"
  end
  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 unless @assets.nil?
  process(command)
end