asautotest 0.0.1 → 0.0.2
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/bin/asautotest +69 -24
- data/bin/flash-policy-server +5 -3
- data/lib/asautotest/problematic-file.rb +1 -1
- metadata +7 -5
data/bin/asautotest
CHANGED
@@ -44,7 +44,6 @@ require "asautotest/utilities"
|
|
44
44
|
module ASAutotest
|
45
45
|
FCSH = ENV["FCSH"] || "fcsh"
|
46
46
|
FLASHPLAYER = ENV["FLASHPLAYER"] || "flashplayer"
|
47
|
-
WATCH_GLOB = "**/[^.]*.{as,mxml}"
|
48
47
|
DEFAULT_TEST_PORT = 50102
|
49
48
|
GROWL_ERROR_TOKEN = "ASAutotest-#{ARGV.inspect.hash}"
|
50
49
|
|
@@ -60,6 +59,7 @@ module ASAutotest
|
|
60
59
|
attr_reader :test_port
|
61
60
|
attr_reader :output_file_name
|
62
61
|
attr_reader :extra_mxmlc_options
|
62
|
+
attr_reader :demo_command
|
63
63
|
|
64
64
|
def production? ; @production end
|
65
65
|
def test? ; @test end
|
@@ -73,6 +73,7 @@ module ASAutotest
|
|
73
73
|
@test = options[:test?]
|
74
74
|
@test_port = options[:test_port] || DEFAULT_TEST_PORT
|
75
75
|
@extra_mxmlc_options = options[:extra_mxmlc_options] || []
|
76
|
+
@demo_command = options[:demo_command]
|
76
77
|
|
77
78
|
if options.include? :output_file_name
|
78
79
|
@output_file_name = File.expand_path(options[:output_file_name])
|
@@ -96,34 +97,55 @@ module ASAutotest
|
|
96
97
|
else
|
97
98
|
build_string do |result|
|
98
99
|
result << %{mxmlc}
|
99
|
-
for source_directory in
|
100
|
-
result << %{ -compiler.source-path
|
100
|
+
for source_directory in source_directories do
|
101
|
+
result << %{ -compiler.source-path+=#{source_directory}}
|
101
102
|
end
|
102
|
-
for library in
|
103
|
-
result << %{ -compiler.library-path
|
103
|
+
for library in library_file_names do
|
104
|
+
result << %{ -compiler.library-path+=#{library}}
|
104
105
|
end
|
105
|
-
result << %{ -output
|
106
|
+
result << %{ -output=#{output_file_name}}
|
106
107
|
result << %{ -static-link-runtime-shared-libraries}
|
107
108
|
result << %{ -compiler.strict}
|
108
|
-
result << %{ -debug} unless
|
109
|
+
result << %{ -debug} unless production?
|
109
110
|
for option in @extra_mxmlc_options
|
110
111
|
result << %{ #{option}}
|
111
112
|
end
|
112
|
-
result << %{
|
113
|
+
result << %{ #{source_file_name}}
|
113
114
|
end
|
114
115
|
end
|
115
116
|
end
|
116
117
|
|
117
118
|
attr_accessor :compile_id
|
118
119
|
attr_accessor :index
|
120
|
+
|
121
|
+
def run_test!
|
122
|
+
TestRunner.new(output_file_name, test_port).run if test?
|
123
|
+
end
|
124
|
+
|
125
|
+
def stop_demo!
|
126
|
+
Process.kill("TERM", @demo_pid) if @demo_pid
|
127
|
+
rescue Errno::ESRCH # No such process.
|
128
|
+
ensure
|
129
|
+
@demo_pid = nil
|
130
|
+
end
|
131
|
+
|
132
|
+
def start_demo!
|
133
|
+
if @demo_command
|
134
|
+
@demo_pid = fork { exec("exec #@demo_command") }
|
135
|
+
Process.detach(@demo_pid)
|
136
|
+
end
|
137
|
+
end
|
119
138
|
end
|
120
139
|
|
121
140
|
class Main
|
122
141
|
include Logging
|
123
142
|
|
143
|
+
attr_reader :compilation_requests
|
144
|
+
|
124
145
|
def initialize(options)
|
125
146
|
initialize_growl if options[:enable_growl?]
|
126
147
|
@typing = options[:typing]
|
148
|
+
@watch_globs = options[:watch_globs]
|
127
149
|
@compilation_requests = options[:compilation_requests].
|
128
150
|
map(&method(:make_compilation_request))
|
129
151
|
end
|
@@ -158,10 +180,6 @@ module ASAutotest
|
|
158
180
|
CompilationRequest.new(options)
|
159
181
|
end
|
160
182
|
|
161
|
-
def self.run(*arguments)
|
162
|
-
new(*arguments).run
|
163
|
-
end
|
164
|
-
|
165
183
|
def run
|
166
184
|
print_header
|
167
185
|
start_compiler_shell
|
@@ -191,7 +209,7 @@ module ASAutotest
|
|
191
209
|
say_tabbed " Source directory:",
|
192
210
|
format_file_name(source_directory)
|
193
211
|
end
|
194
|
-
|
212
|
+
|
195
213
|
for library in request.library_file_names
|
196
214
|
say_tabbed " Library:", format_file_name(library)
|
197
215
|
end
|
@@ -210,6 +228,10 @@ module ASAutotest
|
|
210
228
|
say " Running as test (using port #{request.test_port})."
|
211
229
|
end
|
212
230
|
|
231
|
+
if request.demo_command
|
232
|
+
say_tabbed " Demo command:", "$ #{request.demo_command}"
|
233
|
+
end
|
234
|
+
|
213
235
|
say " Compiling in production mode." if request.production?
|
214
236
|
end
|
215
237
|
|
@@ -219,6 +241,8 @@ module ASAutotest
|
|
219
241
|
say "Not warning about missing type declarations."
|
220
242
|
end
|
221
243
|
|
244
|
+
say "Monitoring #{@watch_globs * " "} for changes."
|
245
|
+
|
222
246
|
new_logging_section
|
223
247
|
end
|
224
248
|
|
@@ -242,7 +266,7 @@ module ASAutotest
|
|
242
266
|
monitor = FSSM::Monitor.new
|
243
267
|
|
244
268
|
for source_directory in source_directories
|
245
|
-
monitor.path(source_directory,
|
269
|
+
monitor.path(source_directory, watch_glob) do |watch|
|
246
270
|
watch.update { handle_change }
|
247
271
|
watch.create { handle_change ; throw :asautotest_interrupt }
|
248
272
|
watch.delete { handle_change ; throw :asautotest_interrupt }
|
@@ -258,6 +282,14 @@ module ASAutotest
|
|
258
282
|
end
|
259
283
|
end
|
260
284
|
|
285
|
+
def watch_glob
|
286
|
+
if @watch_globs.size == 1
|
287
|
+
"**/#@watch_globs"
|
288
|
+
else
|
289
|
+
"**/{#{@watch_globs * ","}}"
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
261
293
|
def source_directories
|
262
294
|
@compilation_requests.map(&:source_directories).flatten.uniq
|
263
295
|
end
|
@@ -272,9 +304,12 @@ module ASAutotest
|
|
272
304
|
compile
|
273
305
|
|
274
306
|
for summary in @compilation.result.summaries
|
307
|
+
summary[:request].stop_demo!
|
308
|
+
|
275
309
|
if summary[:successful?]
|
276
|
-
if compilation_successful?
|
277
|
-
|
310
|
+
if compilation_successful?
|
311
|
+
summary[:request].run_test!
|
312
|
+
summary[:request].start_demo!
|
278
313
|
end
|
279
314
|
|
280
315
|
if summary[:request].temporary_output?
|
@@ -304,10 +339,6 @@ module ASAutotest
|
|
304
339
|
@compilation.run
|
305
340
|
end
|
306
341
|
|
307
|
-
def run_test(request)
|
308
|
-
TestRunner.new(request.output_file_name, request.test_port).run
|
309
|
-
end
|
310
|
-
|
311
342
|
def delete_output_file(file_name)
|
312
343
|
begin
|
313
344
|
File.delete(file_name)
|
@@ -334,6 +365,7 @@ $typing = nil
|
|
334
365
|
$verbose = false
|
335
366
|
$enable_growl = RUBY_PLATFORM =~ /darwin/
|
336
367
|
$parsing_global_options = false
|
368
|
+
$watch_globs = []
|
337
369
|
|
338
370
|
until ARGV.empty?
|
339
371
|
request = $compilation_requests.last
|
@@ -378,6 +410,8 @@ until ARGV.empty?
|
|
378
410
|
for request in requests
|
379
411
|
request[:source_directories] << value
|
380
412
|
end
|
413
|
+
when /^--watch(?:=(.*))$/
|
414
|
+
$watch_globs << $1 || ARGV.shift
|
381
415
|
when "--dynamic-typing"
|
382
416
|
$typing = :dynamic
|
383
417
|
when "--static-typing"
|
@@ -386,6 +420,8 @@ until ARGV.empty?
|
|
386
420
|
$verbose = true
|
387
421
|
when "--no-growl"
|
388
422
|
$enable_growl = false
|
423
|
+
when /^--demo-command(?:=(.*))$/
|
424
|
+
request[:demo_command] = $1 || ARGV.shift
|
389
425
|
when /^--mxmlc-option(?:=(.*))?$/, "-X"
|
390
426
|
value = ($1 || ARGV.shift)
|
391
427
|
for request in requests
|
@@ -425,13 +461,22 @@ end
|
|
425
461
|
|
426
462
|
ASAutotest::Logging.verbose = $verbose
|
427
463
|
|
464
|
+
$watch_globs = %w|*.as *.mxml| if $watch_globs.empty?
|
465
|
+
|
466
|
+
$main = ASAutotest::Main.new \
|
467
|
+
:compilation_requests => $compilation_requests,
|
468
|
+
:typing => $typing,
|
469
|
+
:enable_growl? => $enable_growl,
|
470
|
+
:watch_globs => $watch_globs
|
471
|
+
|
428
472
|
begin
|
429
|
-
|
430
|
-
:compilation_requests => $compilation_requests,
|
431
|
-
:typing => $typing,
|
432
|
-
:enable_growl? => $enable_growl
|
473
|
+
$main.run
|
433
474
|
rescue Interrupt
|
434
475
|
end
|
435
476
|
|
477
|
+
for request in $main.compilation_requests
|
478
|
+
request.stop_demo!
|
479
|
+
end
|
480
|
+
|
436
481
|
# Signal successful exit.
|
437
482
|
exit 200
|
data/bin/flash-policy-server
CHANGED
@@ -21,7 +21,9 @@
|
|
21
21
|
require "socket"
|
22
22
|
require "timeout"
|
23
23
|
|
24
|
-
|
24
|
+
PROGRAM_NAME = File.basename($0)
|
25
|
+
|
26
|
+
class FlashPolicyServer
|
25
27
|
PORT = 843
|
26
28
|
|
27
29
|
def initialize
|
@@ -44,7 +46,7 @@ class PolicyServer
|
|
44
46
|
end
|
45
47
|
|
46
48
|
def info_string(message)
|
47
|
-
"
|
49
|
+
"#{PROGRAM_NAME}: #{message}"
|
48
50
|
end
|
49
51
|
|
50
52
|
def begin_info(message)
|
@@ -85,4 +87,4 @@ class PolicyServer
|
|
85
87
|
end
|
86
88
|
end
|
87
89
|
|
88
|
-
|
90
|
+
FlashPolicyServer.new.run
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asautotest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Daniel Brockman
|
@@ -15,7 +15,8 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-06-
|
18
|
+
date: 2011-06-07 00:00:00 +02:00
|
19
|
+
default_executable:
|
19
20
|
dependencies: []
|
20
21
|
|
21
22
|
description:
|
@@ -41,6 +42,7 @@ files:
|
|
41
42
|
- bin/flash-policy-server
|
42
43
|
- README.rdoc
|
43
44
|
- LICENSE
|
45
|
+
has_rdoc: true
|
44
46
|
homepage: http://github.com/dbrock/asautotest
|
45
47
|
licenses: []
|
46
48
|
|
@@ -70,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
72
|
requirements: []
|
71
73
|
|
72
74
|
rubyforge_project:
|
73
|
-
rubygems_version: 1.
|
75
|
+
rubygems_version: 1.6.2
|
74
76
|
signing_key:
|
75
77
|
specification_version: 3
|
76
78
|
summary: Detects source changes and compiles ActionScript.
|