asrake 0.13.3 → 0.14.0
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.
- data/asrake.gemspec +1 -1
- data/lib/asrake/adt.rb +28 -47
- data/lib/asrake/asdoc.rb +18 -4
- data/lib/asrake/base_compiler.rb +34 -20
- data/lib/asrake/{base_task.rb → base_executable.rb} +23 -10
- data/lib/asrake/exe_task.rb +20 -0
- data/lib/asrake/mxmlc.rb +22 -0
- data/lib/asrake/package.rb +2 -2
- data/lib/asrake/util.rb +2 -2
- data/lib/asrake/version_task.rb +3 -3
- metadata +4 -3
data/asrake.gemspec
CHANGED
data/lib/asrake/adt.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'asrake/util'
|
2
|
-
require 'asrake/
|
2
|
+
require 'asrake/base_executable'
|
3
3
|
require 'nokogiri'
|
4
4
|
|
5
5
|
module ASRake
|
6
|
-
class Adt <
|
6
|
+
class Adt < BaseExecutable
|
7
7
|
|
8
8
|
include Rake::DSL
|
9
9
|
include ASRake
|
@@ -38,6 +38,7 @@ class Adt < BaseTask
|
|
38
38
|
attr_accessor :additional_args
|
39
39
|
|
40
40
|
def initialize(file)
|
41
|
+
super
|
41
42
|
|
42
43
|
self.storetype = "pkcs12"
|
43
44
|
self.target = "air"
|
@@ -45,26 +46,6 @@ class Adt < BaseTask
|
|
45
46
|
|
46
47
|
@keystore = "cert.p12"
|
47
48
|
@application_descriptor = "application.xml"
|
48
|
-
|
49
|
-
super(file)
|
50
|
-
|
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()
|
67
|
-
|
68
49
|
end
|
69
50
|
|
70
51
|
# define named task first so if desc was called it will be attached to it instead of the file task
|
@@ -90,10 +71,10 @@ class Adt < BaseTask
|
|
90
71
|
command << " -keystore #{self.keystore}"
|
91
72
|
command << " -storepass #{self.storepass}"
|
92
73
|
command << " -target #{target}" if target != nil && target != "air"
|
74
|
+
command << " #{additional_args}" if self.additional_args != nil
|
93
75
|
command << " #{self.output}"
|
94
76
|
command << " #{self.application_descriptor}"
|
95
77
|
self.include_files.each {|entry| command << " -C #{entry}" }
|
96
|
-
command << " #{additional_args}" if self.additional_args != nil
|
97
78
|
|
98
79
|
status = run command, false
|
99
80
|
|
@@ -144,40 +125,40 @@ class Adt < BaseTask
|
|
144
125
|
end
|
145
126
|
end
|
146
127
|
|
147
|
-
|
148
|
-
# clear prvious keystore task
|
149
|
-
Rake::Task[@keystore].clear
|
150
|
-
@keystore = value
|
151
|
-
create_keystore_task()
|
152
|
-
end
|
128
|
+
protected
|
153
129
|
|
154
|
-
def
|
155
|
-
|
156
|
-
Rake::Task[@application_descriptor].clear
|
157
|
-
@application_descriptor = value
|
158
|
-
create_application_descriptor_task()
|
159
|
-
end
|
130
|
+
def task_pre_invoke
|
131
|
+
super
|
160
132
|
|
161
|
-
|
133
|
+
dependencies = FileList.new
|
134
|
+
self.include_files.each do |value|
|
135
|
+
dependencies.include(Path::forward value.sub(' ', '/').sub(/\.$/, "*"))
|
136
|
+
end
|
137
|
+
@task.enhance(dependencies) if !dependencies.empty?
|
162
138
|
|
163
|
-
|
164
|
-
|
165
|
-
|
139
|
+
if self.keystore != nil
|
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
|
+
@task.enhance([self.keystore])
|
145
|
+
end
|
166
146
|
|
147
|
+
if self.application_descriptor != nil && File.exists?(self.application_descriptor)
|
148
|
+
@task.enhance([self.application_descriptor])
|
167
149
|
#app_xml = Nokogiri::XML(File.read(@application_descriptor))
|
168
150
|
#swf = app_xml.at_css("initialWindow > content").content.to_s
|
169
151
|
#file self.output => swf
|
170
152
|
#raise "Initial content in #{@application_descriptor} does not exist" if !File.exists?(swf)
|
171
153
|
end
|
172
|
-
end
|
173
|
-
|
174
|
-
def create_keystore_task
|
175
|
-
file self.keystore do
|
176
|
-
run "#{FlexSDK::adt} -certificate -cn #{self.keystore_name} 1024-RSA #{self.keystore} #{self.storepass}"
|
177
|
-
puts "Certificate created at #{self.keystore} with password '#{self.storepass}'"
|
178
|
-
end
|
179
154
|
|
180
|
-
file
|
155
|
+
# add a prerequisite file task for all files included in the package
|
156
|
+
#def include_files.<<(value)
|
157
|
+
# super
|
158
|
+
# files = Path::forward value.sub(' ', '/')
|
159
|
+
# files.sub!(/\.$/, "*")
|
160
|
+
# FileList[files].each {|file| puts @output; Rake::FileTask.define_task @output => file}
|
161
|
+
#end
|
181
162
|
end
|
182
163
|
|
183
164
|
end
|
data/lib/asrake/asdoc.rb
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
require 'asrake/util'
|
2
|
-
require 'rake/tasklib'
|
3
2
|
require 'nokogiri'
|
4
3
|
|
5
4
|
# http://help.adobe.com/en_US/flex/using/WSd0ded3821e0d52fe1e63e3d11c2f44bc36-7ffa.html
|
6
5
|
|
7
6
|
module ASRake
|
8
|
-
class Asdoc <
|
7
|
+
class Asdoc < BaseExecutable
|
9
8
|
|
10
9
|
include Rake::DSL
|
11
10
|
include ASRake
|
@@ -125,8 +124,6 @@ class Asdoc < BaseTask
|
|
125
124
|
end
|
126
125
|
|
127
126
|
@doc_sources = []
|
128
|
-
|
129
|
-
yield self if block_given?
|
130
127
|
end
|
131
128
|
|
132
129
|
def add(args)
|
@@ -179,5 +176,22 @@ class Asdoc < BaseTask
|
|
179
176
|
run("#{FlexSDK::asdoc} #{args}", true, &block)
|
180
177
|
end
|
181
178
|
|
179
|
+
protected
|
180
|
+
|
181
|
+
def handle_execute_error code
|
182
|
+
end
|
183
|
+
|
184
|
+
def task_pre_invoke
|
185
|
+
super
|
186
|
+
# set dependencies on all .as and .mxml files in the source paths
|
187
|
+
dependencies = FileList.new
|
188
|
+
self.source_path.each do |path|
|
189
|
+
dependencies.include(Path::forward File.join(path, "**/*.as"))
|
190
|
+
dependencies.include(Path::forward File.join(path, "**/*.mxml"))
|
191
|
+
end
|
192
|
+
dependencies.include(self.library_path) if !self.library_path.empty?
|
193
|
+
@task.enhance(dependencies) if !dependencies.empty?
|
194
|
+
end
|
195
|
+
|
182
196
|
end
|
183
197
|
end
|
data/lib/asrake/base_compiler.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
require 'asrake/
|
1
|
+
require 'asrake/base_executable'
|
2
2
|
require 'asrake/flexsdk'
|
3
3
|
require 'nokogiri'
|
4
4
|
|
5
5
|
module ASRake
|
6
|
-
class BaseCompiler <
|
6
|
+
class BaseCompiler < BaseExecutable
|
7
7
|
|
8
8
|
include Rake::DSL
|
9
9
|
|
@@ -30,6 +30,8 @@ class BaseCompiler < BaseTask
|
|
30
30
|
attr_accessor *@@args
|
31
31
|
|
32
32
|
def initialize(file, exe_path)
|
33
|
+
super(file)
|
34
|
+
|
33
35
|
@exe = exe_path
|
34
36
|
|
35
37
|
@isAIR = false
|
@@ -40,21 +42,11 @@ class BaseCompiler < BaseTask
|
|
40
42
|
@debug = false
|
41
43
|
#include default flex-config
|
42
44
|
@load_config = [ FlexSDK::flex_config ]
|
43
|
-
|
44
|
-
super(file)
|
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?
|
45
|
+
@additional_args = ""
|
53
46
|
|
54
47
|
# allow setting source_path with '=' instead of '<<'
|
55
48
|
# actually, no, this is really bad and confusing we should probably throw when they try to assign
|
56
49
|
#self.source_path = [self.source_path] if self.source_path.is_a? String
|
57
|
-
|
58
50
|
end
|
59
51
|
|
60
52
|
# provide a more understandable alias
|
@@ -133,7 +125,7 @@ class BaseCompiler < BaseTask
|
|
133
125
|
args << " +configname=air" if self.isAIR
|
134
126
|
|
135
127
|
args << " -debug=#{debug}"
|
136
|
-
args << " -source-path
|
128
|
+
args << " -source-path+=#{Path::forward source_path.join(',')}" if !self.source_path.empty?
|
137
129
|
|
138
130
|
# add the -load-config option if it is anything other than the default
|
139
131
|
unless self.load_config.length == 1 && is_default_config?(self.load_config[0])
|
@@ -145,24 +137,46 @@ class BaseCompiler < BaseTask
|
|
145
137
|
end
|
146
138
|
end
|
147
139
|
|
148
|
-
args << " -library-path
|
149
|
-
args << " -external-library-path
|
150
|
-
args << " -include-libraries
|
140
|
+
args << " -library-path+=#{Path::forward library_path.join(',')}" if !self.library_path.empty?
|
141
|
+
args << " -external-library-path+=#{Path::forward external_library_path.join(',')}" if !self.external_library_path.empty?
|
142
|
+
args << " -include-libraries+=#{Path::forward include_libraries.join(',')}" if !self.include_libraries.empty?
|
151
143
|
|
152
144
|
args << " -dump-config=#{Path::forward dump_config}" if self.dump_config != nil
|
153
145
|
|
154
|
-
args << " #{additional_args}" if self.additional_args != nil
|
155
|
-
#args << ' -include-file images\core_logo.png ..\nexuslib\code\etc\core_logo.png'
|
146
|
+
args << " #{additional_args}" if self.additional_args != nil && self.additional_args != ""
|
156
147
|
|
157
148
|
return args
|
158
149
|
end
|
159
150
|
|
160
151
|
def execute
|
161
152
|
puts "> #{@exe}#{generate_args}"
|
162
|
-
run "#{@exe}#{generate_args}" do |line|
|
153
|
+
status = run "#{@exe}#{generate_args}", false do |line|
|
163
154
|
puts "> #{line}"
|
164
155
|
generate_error_message_tips(line)
|
165
156
|
end
|
157
|
+
|
158
|
+
handle_execute_error status.exitstatus
|
159
|
+
|
160
|
+
raise "Operation exited with status #{status.exitstatus}" if status.exitstatus != 0
|
161
|
+
end
|
162
|
+
|
163
|
+
protected
|
164
|
+
|
165
|
+
def handle_execute_error code
|
166
|
+
end
|
167
|
+
|
168
|
+
def task_pre_invoke
|
169
|
+
super
|
170
|
+
# set dependencies on all .as and .mxml files in the source paths
|
171
|
+
dependencies = FileList.new
|
172
|
+
self.source_path.each do |path|
|
173
|
+
dependencies.include(Path::forward File.join(path, "**/*.as"))
|
174
|
+
dependencies.include(Path::forward File.join(path, "**/*.mxml"))
|
175
|
+
end
|
176
|
+
dependencies.include(self.library_path) if !self.library_path.empty?
|
177
|
+
dependencies.include(self.external_library_path) if !self.external_library_path.empty?
|
178
|
+
dependencies.include(self.include_libraries) if !self.include_libraries.empty?
|
179
|
+
@task.enhance(dependencies) if !dependencies.empty?
|
166
180
|
end
|
167
181
|
|
168
182
|
private
|
@@ -1,7 +1,8 @@
|
|
1
1
|
require 'asrake/util'
|
2
|
+
require 'asrake/exe_task'
|
2
3
|
|
3
4
|
module ASRake
|
4
|
-
class
|
5
|
+
class BaseExecutable
|
5
6
|
|
6
7
|
include Rake::DSL
|
7
8
|
|
@@ -16,7 +17,7 @@ class BaseTask
|
|
16
17
|
def initialize(file)
|
17
18
|
|
18
19
|
raise "An output file must be provided" if file == nil
|
19
|
-
|
20
|
+
|
20
21
|
@output = file.to_s
|
21
22
|
# if the output path ends in a path separator, it is a directory
|
22
23
|
if @output =~ /[\/\\]$/
|
@@ -28,19 +29,18 @@ class BaseTask
|
|
28
29
|
@output_file = File.basename(@output)
|
29
30
|
end
|
30
31
|
|
31
|
-
yield self if block_given?
|
32
|
-
|
33
32
|
# create file task for output
|
34
|
-
|
33
|
+
@task = ASRake::ExeTask.define_task self.output do
|
35
34
|
self.execute
|
36
|
-
# TODO: Want to output this even if the dependencies are met and the task isn't run
|
37
|
-
puts "#{Path::env self.output} (#{File.size(output)} bytes)" unless self.output_is_dir?
|
38
35
|
end
|
39
36
|
|
37
|
+
@task.pre_invoke = method(:task_pre_invoke)
|
38
|
+
@task.post_invoke = method(:task_post_invoke)
|
39
|
+
|
40
40
|
# create directory task for output
|
41
|
-
if !output_is_dir?
|
41
|
+
if !self.output_is_dir?
|
42
42
|
directory self.output_dir
|
43
|
-
|
43
|
+
@task.enhance([self.output_dir])
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
@@ -63,7 +63,7 @@ class BaseTask
|
|
63
63
|
@output
|
64
64
|
end
|
65
65
|
|
66
|
-
# this is probably a terrible idea
|
66
|
+
# used so we can add this task to a FileList. This is probably a terrible idea.
|
67
67
|
def pathmap *args
|
68
68
|
to_s.pathmap *args
|
69
69
|
end
|
@@ -72,5 +72,18 @@ class BaseTask
|
|
72
72
|
raise "Must define execute in subclass"
|
73
73
|
end
|
74
74
|
|
75
|
+
protected
|
76
|
+
|
77
|
+
def task_pre_invoke
|
78
|
+
# only run once to add prereqs
|
79
|
+
@task.pre_invoke = nil
|
80
|
+
end
|
81
|
+
|
82
|
+
def task_post_invoke
|
83
|
+
puts "#{Path::env self.output} (#{File.size(self.output)} bytes)" unless self.output_is_dir?
|
84
|
+
# only run once incase invoked again
|
85
|
+
@task.post_invoke = nil
|
86
|
+
end
|
87
|
+
|
75
88
|
end
|
76
89
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'asrake/util'
|
2
|
+
require 'rake/file_task'
|
3
|
+
|
4
|
+
module ASRake
|
5
|
+
class ExeTask < Rake::FileTask
|
6
|
+
|
7
|
+
attr_accessor :pre_invoke
|
8
|
+
attr_accessor :post_invoke
|
9
|
+
|
10
|
+
def initialize(task_name, app)
|
11
|
+
super
|
12
|
+
end
|
13
|
+
|
14
|
+
def invoke_with_call_chain(task_args, invocation_chain)
|
15
|
+
pre_invoke.call() if pre_invoke != nil
|
16
|
+
super
|
17
|
+
post_invoke.call() if post_invoke != nil
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/asrake/mxmlc.rb
CHANGED
@@ -6,10 +6,32 @@ module ASRake
|
|
6
6
|
class Mxmlc < BaseCompiler
|
7
7
|
|
8
8
|
include Rake::DSL
|
9
|
+
|
10
|
+
attr_accessor :file_specs
|
9
11
|
|
10
12
|
def initialize(swf_file)
|
11
13
|
super(swf_file, FlexSDK::mxmlc)
|
12
14
|
end
|
13
15
|
|
16
|
+
def generate_args
|
17
|
+
mxmlc = super
|
18
|
+
|
19
|
+
mxmlc << " -file-specs=#{file_specs}" if file_specs != nil
|
20
|
+
|
21
|
+
return mxmlc
|
22
|
+
end
|
23
|
+
|
24
|
+
protected
|
25
|
+
|
26
|
+
def handle_execute_error code
|
27
|
+
case code
|
28
|
+
when 1
|
29
|
+
raise "A target file can be specified by setting file_specs to a valid .as or .mxml file.\n" +
|
30
|
+
"eg:\n" +
|
31
|
+
" swf = ASRake::Mxmlc.new #{output}\n" +
|
32
|
+
" swf.file_specs = 'src/Main.as'" if file_specs == nil
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
14
36
|
end
|
15
37
|
end
|
data/lib/asrake/package.rb
CHANGED
data/lib/asrake/util.rb
CHANGED
data/lib/asrake/version_task.rb
CHANGED
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.14.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-
|
12
|
+
date: 2012-12-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -79,8 +79,9 @@ files:
|
|
79
79
|
- lib/asrake/adt.rb
|
80
80
|
- lib/asrake/asdoc.rb
|
81
81
|
- lib/asrake/base_compiler.rb
|
82
|
-
- lib/asrake/
|
82
|
+
- lib/asrake/base_executable.rb
|
83
83
|
- lib/asrake/compc.rb
|
84
|
+
- lib/asrake/exe_task.rb
|
84
85
|
- lib/asrake/file_utils.rb
|
85
86
|
- lib/asrake/flexsdk.rb
|
86
87
|
- lib/asrake/mxmlc.rb
|