asrake 0.13.0 → 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/asrake/adt.rb +60 -28
  2. metadata +2 -2
data/lib/asrake/adt.rb CHANGED
@@ -6,6 +6,7 @@ module ASRake
6
6
  class Adt < BaseTask
7
7
 
8
8
  include Rake::DSL
9
+ include ASRake
9
10
 
10
11
  # http://help.adobe.com/en_US/air/build/WS5b3ccc516d4fbf351e63e3d118666ade46-7ff1.html
11
12
  attr_accessor :application_descriptor
@@ -38,26 +39,43 @@ class Adt < BaseTask
38
39
 
39
40
  def initialize(file)
40
41
 
41
- self.application_descriptor = "application.xml"
42
42
  self.storetype = "pkcs12"
43
43
  self.target = "air"
44
44
  self.include_files = []
45
+
45
46
  @keystore = "cert.p12"
47
+ @application_descriptor = "application.xml"
46
48
 
47
49
  super(file)
48
50
 
49
- create_keystore_task
51
+ self.include_files.each do |value|
52
+ files = Path::forward value.sub(' ', '/')
53
+ files.sub!(/\.$/, "*")
54
+ FileList[files].each {|file| Rake::FileTask.define_task self.output => file}
55
+ end
56
+
57
+ # add a prerequisite file task for all files included in the package
58
+ #def include_files.<<(value)
59
+ # super
60
+ # files = Path::forward value.sub(' ', '/')
61
+ # files.sub!(/\.$/, "*")
62
+ # FileList[files].each {|file| puts @output; Rake::FileTask.define_task @output => file}
63
+ #end
64
+
65
+ create_keystore_task()
66
+ create_application_descriptor_task()
50
67
 
51
68
  end
52
69
 
53
70
  # define named task first so if desc was called it will be attached to it instead of the file task
54
71
  def execute
55
72
 
56
- fail "You must define 'output' for #{self}" if self.output == nil
57
- fail "You must define 'application_descriptor'" if self.application_descriptor == nil || !File.exists?(self.application_descriptor)
58
- fail "You must define 'keystore' for #{self}" if self.keystore == nil
59
- fail "You must define 'keystore_name' for #{self}" if self.keystore_name == nil
60
- fail "You must define 'storepass' for #{self}" if self.storepass == nil
73
+ raise "You must define 'output' for #{self}" if self.output == nil
74
+ raise "You must define 'application_descriptor'" if self.application_descriptor == nil || !File.exists?(self.application_descriptor)
75
+ raise "You must define 'keystore' for #{self}" if self.keystore == nil
76
+ raise "You must define 'keystore_name' for #{self}" if self.keystore_name == nil
77
+ raise "You must define 'storepass' for #{self}" if self.storepass == nil
78
+ raise "You must define 'include_files' for #{self}\neg: include_files << 'bin .'" if self.include_files.length < 1
61
79
 
62
80
  # TODO: Somehow confirm that the initialWindow content is included in the build
63
81
  #app_xml = Nokogiri::XML(File.read(application_descriptor))
@@ -74,69 +92,83 @@ class Adt < BaseTask
74
92
  command << " -target #{target}" if target != nil && target != "air"
75
93
  command << " #{self.output}"
76
94
  command << " #{self.application_descriptor}"
95
+ self.include_files.each {|entry| command << " -C #{entry}" }
77
96
  command << " #{additional_args}" if self.additional_args != nil
78
- if self.include_files == nil || self.include_files.length < 1
79
- command << " -C #{self.output_dir} ."
80
- else
81
- self.include_files.each {|entry| command << " -C #{entry}" }
82
- end
97
+
83
98
  status = run command, false
99
+
84
100
  if status.exitstatus != 0
85
101
  case status.exitstatus
86
102
  when 2
87
- fail "Usage error\n" +
103
+ raise "Usage error\n" +
88
104
  "Check the command line arguments for errors"
89
105
  when 5
90
- fail "Unknown error\n" +
106
+ raise "Unknown error\n" +
91
107
  "This error indicates a situation that cannot be explained by common error conditions.\n" +
