ittayd-buildr 1.3.4 → 1.3.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (169) hide show
  1. data/CHANGELOG +62 -9
  2. data/NOTICE +1 -1
  3. data/README.rdoc +9 -21
  4. data/Rakefile +20 -39
  5. data/_buildr +1 -0
  6. data/{spec/java/ant.rb → _jbuildr} +11 -15
  7. metadata +30 -210
  8. data/DISCLAIMER +0 -7
  9. data/addon/buildr/antlr.rb +0 -65
  10. data/addon/buildr/cobertura.rb +0 -22
  11. data/addon/buildr/drb.rb +0 -281
  12. data/addon/buildr/emma.rb +0 -22
  13. data/addon/buildr/hibernate.rb +0 -142
  14. data/addon/buildr/javacc.rb +0 -85
  15. data/addon/buildr/jdepend.rb +0 -60
  16. data/addon/buildr/jetty.rb +0 -248
  17. data/addon/buildr/jibx.rb +0 -86
  18. data/addon/buildr/nailgun.rb +0 -221
  19. data/addon/buildr/openjpa.rb +0 -90
  20. data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
  21. data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
  22. data/addon/buildr/org/apache/buildr/BuildrNail.java +0 -41
  23. data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
  24. data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
  25. data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
  26. data/addon/buildr/org/apache/buildr/JettyWrapper.java +0 -144
  27. data/addon/buildr/path.rb +0 -136
  28. data/addon/buildr/xmlbeans.rb +0 -93
  29. data/buildr.buildfile +0 -53
  30. data/buildr.gemspec +0 -58
  31. data/doc/css/default.css +0 -228
  32. data/doc/css/print.css +0 -100
  33. data/doc/css/syntax.css +0 -52
  34. data/doc/images/apache-incubator-logo.png +0 -0
  35. data/doc/images/buildr-hires.png +0 -0
  36. data/doc/images/buildr.png +0 -0
  37. data/doc/images/favicon.png +0 -0
  38. data/doc/images/growl-icon.tiff +0 -0
  39. data/doc/images/note.png +0 -0
  40. data/doc/images/project-structure.png +0 -0
  41. data/doc/images/tip.png +0 -0
  42. data/doc/images/zbuildr.tif +0 -0
  43. data/doc/pages/artifacts.textile +0 -207
  44. data/doc/pages/building.textile +0 -240
  45. data/doc/pages/contributing.textile +0 -208
  46. data/doc/pages/download.textile +0 -62
  47. data/doc/pages/extending.textile +0 -175
  48. data/doc/pages/getting_started.textile +0 -273
  49. data/doc/pages/index.textile +0 -42
  50. data/doc/pages/languages.textile +0 -407
  51. data/doc/pages/mailing_lists.textile +0 -17
  52. data/doc/pages/more_stuff.textile +0 -314
  53. data/doc/pages/packaging.textile +0 -427
  54. data/doc/pages/projects.textile +0 -274
  55. data/doc/pages/recipes.textile +0 -103
  56. data/doc/pages/settings_profiles.textile +0 -274
  57. data/doc/pages/testing.textile +0 -212
  58. data/doc/pages/troubleshooting.textile +0 -103
  59. data/doc/pages/whats_new.textile +0 -323
  60. data/doc/print.haml +0 -51
  61. data/doc/print.toc.yaml +0 -29
  62. data/doc/scripts/buildr-git.rb +0 -412
  63. data/doc/scripts/install-jruby.sh +0 -44
  64. data/doc/scripts/install-linux.sh +0 -64
  65. data/doc/scripts/install-osx.sh +0 -52
  66. data/doc/site.haml +0 -56
  67. data/doc/site.toc.yaml +0 -47
  68. data/etc/KEYS +0 -151
  69. data/etc/git-svn-authors +0 -16
  70. data/lib/buildr.rb +0 -33
  71. data/lib/buildr/core.rb +0 -29
  72. data/lib/buildr/core/application.rb +0 -665
  73. data/lib/buildr/core/build.rb +0 -311
  74. data/lib/buildr/core/checks.rb +0 -254
  75. data/lib/buildr/core/common.rb +0 -150
  76. data/lib/buildr/core/compile.rb +0 -590
  77. data/lib/buildr/core/environment.rb +0 -117
  78. data/lib/buildr/core/filter.rb +0 -366
  79. data/lib/buildr/core/generate.rb +0 -195
  80. data/lib/buildr/core/help.rb +0 -119
  81. data/lib/buildr/core/osx.rb +0 -49
  82. data/lib/buildr/core/progressbar.rb +0 -156
  83. data/lib/buildr/core/project.rb +0 -923
  84. data/lib/buildr/core/test.rb +0 -715
  85. data/lib/buildr/core/transports.rb +0 -560
  86. data/lib/buildr/core/util.rb +0 -294
  87. data/lib/buildr/groovy.rb +0 -18
  88. data/lib/buildr/groovy/bdd.rb +0 -106
  89. data/lib/buildr/groovy/compiler.rb +0 -138
  90. data/lib/buildr/ide.rb +0 -19
  91. data/lib/buildr/ide/eclipse.rb +0 -222
  92. data/lib/buildr/ide/idea.ipr.template +0 -300
  93. data/lib/buildr/ide/idea.rb +0 -190
  94. data/lib/buildr/ide/idea7x.ipr.template +0 -290
  95. data/lib/buildr/ide/idea7x.rb +0 -212
  96. data/lib/buildr/java.rb +0 -23
  97. data/lib/buildr/java/ant.rb +0 -92
  98. data/lib/buildr/java/bdd.rb +0 -451
  99. data/lib/buildr/java/cobertura.rb +0 -236
  100. data/lib/buildr/java/commands.rb +0 -211
  101. data/lib/buildr/java/compiler.rb +0 -348
  102. data/lib/buildr/java/deprecated.rb +0 -141
  103. data/lib/buildr/java/emma.rb +0 -238
  104. data/lib/buildr/java/jruby.rb +0 -117
  105. data/lib/buildr/java/jtestr_runner.rb.erb +0 -116
  106. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
  107. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +0 -119
  108. data/lib/buildr/java/packaging.rb +0 -717
  109. data/lib/buildr/java/pom.rb +0 -174
  110. data/lib/buildr/java/rjb.rb +0 -155
  111. data/lib/buildr/java/test_result.rb +0 -307
  112. data/lib/buildr/java/tests.rb +0 -329
  113. data/lib/buildr/java/version_requirement.rb +0 -172
  114. data/lib/buildr/packaging.rb +0 -24
  115. data/lib/buildr/packaging/archive.rb +0 -488
  116. data/lib/buildr/packaging/artifact.rb +0 -759
  117. data/lib/buildr/packaging/artifact_namespace.rb +0 -972
  118. data/lib/buildr/packaging/artifact_search.rb +0 -140
  119. data/lib/buildr/packaging/gems.rb +0 -102
  120. data/lib/buildr/packaging/package.rb +0 -233
  121. data/lib/buildr/packaging/tar.rb +0 -186
  122. data/lib/buildr/packaging/version_requirement.rb +0 -172
  123. data/lib/buildr/packaging/zip.rb +0 -64
  124. data/lib/buildr/packaging/ziptask.rb +0 -313
  125. data/lib/buildr/resources/buildr.icns +0 -0
  126. data/lib/buildr/scala.rb +0 -19
  127. data/lib/buildr/scala/compiler.rb +0 -109
  128. data/lib/buildr/scala/tests.rb +0 -203
  129. data/rakelib/apache.rake +0 -191
  130. data/rakelib/changelog.rake +0 -57
  131. data/rakelib/doc.rake +0 -103
  132. data/rakelib/package.rake +0 -76
  133. data/rakelib/release.rake +0 -65
  134. data/rakelib/rspec.rake +0 -83
  135. data/rakelib/rubyforge.rake +0 -56
  136. data/rakelib/scm.rake +0 -49
  137. data/rakelib/setup.rake +0 -81
  138. data/rakelib/stage.rake +0 -48
  139. data/spec/addon/drb_spec.rb +0 -328
  140. data/spec/core/application_spec.rb +0 -419
  141. data/spec/core/build_spec.rb +0 -423
  142. data/spec/core/checks_spec.rb +0 -519
  143. data/spec/core/common_spec.rb +0 -670
  144. data/spec/core/compile_spec.rb +0 -582
  145. data/spec/core/generate_spec.rb +0 -33
  146. data/spec/core/project_spec.rb +0 -776
  147. data/spec/core/test_spec.rb +0 -1098
  148. data/spec/core/transport_spec.rb +0 -500
  149. data/spec/groovy/bdd_spec.rb +0 -80
  150. data/spec/groovy/compiler_spec.rb +0 -239
  151. data/spec/ide/eclipse_spec.rb +0 -311
  152. data/spec/java/bdd_spec.rb +0 -358
  153. data/spec/java/cobertura_spec.rb +0 -77
  154. data/spec/java/compiler_spec.rb +0 -446
  155. data/spec/java/emma_spec.rb +0 -120
  156. data/spec/java/java_spec.rb +0 -96
  157. data/spec/java/packaging_spec.rb +0 -1120
  158. data/spec/java/test_coverage_spec.rb +0 -255
  159. data/spec/java/tests_spec.rb +0 -471
  160. data/spec/packaging/archive_spec.rb +0 -503
  161. data/spec/packaging/artifact_namespace_spec.rb +0 -646
  162. data/spec/packaging/artifact_spec.rb +0 -795
  163. data/spec/packaging/packaging_helper.rb +0 -63
  164. data/spec/packaging/packaging_spec.rb +0 -589
  165. data/spec/sandbox.rb +0 -139
  166. data/spec/scala/compiler_spec.rb +0 -228
  167. data/spec/scala/tests_spec.rb +0 -215
  168. data/spec/spec_helpers.rb +0 -327
  169. data/spec/version_requirement_spec.rb +0 -123
@@ -1,327 +0,0 @@
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
- spec.dependencies.each { |dep| gem dep.name, dep.version_requirements.to_s }
26
-
27
- # Make sure to load from these paths first, we don't want to load any
28
- # code from Gem library.
29
- $LOAD_PATH.unshift File.expand_path('../lib', File.dirname(__FILE__)),
30
- File.expand_path('../addon', File.dirname(__FILE__))
31
-
32
- # Buildr uses autoload extensively, but autoload when running specs creates
33
- # a problem -- we sandbox $LOADED_FEATURES, so we endup autoloading the same
34
- # module twice. This turns autoload into a require, which is not the right
35
- # thing, but will do for now.
36
- def autoload(symbol, path)
37
- require path
38
- end
39
- require 'buildr'
40
-
41
- require File.expand_path('sandbox', File.dirname(__FILE__))
42
-
43
- module SpecHelpers
44
-
45
- include Checks::Matchers
46
-
47
- [:info, :warn, :error, :puts].each do |severity|
48
- ::Object.class_eval do
49
- define_method severity do |message|
50
- $messages ||= {}
51
- ($messages[severity] ||= []) << message
52
- end
53
- end
54
- end
55
-
56
- class << Buildr.application
57
- alias :deprecated_without_capture :deprecated
58
- def deprecated(message)
59
- verbose(true) { deprecated_without_capture message }
60
- end
61
- end
62
-
63
- class MessageWithSeverityMatcher
64
- def initialize(severity, message)
65
- @severity = severity
66
- @expect = message
67
- end
68
-
69
- def matches?(target)
70
- $messages = {@severity => []}
71
- target.call
72
- return Regexp === @expect ? $messages[@severity].join('\n') =~ @expect : $messages[@severity].include?(@expect.to_s)
73
- end
74
-
75
- def failure_message
76
- "Expected #{@severity} #{@expect.inspect}, " +
77
- ($messages[@severity].empty? ? "no #{@severity} issued" : "found #{$messages[@severity].inspect}")
78
- end
79
-
80
- def negative_failure_message
81
- "Found unexpected #{$messages[@severity].inspect}"
82
- end
83
- end
84
-
85
- # Test if an info message was shown. You can use a string or regular expression.
86
- #
87
- # For example:
88
- # lambda { info 'ze test' }.should show_info(/ze test/)
89
- def show_info(message)
90
- MessageWithSeverityMatcher.new :info, message
91
- end
92
-
93
- # Test if a warning was shown. You can use a string or regular expression.
94
- #
95
- # For example:
96
- # lambda { warn 'ze test' }.should show_warning(/ze test/)
97
- def show_warning(message)
98
- MessageWithSeverityMatcher.new :warn, message
99
- end
100
-
101
- # Test if an error message was shown. You can use a string or regular expression.
102
- #
103
- # For example:
104
- # lambda { error 'ze test' }.should show_error(/ze test/)
105
- def show_error(message)
106
- MessageWithSeverityMatcher.new :error, message
107
- end
108
-
109
- # Test if any message was shown (puts). You can use a string or regular expression.
110
- #
111
- # For example:
112
- # lambda { puts 'ze test' }.should show(/ze test/)
113
- def show(message)
114
- MessageWithSeverityMatcher.new :puts, message
115
- end
116
-
117
- class ::Rake::Task
118
- alias :execute_without_a_record :execute
119
- def execute(args)
120
- $executed ||= []
121
- $executed << name
122
- execute_without_a_record args
123
- end
124
- end
125
-
126
- class InvokeMatcher
127
- def initialize(*tasks)
128
- @expecting = tasks.map { |task| [task].flatten.map(&:to_s) }
129
- end
130
-
131
- def matches?(target)
132
- $executed = []
133
- target.call
134
- return false unless all_ran?
135
- return !@but_not.any_ran? if @but_not
136
- return true
137
- end
138
-
139
- def failure_message
140
- return @but_not.negative_failure_message if all_ran? && @but_not
141
- "Expected the tasks #{expected} to run, but #{remaining} did not run, or not in the order we expected them to." +
142
- " Tasks that ran: #{$executed.inspect}"
143
- end
144
-
145
- def negative_failure_message
146
- if all_ran?
147
- "Expected the tasks #{expected} to not run, but they all ran."
148
- else
149
- "Expected the tasks #{expected} to not run, and all but #{remaining} ran."
150
- end
151
- end
152
-
153
- def but_not(*tasks)
154
- @but_not = InvokeMatcher.new(*tasks)
155
- self
156
- end
157
-
158
- protected
159
-
160
- def expected
161
- @expecting.map { |tests| tests.join('=>') }.join(', ')
162
- end
163
-
164
- def remaining
165
- @remaining.map { |tests| tests.join('=>') }.join(', ')
166
- end
167
-
168
- def all_ran?
169
- @remaining ||= $executed.inject(@expecting) do |expecting, executed|
170
- expecting.map { |tasks| tasks.first == executed ? tasks[1..-1] : tasks }.reject(&:empty?)
171
- end
172
- @remaining.empty?
173
- end
174
-
175
- def any_ran?
176
- all_ran?
177
- @remaining.size < @expecting.size
178
- end
179
-
180
- end
181
-
182
- # Tests that all the tasks ran, in the order specified. Can also be used to test that some
183
- # tasks and not others ran.
184
- #
185
- # Takes a list of arguments. Each argument can be a task name, matching only if that task ran.
186
- # Each argument can be an array of task names, matching only if all these tasks ran in that order.
187
- # So run_tasks('foo', 'bar') expects foo and bar to run in any order, but run_task(['foo', 'bar'])
188
- # expects foo to run before bar.
189
- #
190
- # You can call but_not on the matchers to specify that certain tasks must not execute.
191
- #
192
- # For example:
193
- # # Either task
194
- # lambda { task('compile').invoke }.should run_tasks('compile', 'resources')
195
- # # In that order
196
- # lambda { task('build').invoke }.should run_tasks(['compile', 'test'])
197
- # # With exclusion
198
- # lambda { task('build').invoke }.should run_tasks('compile').but_not('install')
199
- def run_tasks(*tasks)
200
- InvokeMatcher.new *tasks
201
- end
202
-
203
- # Tests that a task ran. Similar to run_tasks, but accepts a single task name.
204
- #
205
- # For example:
206
- # lambda { task('build').invoke }.should run_task('test')
207
- def run_task(task)
208
- InvokeMatcher.new [task]
209
- end
210
-
211
- class UriPathMatcher
212
- def initialize(re)
213
- @expression = re
214
- end
215
-
216
- def matches?(uri)
217
- @uri = uri
218
- uri.path =~ @expression
219
- end
220
-
221
- def description
222
- "URI with path matching #{@expression}"
223
- end
224
- end
225
-
226
- # Matches a parsed URI's path against the given regular expression
227
- def uri(re)
228
- UriPathMatcher.new(re)
229
- end
230
-
231
-
232
- class AbsolutePathMatcher
233
- def initialize(path)
234
- @expected = File.expand_path(path.to_s)
235
- end
236
-
237
- def matches?(path)
238
- @provided = File.expand_path(path.to_s)
239
- @provided == @expected
240
- end
241
-
242
- def failure_message
243
- "Expected path #{@expected}, but found path #{@provided}"
244
- end
245
-
246
- def negative_failure_message
247
- "Expected a path other than #{@expected}"
248
- end
249
- end
250
-
251
- def point_to_path(path)
252
- AbsolutePathMatcher.new(path)
253
- end
254
-
255
-
256
- def suppress_stdout
257
- stdout = $stdout
258
- $stdout = StringIO.new
259
- begin
260
- yield
261
- ensure
262
- $stdout = stdout
263
- end
264
- end
265
-
266
- def dryrun
267
- Buildr.application.options.dryrun = true
268
- begin
269
- suppress_stdout { yield }
270
- ensure
271
- Buildr.application.options.dryrun = false
272
- end
273
- end
274
-
275
- # We run tests with tracing off. Then things break. And we need to figure out what went wrong.
276
- # So just use trace() as you would use verbose() to find and squash the bug.
277
- def trace(value = nil)
278
- old_value = Buildr.application.options.trace
279
- Buildr.application.options.trace = value unless value.nil?
280
- if block_given?
281
- begin
282
- yield
283
- ensure
284
- Buildr.application.options.trace = old_value
285
- end
286
- end
287
- Buildr.application.options.trace
288
- end
289
-
290
- # Change the Buildr original directory, faking invocation from a different directory.
291
- def in_original_dir(dir)
292
- begin
293
- original_dir = Buildr.application.original_dir
294
- Buildr.application.instance_eval { @original_dir = File.expand_path(dir) }
295
- yield
296
- ensure
297
- Buildr.application.instance_eval { @original_dir = original_dir }
298
- end
299
- end
300
-
301
-
302
- # Buildr's define method creates a project definition but does not evaluate it
303
- # (that happens once the buildfile is loaded), and we include Buildr's define in
304
- # the test context so we can use it without prefixing with Buildr. This just patches
305
- # define to evaluate the project definition before returning it.
306
- def define(name, properties = nil, &block) #:yields:project
307
- Project.define(name, properties, &block).tap { |project| project.invoke }
308
- end
309
-
310
- end
311
-
312
-
313
- # Allow using matchers within the project definition.
314
- class Buildr::Project
315
- include ::Spec::Matchers, SpecHelpers
316
- end
317
-
318
-
319
- Spec::Runner.configure do |config|
320
- # Make all Buildr methods accessible from test cases, and add various helper methods.
321
- config.include Buildr, SpecHelpers
322
-
323
- # Sanbdox Buildr for each test.
324
- config.include Sandbox
325
- end
326
-
327
- end
@@ -1,123 +0,0 @@
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
- require File.join(File.dirname(__FILE__), 'spec_helpers')
18
-
19
- describe Buildr::VersionRequirement, '.create' do
20
- def create(str)
21
- Buildr::VersionRequirement.create(str)
22
- end
23
-
24
- it 'should complain on invalid input' do
25
- lambda { create }.should raise_error(Exception)
26
- lambda { create('%') }.should raise_error(Exception, /invalid character/)
27
- lambda { create('1#{0}') }.should raise_error(Exception, /invalid character/)
28
- lambda { create('1.0rc`exit`') }.should raise_error(Exception, /invalid character/)
29
- lambda { create(1.0) }.should raise_error(Exception)
30
- lambda { create('1.0') }.should_not raise_error(Exception)
31
- lambda { create('1.0rc3') }.should_not raise_error(Exception)
32
- end
33
-
34
- it 'should allow versions using hyphen' do
35
- lambda { create('1.0-rc3') }.should_not raise_error(Exception)
36
- end
37
-
38
- it 'should create a single version requirement' do
39
- create('1.0').should_not be_composed
40
- end
41
-
42
- it 'should create a composed version requirement' do
43
- create('1.0 | 2.1').should be_composed
44
- end
45
- end
46
-
47
- describe Buildr::VersionRequirement, '#satisfied_by?' do
48
- def should_satisfy(str, valids = [], invalids = [])
49
- req = Buildr::VersionRequirement.create(str)
50
- valids.each { |v| req.should be_satisfied_by(v) }
51
- invalids.each { |v| req.should_not be_satisfied_by(v) }
52
- end
53
-
54
- it 'should accept Gem version operators' do
55
- should_satisfy '1.0', %w(1 1.0), %w(1.1 0.1)
56
- should_satisfy '=1.0', %w(1 1.0), %w(1.1 0.1)
57
- should_satisfy '= 1.0', %w(1 1.0), %w(1.1 0.1)
58
- should_satisfy '!= 1.0', %w(0.9 1.1 2), %w(1 1.0 1.0.0)
59
-
60
- should_satisfy '>1.0', %w(1.0.1), %w(1 1.0 0.1)
61
- should_satisfy '>=1.0', %w(1.0.1 1 1.0), %w(0.9)
62
-
63
- should_satisfy '<1.0', %w(0.9 0.9.9), %w(1 1.0 1.1 2)
64
- should_satisfy '<=1.0', %w(0.9 0.9.9 1 1.0), %w(1.1 2)
65
-
66
- should_satisfy '~> 1.2.3', %w(1.2.3 1.2.3.4 1.2.4), %w(1.2.1 0.9 1.4 2)
67
- end
68
-
69
- it 'should accept logic not operator' do
70
- should_satisfy 'not 0.5', %w(0 1), %w(0.5)
71
- should_satisfy '! 0.5', %w(0 1), %w(0.5)
72
- should_satisfy '!= 0.5', %w(0 1), %w(0.5)
73
- should_satisfy '!<= 0.5', %w(0.5.1 2), %w(0.5)
74
- end
75
-
76
- it 'should accept logic or operator' do
77
- should_satisfy '0.5 or 2.0', %w(0.5 2.0), %w(1.0 0.5.1 2.0.9)
78
- should_satisfy '0.5 | 2.0', %w(0.5 2.0), %w(1.0 0.5.1 2.0.9)
79
- end
80
-
81
- it 'should accept logic and operator' do
82
- should_satisfy '>1.5 and <2.0', %w(1.6 1.9), %w(1.5 2 2.0)
83
- should_satisfy '>1.5 & <2.0', %w(1.6 1.9), %w(1.5 2 2.0)
84
- end
85
-
86
- it 'should assume logic and if missing operator between expressions' do
87
- should_satisfy '>1.5 <2.0', %w(1.6 1.9), %w(1.5 2 2.0)
88
- end
89
-
90
- it 'should allow combining logic operators' do
91
- should_satisfy '>1.0 | <2.0 | =3.0', %w(1.5 3.0 1 2 4)
92
- should_satisfy '>1.0 & <2.0 | =3.0', %w(1.3 3.0), %w(1 2)
93
- should_satisfy '=1.0 | <2.0 & =0.5', %w(0.5 1.0), %w(1.1 0.1 2)
94
- should_satisfy '~>1.1 | ~>1.3 | ~>1.5 | 2.0', %w(2 1.5.6 1.1.2 1.1.3), %w(1.0.9 0.5 2.2.1)
95
- should_satisfy 'not(2) | 1', %w(1 3), %w(2)
96
- end
97
-
98
- it 'should allow using parens to group logic expressions' do
99
- should_satisfy '(1.0)', %w(1 1.0), %w(0.9 1.1)
100
- should_satisfy '!( !(1.0) )', %w(1 1.0), %w(0.9 1.1)
101
- should_satisfy '1 | !(2 | 3)', %w(1), %w(2 3)
102
- should_satisfy '!(2 | 3) | 1', %w(1), %w(2 3)
103
- end
104
- end
105
-
106
- describe Buildr::VersionRequirement, '#default' do
107
- it 'should return nil if missing default requirement' do
108
- Buildr::VersionRequirement.create('>1').default.should be_nil
109
- Buildr::VersionRequirement.create('<1').default.should be_nil
110
- Buildr::VersionRequirement.create('!1').default.should be_nil
111
- Buildr::VersionRequirement.create('!<=1').default.should be_nil
112
- end
113
-
114
- it 'should return the last version with a = requirement' do
115
- Buildr::VersionRequirement.create('1').default.should == '1'
116
- Buildr::VersionRequirement.create('=1').default.should == '1'
117
- Buildr::VersionRequirement.create('<=1').default.should == '1'
118
- Buildr::VersionRequirement.create('>=1').default.should == '1'
119
- Buildr::VersionRequirement.create('1 | 2 | 3').default.should == '3'
120
- Buildr::VersionRequirement.create('1 2 | 3').default.should == '3'
121
- Buildr::VersionRequirement.create('1 & 2 | 3').default.should == '3'
122
- end
123
- end