asrake 0.12.4 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/asrake/adt.rb +152 -0
- data/lib/asrake/asdoc.rb +14 -13
- data/lib/asrake/base_compiler.rb +16 -13
- data/lib/asrake/base_task.rb +14 -8
- data/lib/asrake/compc.rb +27 -36
- data/lib/asrake/flexsdk.rb +18 -7
- data/lib/asrake/mxmlc.rb +0 -1
- data/lib/asrake/package.rb +2 -3
- data/lib/asrake/util.rb +12 -7
- metadata +3 -3
- data/lib/asrake/adt_task.rb +0 -150
data/lib/asrake/adt.rb
ADDED
@@ -0,0 +1,152 @@
|
|
1
|
+
require 'asrake/util'
|
2
|
+
require 'asrake/base_task'
|
3
|
+
require 'nokogiri'
|
4
|
+
|
5
|
+
module ASRake
|
6
|
+
class Adt < BaseTask
|
7
|
+
|
8
|
+
include Rake::DSL
|
9
|
+
|
10
|
+
# http://help.adobe.com/en_US/air/build/WS5b3ccc516d4fbf351e63e3d118666ade46-7ff1.html
|
11
|
+
attr_accessor :application_descriptor
|
12
|
+
|
13
|
+
#
|
14
|
+
# The path to the keystore file for file-based store types.
|
15
|
+
#
|
16
|
+
attr_accessor :keystore
|
17
|
+
#
|
18
|
+
# The alias of a key in the keystore. Specifying an alias is not necessary when a keystore only contains
|
19
|
+
# a single certificate. If no alias is specified, ADT uses the first key in the keystore.
|
20
|
+
#
|
21
|
+
attr_accessor :alias
|
22
|
+
attr_accessor :storetype
|
23
|
+
attr_accessor :storepass
|
24
|
+
attr_accessor :keystore_name
|
25
|
+
#
|
26
|
+
# Specifies the URL of an RFC3161-compliant timestamp server to time-stamp the digital signature.
|
27
|
+
# If no URL is specified, a default time-stamp server provided by Geotrust is used. When the signature
|
28
|
+
# of an AIR application is time-stamped, the application can still be installed after the signing
|
29
|
+
# certificate expires, because the timestamp verifies that the certificate was valid at the time of signing.
|
30
|
+
#
|
31
|
+
attr_accessor :tsa
|
32
|
+
|
33
|
+
attr_accessor :target
|
34
|
+
|
35
|
+
attr_accessor :include_files
|
36
|
+
|
37
|
+
attr_accessor :additional_args
|
38
|
+
|
39
|
+
def initialize(file)
|
40
|
+
|
41
|
+
self.application_descriptor = "application.xml"
|
42
|
+
self.storetype = "pkcs12"
|
43
|
+
self.target = "air"
|
44
|
+
self.include_files = []
|
45
|
+
@keystore = "cert.p12"
|
46
|
+
|
47
|
+
super(file)
|
48
|
+
|
49
|
+
create_keystore_task
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
# define named task first so if desc was called it will be attached to it instead of the file task
|
54
|
+
def execute
|
55
|
+
|
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
|
61
|
+
|
62
|
+
# TODO: Somehow confirm that the initialWindow content is included in the build
|
63
|
+
#app_xml = Nokogiri::XML(File.read(application_descriptor))
|
64
|
+
#swf = app_xml.at_css("initialWindow > content").content.to_s
|
65
|
+
#swf = File.join(@output_dir, swf)
|
66
|
+
#puts swf
|
67
|
+
|
68
|
+
command = "#{FlexSDK::adt}"
|
69
|
+
command << " -package"
|
70
|
+
command << " -tsa #{self.tsa}" if self.tsa != nil
|
71
|
+
command << " -storetype #{self.storetype}"
|
72
|
+
command << " -keystore #{self.keystore}"
|
73
|
+
command << " -storepass #{self.storepass}"
|
74
|
+
command << " -target #{target}" if target != nil && target != "air"
|
75
|
+
command << " #{self.output}"
|
76
|
+
command << " #{self.application_descriptor}"
|
77
|
+
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
|
83
|
+
status = run command, false
|
84
|
+
if status.exitstatus != 0
|
85
|
+
case status.exitstatus
|
86
|
+
when 2
|
87
|
+
fail "Usage error\n" +
|
88
|
+
"Check the command line arguments for errors"
|
89
|
+
when 5
|
90
|
+
fail "Unknown error\n" +
|
91
|
+
"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"
|
93
|
+
"corrupt ADT or JRE installations, and programming errors within ADT."
|
94
|
+
when 6
|
95
|
+
fail "Could not write to output directory\n" +
|
96
|
+
"Make sure that the specified (or implied) output directory is accessible and\n" +
|
97
|
+
"that the containing drive has sufficient disk space."
|
98
|
+
when 7
|
99
|
+
fail "Could not access certificate\n" +
|
100
|
+
"Make sure that the path to the keystore is specified correctly: #{self.keystore}\n" +
|
101
|
+
"Make sure that the keystore password is correct: #{self.storepass}"
|
102
|
+
#"Check that the certificate within the keystore can be accessed."
|
103
|
+
when 8
|
104
|
+
fail "Invalid certificate\n" +
|
105
|
+
"The certificate file is malformed, modified, expired, or revoked."
|
106
|
+
when 9
|
107
|
+
fail "Could not sign AIR file\n" +
|
108
|
+
"Verify the signing options passed to ADT."
|
109
|
+
when 10
|
110
|
+
fail "Could not create time stamp\n" +
|
111
|
+
"ADT could not establish a connection to the timestamp server.\n" +
|
112
|
+
"If you connect to the internet through a proxy server, you may need to configure\n" +
|
113
|
+
"the JRE proxy settings. There have also been errors reported with Java 7: \n" +
|
114
|
+
"http://www.flashdevelop.org/community/viewtopic.php?p=41221\n" +
|
115
|
+
"You can disable checking a timestamp server by setting 'tsa' to 'none' in your task"
|
116
|
+
when 11
|
117
|
+
fail "Certificate creation error\n" +
|
118
|
+
"Verify the command line arguments used for creating signatures."
|
119
|
+
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" +
|
123
|
+
#"<initialWindow>\n <content>#{swf}</content>\n</initialWindow>"
|
124
|
+
else
|
125
|
+
fail "Operation exited with status #{status.exitstatus}"
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
def keystore= value
|
131
|
+
remove_keystore_task()
|
132
|
+
@keystore = value
|
133
|
+
create_keystore_task()
|
134
|
+
end
|
135
|
+
|
136
|
+
private
|
137
|
+
|
138
|
+
def remove_keystore_task
|
139
|
+
Rake::Task[@keystore].clear
|
140
|
+
end
|
141
|
+
|
142
|
+
def create_keystore_task
|
143
|
+
file self.keystore do
|
144
|
+
run "#{FlexSDK::adt} -certificate -cn #{self.keystore_name} 1024-RSA #{self.keystore} #{self.storepass}"
|
145
|
+
puts "Certificate created at #{self.keystore} with password '#{self.storepass}'"
|
146
|
+
end
|
147
|
+
|
148
|
+
file self.output => self.keystore
|
149
|
+
end
|
150
|
+
|
151
|
+
end
|
152
|
+
end
|
data/lib/asrake/asdoc.rb
CHANGED
@@ -6,8 +6,8 @@ require 'nokogiri'
|
|
6
6
|
|
7
7
|
class ASRake::Asdoc
|
8
8
|
|
9
|
-
include ASRake::PathUtils
|
10
9
|
include Rake::DSL
|
10
|
+
include ASRake
|
11
11
|
|
12
12
|
attr_accessor :additional_args
|
13
13
|
|
@@ -140,27 +140,29 @@ class ASRake::Asdoc
|
|
140
140
|
end
|
141
141
|
|
142
142
|
def execute(&block)
|
143
|
-
|
144
|
-
|
143
|
+
args = ""
|
145
144
|
@@compiler_args.each do |name, type|
|
146
145
|
arg = name.to_s.gsub('_','-')
|
147
146
|
value = instance_variable_get("@#{name}")
|
148
147
|
case type
|
149
148
|
when :bool
|
150
|
-
|
149
|
+
args << " -#{arg}=#{value}" if value
|
151
150
|
when :dirs
|
152
151
|
value.flatten!
|
153
152
|
value.uniq!
|
154
153
|
value = value.map{|s| s.index(' ') != nil ? "\"#{s}\"" : s} if value.length > 1
|
155
|
-
|
154
|
+
args << " -#{arg} #{Path::forward value.join(' ')}" if !value.empty?
|
156
155
|
when :dir
|
157
|
-
|
156
|
+
if value != nil
|
157
|
+
value = "\"#{value}\"" if value.index(' ') != nil
|
158
|
+
args << " -#{arg}=#{Path::forward value}"
|
159
|
+
end
|
158
160
|
when :array
|
159
161
|
value.flatten!
|
160
162
|
value.uniq!
|
161
|
-
|
163
|
+
args << " -#{arg} #{value.join(' ')}" if !value.empty?
|
162
164
|
when :string
|
163
|
-
|
165
|
+
args << " -#{arg} #{value}" if value != nil
|
164
166
|
else
|
165
167
|
fail "unknown type #{type}"
|
166
168
|
end
|
@@ -169,15 +171,14 @@ class ASRake::Asdoc
|
|
169
171
|
# Use doc-sources argument if it has been assigned (duh) or if neither doc-classes or doc-namespaces have
|
170
172
|
# been assigned and source-path has
|
171
173
|
if !self.doc_sources.empty?
|
172
|
-
|
174
|
+
args << " -doc-sources #{Path::forward doc_sources.join(' ')}"
|
173
175
|
elsif !self.source_path.empty? && self.doc_classes.empty? && self.doc_namespaces.empty?
|
174
|
-
|
176
|
+
args << " -doc-sources #{Path::forward source_path.join(' ')}" if !self.source_path.empty?
|
175
177
|
end
|
176
178
|
|
177
|
-
|
179
|
+
args << " #{additional_args}" if self.additional_args != nil
|
178
180
|
|
179
|
-
|
180
|
-
run(command, true, &block)
|
181
|
+
run("#{FlexSDK::asdoc} #{args}", true, &block)
|
181
182
|
end
|
182
183
|
|
183
184
|
end
|
data/lib/asrake/base_compiler.rb
CHANGED
@@ -5,7 +5,6 @@ require 'nokogiri'
|
|
5
5
|
module ASRake
|
6
6
|
class BaseCompiler < BaseTask
|
7
7
|
|
8
|
-
include ASRake::PathUtils
|
9
8
|
include Rake::DSL
|
10
9
|
|
11
10
|
#
|
@@ -44,6 +43,14 @@ class BaseCompiler < BaseTask
|
|
44
43
|
|
45
44
|
super(file)
|
46
45
|
|
46
|
+
# set dependencies on all .as and .mxml files in the source paths
|
47
|
+
dependencies = FileList.new
|
48
|
+
self.source_path.each do |path|
|
49
|
+
dependencies.include(Path::forward File.join(path, "**/*.as"))
|
50
|
+
dependencies.include(Path::forward File.join(path, "**/*.mxml"))
|
51
|
+
end
|
52
|
+
file(self.output => dependencies) if !dependencies.empty?
|
53
|
+
|
47
54
|
# allow setting source_path with '=' instead of '<<'
|
48
55
|
# actually, no, this is really bad and confusing we should probably throw when they try to assign
|
49
56
|
#self.source_path = [self.source_path] if self.source_path.is_a? String
|
@@ -102,7 +109,6 @@ class BaseCompiler < BaseTask
|
|
102
109
|
flex_config = Nokogiri::XML(File.read(config))
|
103
110
|
|
104
111
|
is_target_defined = true if flex_config.at_css('target-player')
|
105
|
-
#configSource? = true if
|
106
112
|
end
|
107
113
|
end
|
108
114
|
end
|
@@ -112,16 +118,13 @@ class BaseCompiler < BaseTask
|
|
112
118
|
# TODO: iterate over all non-default config files provided and look for source-path entries
|
113
119
|
#fail "You must add at least one path to 'source_path' for #{self}" if source_path.empty? && !configSource?
|
114
120
|
|
115
|
-
# TODO: iterate over all non-default config files provided and look for output
|
116
|
-
fail "You must define 'output' for #{self}" if self.output == nil
|
117
|
-
|
118
121
|
#
|
119
122
|
# validation complete, generate build args
|
120
123
|
#
|
121
124
|
|
122
125
|
args = ""
|
123
126
|
# set output as directory if it ends in a trailing slash
|
124
|
-
args << " -output=#{
|
127
|
+
args << " -output=#{Path::forward output}"
|
125
128
|
args << " -directory=true" if output_is_dir?
|
126
129
|
|
127
130
|
args << " -target-player=#{target_player}" if self.target_player != nil
|
@@ -130,23 +133,23 @@ class BaseCompiler < BaseTask
|
|
130
133
|
args << " +configname=air" if self.isAIR
|
131
134
|
|
132
135
|
args << " -debug=#{debug}"
|
133
|
-
args << " -source-path=#{
|
136
|
+
args << " -source-path=#{Path::forward source_path.join(',')}" if !self.source_path.empty?
|
134
137
|
|
135
138
|
# add the -load-config option if it is anything other than the default
|
136
139
|
unless self.load_config.length == 1 && is_default_config?(self.load_config[0])
|
137
140
|
# if the default flex config is still in the load_config array, then append all config files, otherwise have the first one replace
|
138
141
|
op = has_default_config_file? ? "+=" : "="
|
139
142
|
self.load_config.each do |config|
|
140
|
-
args << " -load-config#{op}#{
|
143
|
+
args << " -load-config#{op}#{Path::forward config}" unless is_default_config?(config)
|
141
144
|
op = "+="
|
142
145
|
end
|
143
146
|
end
|
144
147
|
|
145
|
-
args << " -library-path=#{
|
146
|
-
args << " -external-library-path=#{
|
147
|
-
args << " -include-libraries=#{
|
148
|
+
args << " -library-path=#{Path::forward library_path.join(',')}" if !self.library_path.empty?
|
149
|
+
args << " -external-library-path=#{Path::forward external_library_path.join(',')}" if !self.external_library_path.empty?
|
150
|
+
args << " -include-libraries=#{Path::forward include_libraries.join(',')}" if !self.include_libraries.empty?
|
148
151
|
|
149
|
-
args << " -dump-config=#{
|
152
|
+
args << " -dump-config=#{Path::forward dump_config}" if self.dump_config != nil
|
150
153
|
|
151
154
|
args << " #{additional_args}" if self.additional_args != nil
|
152
155
|
#args << ' -include-file images\core_logo.png ..\nexuslib\code\etc\core_logo.png'
|
@@ -180,7 +183,7 @@ class BaseCompiler < BaseTask
|
|
180
183
|
advice = []
|
181
184
|
if((target_player == nil || Float(target_player) < 11) && line.include?("Error: Access of undefined property JSON"))
|
182
185
|
advice << "Be sure you are compiling with 'target_player' set to 11.0 or higher"
|
183
|
-
advice << "to have access to the native JSON parser.
|
186
|
+
advice << "to have access to the native JSON parser. Your target_player is currently #{target_player}"
|
184
187
|
elsif line.include?("Error: The definition of base class Object was not found")
|
185
188
|
advice << "If you have removed the default flex-config by setting 'load_config' to"
|
186
189
|
advice << "an empty or alternate value using = instead of << you must be sure to"
|
data/lib/asrake/base_task.rb
CHANGED
@@ -3,20 +3,19 @@ require 'asrake/util'
|
|
3
3
|
module ASRake
|
4
4
|
class BaseTask
|
5
5
|
|
6
|
-
include ASRake::PathUtils
|
7
6
|
include Rake::DSL
|
8
7
|
|
9
8
|
#
|
10
|
-
#
|
9
|
+
# output file or directory
|
11
10
|
#
|
12
11
|
|
13
12
|
attr_reader :output
|
14
13
|
attr_reader :output_file
|
15
14
|
attr_reader :output_dir
|
16
15
|
|
17
|
-
def initialize(file
|
16
|
+
def initialize(file)
|
18
17
|
|
19
|
-
raise "
|
18
|
+
raise "An output file must be provided" if file == nil
|
20
19
|
|
21
20
|
@output = file.to_s
|
22
21
|
# if the output path ends in a path separator, it is a directory
|
@@ -24,7 +23,7 @@ class BaseTask
|
|
24
23
|
@output_dir = @output
|
25
24
|
else
|
26
25
|
# forward-slashes required for File methods
|
27
|
-
@output =
|
26
|
+
@output = Path::forward @output
|
28
27
|
@output_dir = File.dirname(@output)
|
29
28
|
@output_file = File.basename(@output)
|
30
29
|
end
|
@@ -35,9 +34,7 @@ class BaseTask
|
|
35
34
|
file self.output do
|
36
35
|
self.execute
|
37
36
|
# TODO: Want to output this even if the dependencies are met and the task isn't run
|
38
|
-
|
39
|
-
result << " (#{File.size(output)} bytes)" unless self.output_is_dir?
|
40
|
-
puts result
|
37
|
+
puts "#{Path::env self.output} (#{File.size(output)} bytes)" unless self.output_is_dir?
|
41
38
|
end
|
42
39
|
|
43
40
|
# create directory task for output
|
@@ -62,6 +59,15 @@ class BaseTask
|
|
62
59
|
@output
|
63
60
|
end
|
64
61
|
|
62
|
+
def to_str
|
63
|
+
@output
|
64
|
+
end
|
65
|
+
|
66
|
+
# this is probably a terrible idea
|
67
|
+
def pathmap *args
|
68
|
+
to_s.pathmap *args
|
69
|
+
end
|
70
|
+
|
65
71
|
def execute
|
66
72
|
raise "Must define execute in subclass"
|
67
73
|
end
|
data/lib/asrake/compc.rb
CHANGED
@@ -5,7 +5,6 @@ require 'asrake/asdoc'
|
|
5
5
|
module ASRake
|
6
6
|
class Compc < BaseCompiler
|
7
7
|
|
8
|
-
include ASRake::PathUtils
|
9
8
|
include Rake::DSL
|
10
9
|
|
11
10
|
attr_accessor :include_asdoc
|
@@ -15,52 +14,44 @@ class Compc < BaseCompiler
|
|
15
14
|
#
|
16
15
|
def initialize(swc_file)
|
17
16
|
super(swc_file, FlexSDK::compc)
|
17
|
+
end
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
asdoc = ASRake::Asdoc.new File.join(self.output_dir, ".asrake_temp")
|
31
|
-
asdoc.add(self)
|
32
|
-
asdoc.keep_xml = true
|
33
|
-
asdoc.skip_xsl = true
|
34
|
-
asdoc.lenient = true
|
35
|
-
# capture output in a block to prevent it from going to console
|
36
|
-
asdoc.execute { |line| }
|
19
|
+
def execute
|
20
|
+
super
|
21
|
+
# include asdoc if needed
|
22
|
+
if self.include_asdoc
|
23
|
+
asdoc = ASRake::Asdoc.new File.join(self.output_dir, ".asrake_temp_#{Time.now.to_i}_#{rand(1000)}")
|
24
|
+
asdoc.add(self)
|
25
|
+
asdoc.keep_xml = true
|
26
|
+
asdoc.skip_xsl = true
|
27
|
+
asdoc.lenient = true
|
28
|
+
puts "> #{FlexSDK::asdoc}"
|
29
|
+
asdoc.execute {|line| puts "> #{line}"}
|
37
30
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
end
|
31
|
+
if output_is_dir?
|
32
|
+
cp_r "#{asdoc.output}/tempdita", File.join(self.output_dir, "docs")
|
33
|
+
else
|
34
|
+
Zip::ZipFile.open(self.output) do |zipfile|
|
35
|
+
# remove existing docs (eg, from -include-libraries linking a swc with pre-existing docs)
|
36
|
+
begin
|
37
|
+
zipfile.remove("docs")
|
38
|
+
rescue
|
39
|
+
#no rescue
|
40
|
+
end
|
41
|
+
FileList["#{asdoc.output}/tempdita/*"].each do |file|
|
42
|
+
zipfile.add("docs/#{File.basename(file)}", file)
|
51
43
|
end
|
52
44
|
end
|
53
|
-
|
54
|
-
rm_rf asdoc.output, :verbose => false
|
55
45
|
end
|
56
|
-
end
|
57
46
|
|
47
|
+
rm_rf asdoc.output, :verbose => false
|
48
|
+
end
|
58
49
|
end
|
59
50
|
|
60
51
|
def generate_args
|
61
52
|
compc = super
|
62
53
|
|
63
|
-
#compc << " -include-sources=#{
|
54
|
+
#compc << " -include-sources=#{Path::forward source_path.join(',')}" if !source_path.empty?
|
64
55
|
self.source_path.each do |path|
|
65
56
|
compc << " -include-classes #{ASRake::get_classes(path).join(' ')}"
|
66
57
|
end
|
data/lib/asrake/flexsdk.rb
CHANGED
@@ -3,10 +3,11 @@ require 'asrake/util'
|
|
3
3
|
class FlexSDK
|
4
4
|
|
5
5
|
SDK_PATHS = []
|
6
|
+
SDK_PATHS << ENV["FLEX_HOME"].dup if defined?(ENV) && ENV["FLEX_HOME"] != nil
|
6
7
|
|
7
8
|
class << self
|
8
|
-
|
9
|
-
include ASRake
|
9
|
+
|
10
|
+
include ASRake
|
10
11
|
|
11
12
|
@@initialized = false
|
12
13
|
|
@@ -36,25 +37,33 @@ class << self
|
|
36
37
|
@@initialized = true
|
37
38
|
@@root = nil
|
38
39
|
missing = {}
|
39
|
-
|
40
|
-
|
40
|
+
|
41
|
+
# clean up paths
|
42
|
+
SDK_PATHS.map do |path|
|
43
|
+
path.strip!
|
41
44
|
#remove /bin/ fom the end of the path if it exists
|
42
45
|
path.sub!(/[\/\\]bin[\/\\]?$/,'')
|
46
|
+
end
|
47
|
+
|
48
|
+
# Find where the flex sdk is installed
|
49
|
+
SDK_PATHS.each do |path|
|
43
50
|
if File.exists?(path)
|
44
51
|
missing[SDK_PATHS] = []
|
45
52
|
|
46
53
|
@@configs.each do |name|
|
47
|
-
config =
|
54
|
+
config = Path::env File.join(path, 'frameworks', "#{name}.xml")
|
48
55
|
missing[SDK_PATHS] << config if !File.exists?(config)
|
49
56
|
config = "\"#{config}\"" if config =~ /\s/
|
50
57
|
instance_variable_set "@#{name.gsub('-','_')}", config
|
58
|
+
(instance_variable_get "@#{name.gsub('-','_')}").freeze
|
51
59
|
end
|
52
60
|
|
53
61
|
@@executables.each do |name|
|
54
|
-
exec =
|
62
|
+
exec = Path::env File.join(path, 'bin', name)
|
55
63
|
missing[SDK_PATHS] << exec if !File.exists?(exec)
|
56
64
|
exec = "\"#{exec}\"" if exec =~ /\s/
|
57
65
|
instance_variable_set "@#{name}", exec
|
66
|
+
(instance_variable_get "@#{name}").freeze
|
58
67
|
end
|
59
68
|
|
60
69
|
if missing[SDK_PATHS].empty?
|
@@ -72,7 +81,9 @@ class << self
|
|
72
81
|
str << SDK_PATHS.join("\n=> ")
|
73
82
|
str << "\n"
|
74
83
|
end
|
75
|
-
str << "Append a valid SDK path in your rakefile, e.g.:\
|
84
|
+
str << "Append a valid SDK path in your rakefile, e.g.:\n"
|
85
|
+
str << "FlexSDK::SDK_PATHS << 'C:\\develop\\sdk\\flex_sdk_4.6.0.23201'\n"
|
86
|
+
str << "or add an environment variable FLEX_HOME"
|
76
87
|
#str << "\nFor more information, see: http://adobe.com/go/flex_sdk/"
|
77
88
|
fail str
|
78
89
|
end
|
data/lib/asrake/mxmlc.rb
CHANGED
data/lib/asrake/package.rb
CHANGED
@@ -5,7 +5,6 @@ require 'zip/zip'
|
|
5
5
|
module ASRake
|
6
6
|
class Package < BaseTask
|
7
7
|
|
8
|
-
include ASRake::PathUtils
|
9
8
|
include Rake::DSL
|
10
9
|
|
11
10
|
attr_accessor :files
|
@@ -20,7 +19,7 @@ class Package < BaseTask
|
|
20
19
|
def files= value
|
21
20
|
@files = value
|
22
21
|
files.each do |to, from|
|
23
|
-
file output => [
|
22
|
+
file output => [Path::forward(from)]
|
24
23
|
end
|
25
24
|
end
|
26
25
|
|
@@ -32,7 +31,7 @@ class Package < BaseTask
|
|
32
31
|
rm_r output rescue nil
|
33
32
|
Zip::ZipFile.open(output, Zip::ZipFile::CREATE) do |zipfile|
|
34
33
|
files.each do |to, from|
|
35
|
-
zipfile.add(
|
34
|
+
zipfile.add(Path::forward(to), Path::forward(from))
|
36
35
|
end
|
37
36
|
end
|
38
37
|
end
|
data/lib/asrake/util.rb
CHANGED
@@ -33,19 +33,21 @@ class << self
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
module ASRake::
|
37
|
-
|
38
|
-
|
36
|
+
module ASRake::Path
|
37
|
+
class << self
|
38
|
+
def env(str)
|
39
|
+
ASRake::OS::is_windows? ? back(str) : forward(str)
|
39
40
|
end
|
40
41
|
|
41
|
-
def
|
42
|
+
def back(str)
|
42
43
|
str.gsub("/", "\\")
|
43
44
|
end
|
44
45
|
|
45
|
-
def
|
46
|
+
def forward(str)
|
46
47
|
str.gsub("\\", "/")
|
47
48
|
end
|
48
49
|
end
|
50
|
+
end
|
49
51
|
|
50
52
|
def run(command, abort_on_failure = true)
|
51
53
|
command.strip!
|
@@ -53,8 +55,11 @@ def run(command, abort_on_failure = true)
|
|
53
55
|
puts "> #{command}" if !block_given?
|
54
56
|
IO.popen("#{command} 2>&1") do |proc|
|
55
57
|
while !proc.closed? && (line = proc.gets)
|
56
|
-
|
57
|
-
|
58
|
+
if block_given?
|
59
|
+
yield line
|
60
|
+
else
|
61
|
+
puts "> #{line}"
|
62
|
+
end
|
58
63
|
end
|
59
64
|
end
|
60
65
|
|
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.
|
4
|
+
version: 0.13.0
|
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-
|
12
|
+
date: 2012-10-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -69,7 +69,7 @@ executables: []
|
|
69
69
|
extensions: []
|
70
70
|
extra_rdoc_files: []
|
71
71
|
files:
|
72
|
-
- lib/asrake/
|
72
|
+
- lib/asrake/adt.rb
|
73
73
|
- lib/asrake/asdoc.rb
|
74
74
|
- lib/asrake/base_compiler.rb
|
75
75
|
- lib/asrake/base_task.rb
|
data/lib/asrake/adt_task.rb
DELETED
@@ -1,150 +0,0 @@
|
|
1
|
-
require 'asrake/util'
|
2
|
-
require 'rake/tasklib'
|
3
|
-
require 'nokogiri'
|
4
|
-
|
5
|
-
module ASRake
|
6
|
-
class AdtTask < Rake::TaskLib
|
7
|
-
|
8
|
-
include ASRake::PathUtils
|
9
|
-
include Rake::DSL
|
10
|
-
|
11
|
-
attr_accessor :output
|
12
|
-
# http://help.adobe.com/en_US/air/build/WS5b3ccc516d4fbf351e63e3d118666ade46-7ff1.html
|
13
|
-
attr_accessor :application_descriptor
|
14
|
-
|
15
|
-
#
|
16
|
-
# The path to the keystore file for file-based store types.
|
17
|
-
#
|
18
|
-
attr_accessor :keystore
|
19
|
-
#
|
20
|
-
# The alias of a key in the keystore. Specifying an alias is not necessary when a keystore only contains
|
21
|
-
# a single certificate. If no alias is specified, ADT uses the first key in the keystore.
|
22
|
-
#
|
23
|
-
attr_accessor :alias
|
24
|
-
attr_accessor :storetype
|
25
|
-
attr_accessor :storepass
|
26
|
-
attr_accessor :keystore_name
|
27
|
-
#
|
28
|
-
# Specifies the URL of an RFC3161-compliant timestamp server to time-stamp the digital signature.
|
29
|
-
# If no URL is specified, a default time-stamp server provided by Geotrust is used. When the signature
|
30
|
-
# of an AIR application is time-stamped, the application can still be installed after the signing
|
31
|
-
# certificate expires, because the timestamp verifies that the certificate was valid at the time of signing.
|
32
|
-
#
|
33
|
-
attr_accessor :tsa
|
34
|
-
|
35
|
-
attr_accessor :additional_args
|
36
|
-
|
37
|
-
attr_reader :output_file
|
38
|
-
attr_reader :output_dir
|
39
|
-
attr_reader :keystore_file
|
40
|
-
attr_reader :keystore_dir
|
41
|
-
|
42
|
-
def initialize(name = :package)
|
43
|
-
self.application_descriptor = "application.xml";
|
44
|
-
self.storetype = "pkcs12"
|
45
|
-
|
46
|
-
yield self if block_given?
|
47
|
-
|
48
|
-
fail "You must define 'output' for #{self}" if self.output == nil
|
49
|
-
fail "You must define 'application_descriptor' for #{self}" if self.application_descriptor == nil || !File.exists?(self.application_descriptor)
|
50
|
-
fail "You must define 'keystore' for #{self}" if self.keystore == nil
|
51
|
-
fail "You must define 'keystore_name' for #{self}" if self.keystore_name == nil
|
52
|
-
fail "You must define 'storepass' for #{self}" if self.storepass == nil
|
53
|
-
|
54
|
-
# TODO: Somehow confirm that the initialWindow content is included in the build
|
55
|
-
app_xml = Nokogiri::XML(File.read(application_descriptor))
|
56
|
-
swf = app_xml.at_css("initialWindow > content").content.to_s
|
57
|
-
#swf = File.join(@output_dir, swf)
|
58
|
-
#puts swf
|
59
|
-
|
60
|
-
# define named task first so if desc was called it will be attached to it instead of the file task
|
61
|
-
Rake::Task.define_task name do
|
62
|
-
command = "#{FlexSDK::adt}"
|
63
|
-
command << " -package"
|
64
|
-
command << " -tsa #{self.tsa}" if self.tsa != nil
|
65
|
-
command << " -storetype #{self.storetype}"
|
66
|
-
command << " -keystore #{self.keystore}"
|
67
|
-
command << " -storepass #{self.storepass}"
|
68
|
-
command << " #{self.output} #{self.application_descriptor}"
|
69
|
-
command << " #{additional_args}" if self.additional_args != nil
|
70
|
-
status = run command, false
|
71
|
-
if status.exitstatus != 0
|
72
|
-
case status.exitstatus
|
73
|
-
when 2
|
74
|
-
fail "Usage error\n" +
|
75
|
-
"Check the command line arguments for errors"
|
76
|
-
when 5
|
77
|
-
fail "Unknown error\n" +
|
78
|
-
"This error indicates a situation that cannot be explained by common error conditions.\n" +
|
79
|
-
"Possible root causes include incompatibility between ADT and the Java Runtime Environment,\n"
|
80
|
-
"corrupt ADT or JRE installations, and programming errors within ADT."
|
81
|
-
when 6
|
82
|
-
fail "Could not write to output directory\n" +
|
83
|
-
"Make sure that the specified (or implied) output directory is accessible and\n" +
|
84
|
-
"that the containing drive has sufficient disk space."
|
85
|
-
when 7
|
86
|
-
fail "Could not access certificate\n" +
|
87
|
-
"Make sure that the path to the keystore is specified correctly: #{self.keystore}\n" +
|
88
|
-
"Make sure that the keystore password is correct: #{self.storepass}"
|
89
|
-
#"Check that the certificate within the keystore can be accessed."
|
90
|
-
when 8
|
91
|
-
fail "Invalid certificate\n" +
|
92
|
-
"The certificate file is malformed, modified, expired, or revoked."
|
93
|
-
when 9
|
94
|
-
fail "Could not sign AIR file\n" +
|
95
|
-
"Verify the signing options passed to ADT."
|
96
|
-
when 10
|
97
|
-
fail "Could not create time stamp\n" +
|
98
|
-
"ADT could not establish a connection to the timestamp server.\n" +
|
99
|
-
"If you connect to the internet through a proxy server, you may need to configure\n" +
|
100
|
-
"the JRE proxy settings. There have also been errors reported with Java 7: \n" +
|
101
|
-
"http://www.flashdevelop.org/community/viewtopic.php?p=41221\n" +
|
102
|
-
"You can disable checking a timestamp server by setting 'tsa' to 'none' in your task"
|
103
|
-
when 11
|
104
|
-
fail "Certificate creation error\n" +
|
105
|
-
"Verify the command line arguments used for creating signatures."
|
106
|
-
when 12
|
107
|
-
fail "Invalid input\n" +
|
108
|
-
"Verify file paths and other arguments passed to ADT on the command line."#\n" +
|
109
|
-
#"Be sure the initial content in #{self.application_descriptor} is included in the build:\n" +
|
110
|
-
#"<initialWindow>\n <content>#{swf}</content>\n</initialWindow>"
|
111
|
-
else
|
112
|
-
fail "Operation exited with status #{status.exitstatus}"
|
113
|
-
end
|
114
|
-
end
|
115
|
-
puts "#{c output} (#{File.size(self.output)} bytes)"
|
116
|
-
end
|
117
|
-
|
118
|
-
# if the task name is a hash (ie, has dependencies defined) make sure we pull out the task name from it
|
119
|
-
name, _ = name.first if name.is_a? Hash
|
120
|
-
|
121
|
-
@output_dir = File.dirname(self.output)
|
122
|
-
@output_file = File.basename(self.output)
|
123
|
-
|
124
|
-
@keystore_dir = File.dirname(self.keystore)
|
125
|
-
@keystore_file = File.basename(self.keystore)
|
126
|
-
|
127
|
-
directory self.output_dir
|
128
|
-
|
129
|
-
# setup file dependencies
|
130
|
-
#file output => output_dir
|
131
|
-
#files.each do |to, from|
|
132
|
-
# file output => [cf(from)]
|
133
|
-
#end
|
134
|
-
|
135
|
-
#add output file task as a dependency to the named task created
|
136
|
-
#task name => output
|
137
|
-
|
138
|
-
task name => self.output_dir
|
139
|
-
|
140
|
-
file self.keystore do
|
141
|
-
run "#{FlexSDK::adt} -certificate -cn #{self.keystore_name} 1024-RSA #{self.keystore} #{self.storepass}"
|
142
|
-
puts "Certificate created at #{self.keystore} with password '#{self.storepass}'"
|
143
|
-
end
|
144
|
-
|
145
|
-
task name => self.keystore
|
146
|
-
|
147
|
-
end
|
148
|
-
|
149
|
-
end
|
150
|
-
end
|