92
- "Possible root causes include incompatibility between ADT and the Java Runtime Environment,\n"
108
+ "Possible root causes include incompatibility between ADT and the Java Runtime Environment,\n" +
93
109
  "corrupt ADT or JRE installations, and programming errors within ADT."
94
110
  when 6
95
- fail "Could not write to output directory\n" +
111
+ raise "Could not write to output directory\n" +
96
112
  "Make sure that the specified (or implied) output directory is accessible and\n" +
97
113
  "that the containing drive has sufficient disk space."
98
114
  when 7
99
- fail "Could not access certificate\n" +
115
+ raise "Could not access certificate\n" +
100
116
  "Make sure that the path to the keystore is specified correctly: #{self.keystore}\n" +
101
117
  "Make sure that the keystore password is correct: #{self.storepass}"
102
118
  #"Check that the certificate within the keystore can be accessed."
103
119
  when 8
104
- fail "Invalid certificate\n" +
120
+ raise "Invalid certificate\n" +
105
121
  "The certificate file is malformed, modified, expired, or revoked."
106
122
  when 9
107
- fail "Could not sign AIR file\n" +
123
+ raise "Could not sign AIR file\n" +
108
124
  "Verify the signing options passed to ADT."
109
125
  when 10
110
- fail "Could not create time stamp\n" +
126
+ raise "Could not create time stamp\n" +
111
127
  "ADT could not establish a connection to the timestamp server.\n" +
112
128
  "If you connect to the internet through a proxy server, you may need to configure\n" +
113
129
  "the JRE proxy settings. There have also been errors reported with Java 7: \n" +
114
130
  "http://www.flashdevelop.org/community/viewtopic.php?p=41221\n" +
115
131
  "You can disable checking a timestamp server by setting 'tsa' to 'none' in your task"
116
132
  when 11
117
- fail "Certificate creation error\n" +
133
+ raise "Certificate creation error\n" +
118
134
  "Verify the command line arguments used for creating signatures."
119
135
  when 12
120
- fail "Invalid input\n" +
121
- "Verify file paths and other arguments passed to ADT on the command line."#\n" +
122
- #"Be sure the initial content in #{self.application_descriptor} is included in the build:\n" +
136
+ raise "Invalid input\n" +
137
+ "Verify file paths and other arguments passed to ADT on the command line.\n" +
138
+ "Be sure the initial content in #{self.application_descriptor} is included in the build by\n" +
139
+ "appnding it to includ_files (eg, adt.include_files << 'bin .')"
123
140
  #"<initialWindow>\n <content>#{swf}</content>\n</initialWindow>"
124
141
  else
125
- fail "Operation exited with status #{status.exitstatus}"
142
+ raise "Operation exited with status #{status.exitstatus}"
126
143
  end
127
144
  end
128
145
  end
129
146
 
130
147
  def keystore= value
131
- remove_keystore_task()
148
+ # clear prvious keystore task
149
+ Rake::Task[@keystore].clear
132
150
  @keystore = value
133
151
  create_keystore_task()
134
152
  end
135
153
 
154
+ def application_descriptor= value
155
+ # clear the previous task
156
+ Rake::Task[@application_descriptor].clear
157
+ @application_descriptor = value
158
+ create_application_descriptor_task()
159
+ end
160
+
136
161
  private
137
162
 
138
- def remove_keystore_task
139
- Rake::Task[@keystore].clear
163
+ def create_application_descriptor_task
164
+ if File.exists?(@application_descriptor)
165
+ file self.output => @application_descriptor
166
+
167
+ #app_xml = Nokogiri::XML(File.read(@application_descriptor))
168
+ #swf = app_xml.at_css("initialWindow > content").content.to_s
169
+ #file self.output => swf
170
+ #raise "Initial content in #{@application_descriptor} does not exist" if !File.exists?(swf)
171
+ end
140
172
  end
141
173
 
142
174
  def create_keystore_task
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asrake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.13.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-21 00:00:00.000000000 Z
12
+ date: 2012-10-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri