buildr-as3 0.2.19 → 0.2.20.pre

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.
@@ -0,0 +1,376 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with this
3
+ # work for additional information regarding copyright ownership. The ASF
4
+ # licenses this file to you under the Apache License, Version 2.0 (the
5
+ # "License"); you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+ # License for the specific language governing permissions and limitations under
14
+ # the License.
15
+
16
+
17
+ # This file gets loaded twice when running 'spec spec/*' and not with pleasent results,
18
+ # so ignore the second attempt to load it.
19
+ unless defined?(SpecHelpers)
20
+
21
+ #require 'rubygems'
22
+
23
+ # For testing we use the gem requirements specified on the buildr.gemspec
24
+ #spec = Gem::Specification.load(File.expand_path('../buildr.gemspec', File.dirname(__FILE__)))
25
+ # Dependency.version_requirements deprecated in rubygems 1.3.6
26
+ #spec.dependencies.select {|dep| dep.type == :runtime }.each { |dep| gem dep.name, (dep.respond_to?(:requirement) ? dep.requirement.to_s : dep.version_requirements.to_s) }
27
+
28
+ # Make sure to load from these paths first, we don't want to load any
29
+ # code from Gem library.
30
+ #$LOAD_PATH.unshift File.expand_path('../lib', File.dirname(__FILE__)),
31
+ # File.expand_path('../addon', File.dirname(__FILE__))
32
+
33
+ require 'simplecov'
34
+ require 'simplecov-rcov'
35
+ SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
36
+ SimpleCov.root( File.dirname( __FILE__) + '/..' )
37
+ SimpleCov.start
38
+
39
+ # Buildr uses autoload extensively, but autoload when running specs creates
40
+ # a problem -- we sandbox $LOADED_FEATURES, so we endup autoloading the same
41
+ # module twice. This turns autoload into a require, which is not the right
42
+ # thing, but will do for now.
43
+ def autoload(symbol, path)
44
+ require path
45
+ end
46
+ #require 'buildr'
47
+ require File.dirname( __FILE__) + '/../lib/buildr/as3'
48
+ # load ecj
49
+ #require 'buildr/java/ecj'
50
+ #Make ecj appear as a compiler that doesn't apply:
51
+ #class Buildr::Compiler::Ecj
52
+ # class << self
53
+ # def applies_to?(project, task)
54
+ # false
55
+ # end
56
+ # end
57
+ #end
58
+
59
+ # Give a chance for plugins to do a few things before requiring the sandbox.
60
+ include SandboxHook if defined?(SandboxHook)
61
+
62
+ require File.expand_path('sandbox', File.dirname(__FILE__))
63
+
64
+ module SpecHelpers
65
+
66
+ include Checks::Matchers
67
+
68
+ [:info, :warn, :error, :puts].each do |severity|
69
+ ::Object.class_eval do
70
+ define_method severity do |*args|
71
+ $messages ||= {}
72
+ $messages[severity] ||= []
73
+ $messages[severity].push(*args)
74
+ end
75
+ end
76
+ end
77
+
78
+ class << Buildr.application
79
+ alias :deprecated_without_capture :deprecated
80
+ def deprecated(message)
81
+ verbose(true) { deprecated_without_capture message }
82
+ end
83
+ end
84
+
85
+ class MessageWithSeverityMatcher
86
+ def initialize(severity, message)
87
+ @severity = severity
88
+ @expect = message
89
+ end
90
+
91
+ def matches?(target)
92
+ $messages = {@severity => []}
93
+ target.call
94
+ return Regexp === @expect ? $messages[@severity].join('\n') =~ @expect : $messages[@severity].include?(@expect.to_s)
95
+ end
96
+
97
+ def failure_message
98
+ "Expected #{@severity} #{@expect.inspect}, " +
99
+ ($messages[@severity].empty? ? "no #{@severity} issued" : "found #{$messages[@severity].inspect}")
100
+ end
101
+
102
+ def negative_failure_message
103
+ "Found unexpected #{$messages[@severity].inspect}"
104
+ end
105
+ end
106
+
107
+ # Test if an info message was shown. You can use a string or regular expression.
108
+ #
109
+ # For example:
110
+ # lambda { info 'ze test' }.should show_info(/ze test/)
111
+ def show_info(message)
112
+ MessageWithSeverityMatcher.new :info, message
113
+ end
114
+
115
+ # Test if a warning was shown. You can use a string or regular expression.
116
+ #
117
+ # For example:
118
+ # lambda { warn 'ze test' }.should show_warning(/ze test/)
119
+ def show_warning(message)
120
+ MessageWithSeverityMatcher.new :warn, message
121
+ end
122
+
123
+ # Test if an error message was shown. You can use a string or regular expression.
124
+ #
125
+ # For example:
126
+ # lambda { error 'ze test' }.should show_error(/ze test/)
127
+ def show_error(message)
128
+ MessageWithSeverityMatcher.new :error, message
129
+ end
130
+
131
+ # Test if any message was shown (puts). You can use a string or regular expression.
132
+ #
133
+ # For example:
134
+ # lambda { puts 'ze test' }.should show(/ze test/)
135
+ def show(message)
136
+ MessageWithSeverityMatcher.new :puts, message
137
+ end
138
+
139
+ # Yields a block that should try exiting the application.
140
+ # Accepts
141
+ #
142
+ # For example:
143
+ # test_exit(1) { puts "Hello" ; exit(1) }.should show("Hello")
144
+ #
145
+ def test_exit(status = nil)
146
+ return lambda {
147
+ begin
148
+ yield
149
+ raise "Exit was not called!"
150
+ rescue SystemExit => e
151
+ raise "Exit status incorrect! Expected: #{status}, got #{e.status}" if status && (e.status != status)
152
+ end
153
+ }
154
+ end
155
+
156
+ class ::Rake::Task
157
+ alias :execute_without_a_record :execute
158
+ def execute(args)
159
+ $executed ||= []
160
+ $executed << name
161
+ execute_without_a_record args
162
+ end
163
+ end
164
+
165
+ class InvokeMatcher
166
+ def initialize(*tasks)
167
+ @expecting = tasks.map { |task| [task].flatten.map(&:to_s) }
168
+ end
169
+
170
+ def matches?(target)
171
+ $executed = []
172
+ target.call
173
+ return false unless all_ran?
174
+ return !@but_not.any_ran? if @but_not
175
+ return true
176
+ end
177
+
178
+ def failure_message
179
+ return @but_not.negative_failure_message if all_ran? && @but_not
180
+ "Expected the tasks #{expected} to run, but #{remaining} did not run, or not in the order we expected them to." +
181
+ " Tasks that ran: #{$executed.inspect}"
182
+ end
183
+
184
+ def negative_failure_message
185
+ if all_ran?
186
+ "Expected the tasks #{expected} to not run, but they all ran."
187
+ else
188
+ "Expected the tasks #{expected} to not run, and all but #{remaining} ran."
189
+ end
190
+ end
191
+
192
+ def but_not(*tasks)
193
+ @but_not = InvokeMatcher.new(*tasks)
194
+ self
195
+ end
196
+
197
+ protected
198
+
199
+ def expected
200
+ @expecting.map { |tests| tests.join('=>') }.join(', ')
201
+ end
202
+
203
+ def remaining
204
+ @remaining.map { |tests| tests.join('=>') }.join(', ')
205
+ end
206
+
207
+ def all_ran?
208
+ @remaining ||= $executed.inject(@expecting) do |expecting, executed|
209
+ expecting.map { |tasks| tasks.first == executed ? tasks[1..-1] : tasks }.reject(&:empty?)
210
+ end
211
+ @remaining.empty?
212
+ end
213
+
214
+ def any_ran?
215
+ all_ran?
216
+ @remaining.size < @expecting.size
217
+ end
218
+
219
+ end
220
+
221
+ # Tests that all the tasks ran, in the order specified. Can also be used to test that some
222
+ # tasks and not others ran.
223
+ #
224
+ # Takes a list of arguments. Each argument can be a task name, matching only if that task ran.
225
+ # Each argument can be an array of task names, matching only if all these tasks ran in that order.
226
+ # So run_tasks('foo', 'bar') expects foo and bar to run in any order, but run_task(['foo', 'bar'])
227
+ # expects foo to run before bar.
228
+ #
229
+ # You can call but_not on the matchers to specify that certain tasks must not execute.
230
+ #
231
+ # For example:
232
+ # # Either task
233
+ # lambda { task('compile').invoke }.should run_tasks('compile', 'resources')
234
+ # # In that order
235
+ # lambda { task('build').invoke }.should run_tasks(['compile', 'test'])
236
+ # # With exclusion
237
+ # lambda { task('build').invoke }.should run_tasks('compile').but_not('install')
238
+ def run_tasks(*tasks)
239
+ InvokeMatcher.new *tasks
240
+ end
241
+
242
+ # Tests that a task ran. Similar to run_tasks, but accepts a single task name.
243
+ #
244
+ # For example:
245
+ # lambda { task('build').invoke }.should run_task('test')
246
+ def run_task(task)
247
+ InvokeMatcher.new [task]
248
+ end
249
+
250
+ class UriPathMatcher
251
+ def initialize(re)
252
+ @expression = re
253
+ end
254
+
255
+ def matches?(uri)
256
+ @uri = uri
257
+ uri.path =~ @expression
258
+ end
259
+
260
+ def description
261
+ "URI with path matching #{@expression}"
262
+ end
263
+ end
264
+
265
+ # Matches a parsed URI's path against the given regular expression
266
+ def uri(re)
267
+ UriPathMatcher.new(re)
268
+ end
269
+
270
+
271
+ class AbsolutePathMatcher
272
+ def initialize(path)
273
+ @expected = File.expand_path(path.to_s)
274
+ end
275
+
276
+ def matches?(path)
277
+ @provided = File.expand_path(path.to_s)
278
+ @provided == @expected
279
+ end
280
+
281
+ def failure_message
282
+ "Expected path #{@expected}, but found path #{@provided}"
283
+ end
284
+
285
+ def negative_failure_message
286
+ "Expected a path other than #{@expected}"
287
+ end
288
+ end
289
+
290
+ def point_to_path(path)
291
+ AbsolutePathMatcher.new(path)
292
+ end
293
+
294
+
295
+ # Value covered by range. For example:
296
+ # (1..5).should cover(3)
297
+ RSpec::Matchers.define :cover do |actual|
298
+ match do |range|
299
+ actual >= range.min && actual <= range.max
300
+ end
301
+ end
302
+
303
+
304
+ def suppress_stdout
305
+ stdout = $stdout
306
+ $stdout = StringIO.new
307
+ begin
308
+ yield
309
+ ensure
310
+ $stdout = stdout
311
+ end
312
+ end
313
+
314
+ def dryrun
315
+ Buildr.application.options.dryrun = true
316
+ begin
317
+ suppress_stdout { yield }
318
+ ensure
319
+ Buildr.application.options.dryrun = false
320
+ end
321
+ end
322
+
323
+ # We run tests with tracing off. Then things break. And we need to figure out what went wrong.
324
+ # So just use trace() as you would use verbose() to find and squash the bug.
325
+ def trace(value = nil)
326
+ old_value = Buildr.application.options.trace
327
+ Buildr.application.options.trace = value unless value.nil?
328
+ if block_given?
329
+ begin
330
+ yield
331
+ ensure
332
+ Buildr.application.options.trace = old_value
333
+ end
334
+ end
335
+ Buildr.application.options.trace
336
+ end
337
+
338
+ # Change the Buildr original directory, faking invocation from a different directory.
339
+ def in_original_dir(dir)
340
+ begin
341
+ original_dir = Buildr.application.original_dir
342
+ Buildr.application.instance_eval { @original_dir = File.expand_path(dir) }
343
+ yield
344
+ ensure
345
+ Buildr.application.instance_eval { @original_dir = original_dir }
346
+ end
347
+ end
348
+
349
+
350
+ # Buildr's define method creates a project definition but does not evaluate it
351
+ # (that happens once the buildfile is loaded), and we include Buildr's define in
352
+ # the test context so we can use it without prefixing with Buildr. This just patches
353
+ # define to evaluate the project definition before returning it.
354
+ def define(name, properties = nil, &block) #:yields:project
355
+ Project.define(name, properties, &block).tap { |project| project.invoke }
356
+ end
357
+
358
+ end
359
+
360
+
361
+ # Allow using matchers within the project definition.
362
+ class Buildr::Project
363
+ include ::RSpec::Matchers, SpecHelpers
364
+ end
365
+
366
+
367
+ ::RSpec.configure do |config|
368
+ # Make all Buildr methods accessible from test cases, and add various helper methods.
369
+ config.include Buildr
370
+ config.include SpecHelpers
371
+
372
+ # Sanbdox Buildr for each test.
373
+ config.include Sandbox
374
+ end
375
+
376
+ end
metadata CHANGED
@@ -1,20 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: buildr-as3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.19
5
- prerelease:
4
+ version: 0.2.20.pre
5
+ prerelease: 7
6
6
  platform: ruby
7
7
  authors:
8
8
  - Dominic Graefen
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-07-26 00:00:00.000000000 +02:00
12
+ date: 2011-09-24 00:00:00.000000000 +02:00
13
13
  default_executable: buildr-as3
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: shoulda
17
- requirement: &2157586120 !ruby/object:Gem::Requirement
17
+ requirement: &2158145520 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :development
24
24
  prerelease: false
25
- version_requirements: *2157586120
25
+ version_requirements: *2158145520
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: bundler
28
- requirement: &2157585540 !ruby/object:Gem::Requirement
28
+ requirement: &2158144720 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 1.0.0
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *2157585540
36
+ version_requirements: *2158144720
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: jeweler
39
- requirement: &2157585000 !ruby/object:Gem::Requirement
39
+ requirement: &2158144080 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ~>
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: 1.5.2
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *2157585000
47
+ version_requirements: *2158144080
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: buildr
50
- requirement: &2157584500 !ruby/object:Gem::Requirement
50
+ requirement: &2158143500 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ~>
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: 1.4.6
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *2157584500
58
+ version_requirements: *2158143500
59
59
  - !ruby/object:Gem::Dependency
60
- name: rcov
61
- requirement: &2157583960 !ruby/object:Gem::Requirement
60
+ name: simplecov
61
+ requirement: &2158142820 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,10 +66,43 @@ dependencies:
66
66
  version: '0'
