Class: ASRake::Adt
- Inherits:
-
BaseExecutable
- Object
- BaseExecutable
- ASRake::Adt
- Includes:
- ASRake, Rake::DSL
- Defined in:
- lib/asrake/adt.rb
Instance Attribute Summary collapse
-
#additional_args ⇒ Object
Returns the value of attribute additional_args.
-
#alias ⇒ Object
a single certificate.
- #application_descriptor ⇒ Object
-
#include_files ⇒ Object
Returns the value of attribute include_files.
-
#keystore ⇒ Object
The path to the keystore file for file-based store types.
-
#keystore_name ⇒ Object
Returns the value of attribute keystore_name.
-
#storepass ⇒ Object
Returns the value of attribute storepass.
-
#storetype ⇒ Object
Returns the value of attribute storetype.
-
#target ⇒ Object
Returns the value of attribute target.
-
#tsa ⇒ Object
certificate expires, because the timestamp verifies that the certificate was valid at the time of signing.
Attributes inherited from BaseExecutable
#output, #output_dir, #output_file
Instance Method Summary collapse
-
#execute ⇒ Object
define named task first so if desc was called it will be attached to it instead of the file task.
-
#initialize(file) ⇒ Adt
constructor
A new instance of Adt.
Methods included from ASRake
Methods inherited from BaseExecutable
#merge_in, #output_is_dir?, #pathmap, #to_s, #to_str
Constructor Details
#initialize(file) ⇒ Adt
Returns a new instance of Adt.
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/asrake/adt.rb', line 40 def initialize(file) super self.storetype = "pkcs12" self.target = "air" self.include_files = [] @keystore = "cert.p12" @application_descriptor = "application.xml" end |
Instance Attribute Details
#additional_args ⇒ Object
Returns the value of attribute additional_args.
38 39 40 |
# File 'lib/asrake/adt.rb', line 38 def additional_args @additional_args end |
#alias ⇒ Object
a single certificate. If no alias is specified, ADT uses the first key in the keystore.
22 23 24 |
# File 'lib/asrake/adt.rb', line 22 def alias @alias end |
#application_descriptor ⇒ Object
12 13 14 |
# File 'lib/asrake/adt.rb', line 12 def application_descriptor @application_descriptor end |
#include_files ⇒ Object
Returns the value of attribute include_files.
36 37 38 |
# File 'lib/asrake/adt.rb', line 36 def include_files @include_files end |
#keystore ⇒ Object
The path to the keystore file for file-based store types.
17 18 19 |
# File 'lib/asrake/adt.rb', line 17 def keystore @keystore end |
#keystore_name ⇒ Object
Returns the value of attribute keystore_name.
25 26 27 |
# File 'lib/asrake/adt.rb', line 25 def keystore_name @keystore_name end |
#storepass ⇒ Object
Returns the value of attribute storepass.
24 25 26 |
# File 'lib/asrake/adt.rb', line 24 def storepass @storepass end |
#storetype ⇒ Object
Returns the value of attribute storetype.
23 24 25 |
# File 'lib/asrake/adt.rb', line 23 def storetype @storetype end |
#target ⇒ Object
Returns the value of attribute target.
34 35 36 |
# File 'lib/asrake/adt.rb', line 34 def target @target end |
#tsa ⇒ Object
certificate expires, because the timestamp verifies that the certificate was valid at the time of signing.
32 33 34 |
# File 'lib/asrake/adt.rb', line 32 def tsa @tsa end |
Instance Method Details
#execute ⇒ Object
define named task first so if desc was called it will be attached to it instead of the file task
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/asrake/adt.rb', line 52 def execute #raise "You must define 'output' for #{self}" if self.output == nil #raise "You must define 'application_descriptor'" if self.application_descriptor == nil || !File.exists?(self.application_descriptor) #raise "You must define 'keystore' for #{self}" if self.keystore == nil #raise "You must define 'keystore_name' for #{self}" if self.keystore_name == nil #raise "You must define 'storepass' for #{self}" if self.storepass == nil #raise "You must define 'include_files' for #{self}\neg: include_files << 'bin .'" if self.include_files.length < 1 # TODO: Somehow confirm that the initialWindow content is included in the build #app_xml = Nokogiri::XML(File.read(application_descriptor)) #swf = app_xml.at_css("initialWindow > content").content.to_s #swf = File.join(@output_dir, swf) #puts swf command = "#{FlexSDK::adt}" command << " -package" command << " -tsa #{self.tsa}" if self.tsa != nil command << " -storetype #{self.storetype}" command << " -keystore #{self.keystore}" command << " -storepass #{self.storepass}" command << " -target #{target}" if target != nil && target != "air" command << " #{additional_args}" if self.additional_args != nil command << " #{self.output}" command << " #{self.application_descriptor}" self.include_files.each {|entry| command << " -C #{entry}" } status = run command, false if status.exitstatus != 0 case status.exitstatus when 2 raise "Usage error\n" + "Check the command line arguments for errors" when 5 raise "Unknown error\n" + "This error indicates a situation that cannot be explained by common error conditions.\n" + "Possible root causes include incompatibility between ADT and the Java Runtime Environment,\n" + "corrupt ADT or JRE installations, and programming errors within ADT." when 6 raise "Could not write to output directory\n" + "Make sure that the specified (or implied) output directory is accessible and\n" + "that the containing drive has sufficient disk space." when 7 raise "Could not access certificate\n" + "Make sure that the path to the keystore is specified correctly: #{self.keystore}\n" + "Make sure that the keystore password is correct: #{self.storepass}" #"Check that the certificate within the keystore can be accessed." when 8 raise "Invalid certificate\n" + "The certificate file is malformed, modified, expired, or revoked." when 9 raise "Could not sign AIR file\n" + "Verify the signing options passed to ADT." when 10 raise "Could not create time stamp\n" + "ADT could not establish a connection to the timestamp server.\n" + "If you connect to the internet through a proxy server, you may need to configure\n" + "the JRE proxy settings. There have also been errors reported with Java 7: \n" + "http://www.flashdevelop.org/community/viewtopic.php?p=41221\n" + "You can disable checking a timestamp server by setting 'tsa' to 'none' in your task" when 11 raise "Certificate creation error\n" + "Verify the command line arguments used for creating signatures." when 12 raise "Invalid input\n" + "Verify file paths and other arguments passed to ADT on the command line.\n" + "Be sure the initial content in #{self.application_descriptor} is included in the build by\n" + "appnding it to includ_files (eg, adt.include_files << 'bin .')" #"<initialWindow>\n <content>#{swf}</content>\n</initialWindow>" else raise "Operation exited with status #{status.exitstatus}" end end end |