Class: Sprout::ADTCertTask

Inherits:
ToolTask
  • Object
show all
Defined in:
lib/sprout/tasks/adt_task.rb,
lib/sprout/tasks/adt_cert_documentation.rb

Overview

The ADT Cert Task provides Rake support for the AIR Developer Tool certificate command. livedocs.adobe.com/flex/3/html/CommandLineTools_6.html#1034775

The certificate and associated private key generated by ADT are stored in a PKCS12-type keystore file. The password specified is set on the key itself, not the keystore.

The following example can be pasted in a file named ‘rakefile.rb’:

# Create an ADL task named :run dependent upon the swf that it is using for the window content
adt_cert :certificate do |t|
  t.cn = "Common name"
  t.keytype = "1024-RSA"
  t.keystore = "cert.p12"
  t.keypass = "thepassword"
end

Instance Method Summary collapse

Instance Method Details

#c=(string) ⇒ Object

A two-letter ISO-3166 country code. A certificate is not generated if an invalid code is supplied.



24
25
26
# File 'lib/sprout/tasks/adt_cert_documentation.rb', line 24

def c=(string)
  @c = string
end

#certificate=(boolean) ⇒ Object

Using -certificate option as default.



4
5
6
# File 'lib/sprout/tasks/adt_cert_documentation.rb', line 4

def certificate=(boolean)
  @certificate = boolean
end

#cn=(string) ⇒ Object

The string assigned as the common name of the new certificate.



9
10
11
# File 'lib/sprout/tasks/adt_cert_documentation.rb', line 9

def cn=(string)
  @cn = string
end

#initialize_taskObject



172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# File 'lib/sprout/tasks/adt_task.rb', line 172

def initialize_task
  super
  @default_gem_name = 'sprout-flex3sdk-tool'
  @default_gem_path = 'bin/adt'

  # Certificate command is "adt -certificate"
  add_param(:certificate, :boolean) do |p|
    p.description = "Using -certificate option as default."
    p.value = true
    p.hidden_value = true
  end
  
  add_param(:cn, :string) do |p|
    p.required = true
    p.delimiter = " "
    p.description = "The string assigned as the common name of the new certificate."
  end
  
  add_param(:ou, :string) do |p|
    p.delimiter = " "
    p.description = "Astring assigned as the organizational unit issuing the certificate."
  end
  
  add_param(:o, :string) do |p|
    p.delimiter = " "
    p.description = "A string assigned as the organization issuing the certificate."
  end
  
  add_param(:c, :string) do |p|
    p.delimiter = " "
    p.description = "A two-letter ISO-3166 country code. A certificate is not generated if an invalid code is supplied."
  end
  
  add_param(:keytype, :string) do |p|
    p.hidden_name = true
    p.required = true
    p.description = %{The type of key to use for the certificate, either "1024-RSA" or "2048-RSA".}
  end
  
  add_param(:keystore, :file) do |p|
    p.hidden_name = true
    p.required = true
    p.description = "The path for the certificate file to be generated."
  end
  
  add_param(:keypass, :string) do |p|
    p.hidden_name = true
    p.required = true
    p.description = "The password for the new certificate. The password is required when signing AIR files with this certificate."
  end      
end

#keypass=(string) ⇒ Object

The password for the new certificate. The password is required when signing AIR files with this certificate.



39
40
41
# File 'lib/sprout/tasks/adt_cert_documentation.rb', line 39

def keypass=(string)
  @keypass = string
end

#keystore=(file) ⇒ Object

The path for the certificate file to be generated.



34
35
36
# File 'lib/sprout/tasks/adt_cert_documentation.rb', line 34

def keystore=(file)
  @keystore = file
end

#keytype=(string) ⇒ Object

The type of key to use for the certificate, either “1024-RSA” or “2048-RSA”.



29
30
31
# File 'lib/sprout/tasks/adt_cert_documentation.rb', line 29

def keytype=(string)
  @keytype = string
end

#o=(string) ⇒ Object

A string assigned as the organization issuing the certificate.



19
20
21
# File 'lib/sprout/tasks/adt_cert_documentation.rb', line 19

def o=(string)
  @o = string
end

#ou=(string) ⇒ Object

Astring assigned as the organizational unit issuing the certificate.



14
15
16
# File 'lib/sprout/tasks/adt_cert_documentation.rb', line 14

def ou=(string)
  @ou = string
end

#prepareObject



224
225
226
227
228
229
230
# File 'lib/sprout/tasks/adt_task.rb', line 224

def prepare
  super
  # In case of spaces, need to escape them. Maybe have an option on StringParam to do this for us?
  cn.gsub!(/\s/, "\\ ") if cn
  ou.gsub!(/\s/, "\\ ") if ou
  o.gsub!(/\s/, "\\ ") if o
end