67
67
  type: :development
68
68
  prerelease: false
69
- version_requirements: *2157583960
69
+ version_requirements: *2158142820
70
+ - !ruby/object:Gem::Dependency
71
+ name: simplecov-rcov
72
+ requirement: &2158142140 !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ type: :development
79
+ prerelease: false
80
+ version_requirements: *2158142140
81
+ - !ruby/object:Gem::Dependency
82
+ name: rspec
83
+ requirement: &2158141460 !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ~>
87
+ - !ruby/object:Gem::Version
88
+ version: 2.1.0
89
+ type: :development
90
+ prerelease: false
91
+ version_requirements: *2158141460
92
+ - !ruby/object:Gem::Dependency
93
+ name: ci_reporter
94
+ requirement: &2158140840 !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ~>
98
+ - !ruby/object:Gem::Version
99
+ version: 1.6.5
100
+ type: :development
101
+ prerelease: false
102
+ version_requirements: *2158140840
70
103
  - !ruby/object:Gem::Dependency
71
104
  name: buildr
72
- requirement: &2157579380 !ruby/object:Gem::Requirement
105
+ requirement: &2158140160 !ruby/object:Gem::Requirement
73
106
  none: false
74
107
  requirements:
75
108
  - - ! '>='
@@ -77,7 +110,7 @@ dependencies:
77
110
  version: 1.4.5
78
111
  type: :runtime
79
112
  prerelease: false
80
- version_requirements: *2157579380
113
+ version_requirements: *2158140160
81
114
  description: Build like you code - now supporting ActionScript 3 & Flex
82
115
  email: dominic @nospam@ devboy.org
83
116
  executables:
@@ -88,6 +121,7 @@ extra_rdoc_files:
88
121
  - README.rdoc
89
122
  files:
90
123
  - .document
124
+ - .rspec
91
125
  - Gemfile
92
126
  - LICENSE.txt
93
127
  - README.rdoc
@@ -121,8 +155,18 @@ files:
121
155
  - lib/buildr/as3/toolkits/apparat.rb
122
156
  - lib/buildr/as3/toolkits/base.rb
123
157
  - lib/buildr/as3/toolkits/flexsdk.rb
124
- - test/helper.rb
125
- - test/test_buildr_as3.rb
158
+ - rake/jeweler.rb
159
+ - rake/jeweler_prerelease_tasks.rb
160
+ - rake/pre_release_gemspec.rb
161
+ - rake/pre_release_to_git.rb
162
+ - spec/as3/compiler/aircompc_spec.rb
163
+ - spec/as3/compiler/airmxmlc_spec.rb
164
+ - spec/as3/compiler/compc_spec.rb
165
+ - spec/as3/compiler/mxmlc_spec.rb
166
+ - spec/as3/compiler/task_spec.rb
167
+ - spec/as3/project_spec.rb
168
+ - spec/sandbox.rb
169
+ - spec/spec_helper.rb
126
170
  has_rdoc: true
127
171
  homepage: http://github.com/devboy/buildr_as3
128
172
  licenses:
@@ -139,13 +183,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
139
183
  version: '0'
140
184
  segments:
141
185
  - 0
142
- hash: 2111872876044542933
186
+ hash: 1353254339725086052
143
187
  required_rubygems_version: !ruby/object:Gem::Requirement
144
188
  none: false
145
189
  requirements:
146
- - - ! '>='
190
+ - - ! '>'
147
191
  - !ruby/object:Gem::Version
148
- version: '0'
192
+ version: 1.3.1
149
193
  requirements: []
150
194
  rubyforge_project:
151
195
  rubygems_version: 1.6.2
@@ -153,5 +197,11 @@ signing_key:
153
197
  specification_version: 3
154
198
  summary: Buildr extension to allow ActionScript3/Flex development.
155
199
  test_files:
156
- - test/helper.rb
157
- - test/test_buildr_as3.rb
200
+ - spec/as3/compiler/aircompc_spec.rb
201
+ - spec/as3/compiler/airmxmlc_spec.rb
202
+ - spec/as3/compiler/compc_spec.rb
203
+ - spec/as3/compiler/mxmlc_spec.rb
204
+ - spec/as3/compiler/task_spec.rb
205
+ - spec/as3/project_spec.rb
206
+ - spec/sandbox.rb
207
+ - spec/spec_helper.rb