assaf-buildr 1.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +887 -0
- data/DISCLAIMER +7 -0
- data/LICENSE +176 -0
- data/NOTICE +26 -0
- data/README.rdoc +146 -0
- data/Rakefile +62 -0
- data/_buildr +38 -0
- data/addon/buildr/antlr.rb +65 -0
- data/addon/buildr/cobertura.rb +236 -0
- data/addon/buildr/emma.rb +238 -0
- data/addon/buildr/hibernate.rb +142 -0
- data/addon/buildr/javacc.rb +85 -0
- data/addon/buildr/jdepend.rb +60 -0
- data/addon/buildr/jetty.rb +248 -0
- data/addon/buildr/jibx.rb +86 -0
- data/addon/buildr/nailgun.rb +817 -0
- data/addon/buildr/openjpa.rb +90 -0
- data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
- data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
- data/addon/buildr/org/apache/buildr/BuildrNail.java +41 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper.java +144 -0
- data/addon/buildr/xmlbeans.rb +93 -0
- data/bin/buildr +28 -0
- data/buildr.buildfile +53 -0
- data/buildr.gemspec +58 -0
- data/doc/css/default.css +228 -0
- data/doc/css/print.css +100 -0
- data/doc/css/syntax.css +52 -0
- data/doc/images/apache-incubator-logo.png +0 -0
- data/doc/images/buildr-hires.png +0 -0
- data/doc/images/buildr.png +0 -0
- data/doc/images/favicon.png +0 -0
- data/doc/images/growl-icon.tiff +0 -0
- data/doc/images/note.png +0 -0
- data/doc/images/project-structure.png +0 -0
- data/doc/images/tip.png +0 -0
- data/doc/images/zbuildr.tif +0 -0
- data/doc/pages/artifacts.textile +207 -0
- data/doc/pages/building.textile +240 -0
- data/doc/pages/contributing.textile +208 -0
- data/doc/pages/download.textile +62 -0
- data/doc/pages/extending.textile +175 -0
- data/doc/pages/getting_started.textile +273 -0
- data/doc/pages/index.textile +42 -0
- data/doc/pages/languages.textile +407 -0
- data/doc/pages/mailing_lists.textile +17 -0
- data/doc/pages/more_stuff.textile +286 -0
- data/doc/pages/packaging.textile +427 -0
- data/doc/pages/projects.textile +274 -0
- data/doc/pages/recipes.textile +103 -0
- data/doc/pages/settings_profiles.textile +274 -0
- data/doc/pages/testing.textile +212 -0
- data/doc/pages/troubleshooting.textile +103 -0
- data/doc/pages/whats_new.textile +323 -0
- data/doc/print.haml +51 -0
- data/doc/print.toc.yaml +29 -0
- data/doc/scripts/buildr-git.rb +412 -0
- data/doc/scripts/install-jruby.sh +44 -0
- data/doc/scripts/install-linux.sh +64 -0
- data/doc/scripts/install-osx.sh +52 -0
- data/doc/site.haml +56 -0
- data/doc/site.toc.yaml +47 -0
- data/etc/KEYS +151 -0
- data/etc/git-svn-authors +16 -0
- data/lib/buildr.rb +35 -0
- data/lib/buildr/core.rb +27 -0
- data/lib/buildr/core/application.rb +489 -0
- data/lib/buildr/core/application_cli.rb +139 -0
- data/lib/buildr/core/build.rb +311 -0
- data/lib/buildr/core/checks.rb +382 -0
- data/lib/buildr/core/common.rb +154 -0
- data/lib/buildr/core/compile.rb +596 -0
- data/lib/buildr/core/environment.rb +120 -0
- data/lib/buildr/core/filter.rb +362 -0
- data/lib/buildr/core/generate.rb +195 -0
- data/lib/buildr/core/help.rb +118 -0
- data/lib/buildr/core/progressbar.rb +156 -0
- data/lib/buildr/core/project.rb +892 -0
- data/lib/buildr/core/test.rb +715 -0
- data/lib/buildr/core/transports.rb +558 -0
- data/lib/buildr/core/util.rb +289 -0
- data/lib/buildr/groovy.rb +18 -0
- data/lib/buildr/groovy/bdd.rb +105 -0
- data/lib/buildr/groovy/compiler.rb +138 -0
- data/lib/buildr/ide.rb +19 -0
- data/lib/buildr/ide/eclipse.rb +212 -0
- data/lib/buildr/ide/idea.ipr.template +300 -0
- data/lib/buildr/ide/idea.rb +189 -0
- data/lib/buildr/ide/idea7x.ipr.template +290 -0
- data/lib/buildr/ide/idea7x.rb +210 -0
- data/lib/buildr/java.rb +23 -0
- data/lib/buildr/java/ant.rb +92 -0
- data/lib/buildr/java/bdd.rb +449 -0
- data/lib/buildr/java/commands.rb +211 -0
- data/lib/buildr/java/compiler.rb +348 -0
- data/lib/buildr/java/deprecated.rb +141 -0
- data/lib/buildr/java/jruby.rb +117 -0
- data/lib/buildr/java/jtestr_runner.rb.erb +116 -0
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +119 -0
- data/lib/buildr/java/packaging.rb +713 -0
- data/lib/buildr/java/pom.rb +178 -0
- data/lib/buildr/java/rjb.rb +155 -0
- data/lib/buildr/java/test_result.rb +308 -0
- data/lib/buildr/java/tests.rb +324 -0
- data/lib/buildr/java/version_requirement.rb +172 -0
- data/lib/buildr/packaging.rb +21 -0
- data/lib/buildr/packaging/artifact.rb +730 -0
- data/lib/buildr/packaging/artifact_namespace.rb +972 -0
- data/lib/buildr/packaging/artifact_search.rb +140 -0
- data/lib/buildr/packaging/gems.rb +102 -0
- data/lib/buildr/packaging/package.rb +233 -0
- data/lib/buildr/packaging/tar.rb +104 -0
- data/lib/buildr/packaging/zip.rb +722 -0
- data/lib/buildr/resources/buildr.icns +0 -0
- data/lib/buildr/scala.rb +19 -0
- data/lib/buildr/scala/compiler.rb +109 -0
- data/lib/buildr/scala/tests.rb +203 -0
- data/rakelib/apache.rake +191 -0
- data/rakelib/changelog.rake +57 -0
- data/rakelib/doc.rake +103 -0
- data/rakelib/package.rake +73 -0
- data/rakelib/release.rake +65 -0
- data/rakelib/rspec.rake +83 -0
- data/rakelib/rubyforge.rake +53 -0
- data/rakelib/scm.rake +49 -0
- data/rakelib/setup.rake +86 -0
- data/rakelib/stage.rake +48 -0
- data/spec/addon/cobertura_spec.rb +77 -0
- data/spec/addon/emma_spec.rb +120 -0
- data/spec/addon/test_coverage_spec.rb +255 -0
- data/spec/core/application_spec.rb +412 -0
- data/spec/core/artifact_namespace_spec.rb +646 -0
- data/spec/core/build_spec.rb +415 -0
- data/spec/core/checks_spec.rb +537 -0
- data/spec/core/common_spec.rb +664 -0
- data/spec/core/compile_spec.rb +566 -0
- data/spec/core/generate_spec.rb +33 -0
- data/spec/core/project_spec.rb +754 -0
- data/spec/core/test_spec.rb +1091 -0
- data/spec/core/transport_spec.rb +500 -0
- data/spec/groovy/bdd_spec.rb +80 -0
- data/spec/groovy/compiler_spec.rb +239 -0
- data/spec/ide/eclipse_spec.rb +243 -0
- data/spec/java/ant.rb +28 -0
- data/spec/java/bdd_spec.rb +358 -0
- data/spec/java/compiler_spec.rb +446 -0
- data/spec/java/java_spec.rb +88 -0
- data/spec/java/packaging_spec.rb +1103 -0
- data/spec/java/tests_spec.rb +466 -0
- data/spec/packaging/archive_spec.rb +503 -0
- data/spec/packaging/artifact_spec.rb +754 -0
- data/spec/packaging/packaging_helper.rb +63 -0
- data/spec/packaging/packaging_spec.rb +589 -0
- data/spec/sandbox.rb +137 -0
- data/spec/scala/compiler_spec.rb +228 -0
- data/spec/scala/tests_spec.rb +215 -0
- data/spec/spec_helpers.rb +304 -0
- data/spec/version_requirement_spec.rb +123 -0
- metadata +369 -0
@@ -0,0 +1,304 @@
|
|
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
|
+
$LOAD_PATH.unshift File.expand_path('../lib', File.dirname(__FILE__)), File.expand_path('../addon', File.dirname(__FILE__))
|
23
|
+
require 'buildr'
|
24
|
+
|
25
|
+
require File.expand_path('sandbox', File.dirname(__FILE__))
|
26
|
+
|
27
|
+
module SpecHelpers
|
28
|
+
|
29
|
+
include Checks::Matchers
|
30
|
+
|
31
|
+
[:info, :warn, :error].each do |severity|
|
32
|
+
::Object.class_eval do
|
33
|
+
define_method severity do |message|
|
34
|
+
$messages ||= {}
|
35
|
+
($messages[severity] ||= []) << message
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
class << Buildr.application
|
41
|
+
alias :deprecated_without_capture :deprecated
|
42
|
+
def deprecated(message)
|
43
|
+
verbose(true) { deprecated_without_capture message }
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
class MessageWithSeverityMatcher
|
48
|
+
def initialize(severity, message)
|
49
|
+
@severity = severity
|
50
|
+
@expect = message
|
51
|
+
end
|
52
|
+
|
53
|
+
def matches?(target)
|
54
|
+
$messages = {@severity => []}
|
55
|
+
target.call
|
56
|
+
return Regexp === @expect ? $messages[@severity].join('\n') =~ @expect : $messages[@severity].include?(@expect.to_s)
|
57
|
+
end
|
58
|
+
|
59
|
+
def failure_message
|
60
|
+
"Expected #{@severity} #{@expect.inspect}, " +
|
61
|
+
($messages[@severity].empty? ? "no #{@severity} issued" : "found #{$messages[@severity].inspect}")
|
62
|
+
end
|
63
|
+
|
64
|
+
def negative_failure_message
|
65
|
+
"Found unexpected #{$messages[@severity].inspect}"
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# Test if an info message was shown. You can use a string or regular expression.
|
70
|
+
#
|
71
|
+
# For example:
|
72
|
+
# lambda { info 'ze test' }.should show_info(/ze test/)
|
73
|
+
def show_info(message)
|
74
|
+
MessageWithSeverityMatcher.new :info, message
|
75
|
+
end
|
76
|
+
|
77
|
+
# Tests if a warning was issued. You can use a string or regular expression.
|
78
|
+
#
|
79
|
+
# For example:
|
80
|
+
# lambda { warn 'ze test' }.should show_warning(/ze test/)
|
81
|
+
def show_warning(message)
|
82
|
+
MessageWithSeverityMatcher.new :warn, message
|
83
|
+
end
|
84
|
+
|
85
|
+
# Test if an error message was shown. You can use a string or regular expression.
|
86
|
+
#
|
87
|
+
# For example:
|
88
|
+
# lambda { error 'ze test' }.should show_error(/ze test/)
|
89
|
+
def show_error(message)
|
90
|
+
MessageWithSeverityMatcher.new :error, message
|
91
|
+
end
|
92
|
+
|
93
|
+
|
94
|
+
class ::Rake::Task
|
95
|
+
alias :execute_without_a_record :execute
|
96
|
+
def execute(args)
|
97
|
+
$executed ||= []
|
98
|
+
$executed << name
|
99
|
+
execute_without_a_record args
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
class InvokeMatcher
|
104
|
+
def initialize(*tasks)
|
105
|
+
@expecting = tasks.map { |task| [task].flatten.map(&:to_s) }
|
106
|
+
end
|
107
|
+
|
108
|
+
def matches?(target)
|
109
|
+
$executed = []
|
110
|
+
target.call
|
111
|
+
return false unless all_ran?
|
112
|
+
return !@but_not.any_ran? if @but_not
|
113
|
+
return true
|
114
|
+
end
|
115
|
+
|
116
|
+
def failure_message
|
117
|
+
return @but_not.negative_failure_message if all_ran? && @but_not
|
118
|
+
"Expected the tasks #{expected} to run, but #{remaining} did not run, or not in the order we expected them to." +
|
119
|
+
" Tasks that ran: #{$executed.inspect}"
|
120
|
+
end
|
121
|
+
|
122
|
+
def negative_failure_message
|
123
|
+
if all_ran?
|
124
|
+
"Expected the tasks #{expected} to not run, but they all ran."
|
125
|
+
else
|
126
|
+
"Expected the tasks #{expected} to not run, and all but #{remaining} ran."
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
def but_not(*tasks)
|
131
|
+
@but_not = InvokeMatcher.new(*tasks)
|
132
|
+
self
|
133
|
+
end
|
134
|
+
|
135
|
+
protected
|
136
|
+
|
137
|
+
def expected
|
138
|
+
@expecting.map { |tests| tests.join('=>') }.join(', ')
|
139
|
+
end
|
140
|
+
|
141
|
+
def remaining
|
142
|
+
@remaining.map { |tests| tests.join('=>') }.join(', ')
|
143
|
+
end
|
144
|
+
|
145
|
+
def all_ran?
|
146
|
+
@remaining ||= $executed.inject(@expecting) do |expecting, executed|
|
147
|
+
expecting.map { |tasks| tasks.first == executed ? tasks[1..-1] : tasks }.reject(&:empty?)
|
148
|
+
end
|
149
|
+
@remaining.empty?
|
150
|
+
end
|
151
|
+
|
152
|
+
def any_ran?
|
153
|
+
all_ran?
|
154
|
+
@remaining.size < @expecting.size
|
155
|
+
end
|
156
|
+
|
157
|
+
end
|
158
|
+
|
159
|
+
# Tests that all the tasks ran, in the order specified. Can also be used to test that some
|
160
|
+
# tasks and not others ran.
|
161
|
+
#
|
162
|
+
# Takes a list of arguments. Each argument can be a task name, matching only if that task ran.
|
163
|
+
# Each argument can be an array of task names, matching only if all these tasks ran in that order.
|
164
|
+
# So run_tasks('foo', 'bar') expects foo and bar to run in any order, but run_task(['foo', 'bar'])
|
165
|
+
# expects foo to run before bar.
|
166
|
+
#
|
167
|
+
# You can call but_not on the matchers to specify that certain tasks must not execute.
|
168
|
+
#
|
169
|
+
# For example:
|
170
|
+
# # Either task
|
171
|
+
# lambda { task('compile').invoke }.should run_tasks('compile', 'resources')
|
172
|
+
# # In that order
|
173
|
+
# lambda { task('build').invoke }.should run_tasks(['compile', 'test'])
|
174
|
+
# # With exclusion
|
175
|
+
# lambda { task('build').invoke }.should run_tasks('compile').but_not('install')
|
176
|
+
def run_tasks(*tasks)
|
177
|
+
InvokeMatcher.new *tasks
|
178
|
+
end
|
179
|
+
|
180
|
+
# Tests that a task ran. Similar to run_tasks, but accepts a single task name.
|
181
|
+
#
|
182
|
+
# For example:
|
183
|
+
# lambda { task('build').invoke }.should run_task('test')
|
184
|
+
def run_task(task)
|
185
|
+
InvokeMatcher.new [task]
|
186
|
+
end
|
187
|
+
|
188
|
+
class UriPathMatcher
|
189
|
+
def initialize(re)
|
190
|
+
@expression = re
|
191
|
+
end
|
192
|
+
|
193
|
+
def matches?(uri)
|
194
|
+
@uri = uri
|
195
|
+
uri.path =~ @expression
|
196
|
+
end
|
197
|
+
|
198
|
+
def description
|
199
|
+
"URI with path matching #{@expression}"
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
# Matches a parsed URI's path against the given regular expression
|
204
|
+
def uri(re)
|
205
|
+
UriPathMatcher.new(re)
|
206
|
+
end
|
207
|
+
|
208
|
+
|
209
|
+
class AbsolutePathMatcher
|
210
|
+
def initialize(path)
|
211
|
+
@expected = File.expand_path(path.to_s)
|
212
|
+
end
|
213
|
+
|
214
|
+
def matches?(path)
|
215
|
+
@provided = File.expand_path(path.to_s)
|
216
|
+
@provided == @expected
|
217
|
+
end
|
218
|
+
|
219
|
+
def failure_message
|
220
|
+
"Expected path #{@expected}, but found path #{@provided}"
|
221
|
+
end
|
222
|
+
|
223
|
+
def negative_failure_message
|
224
|
+
"Expected a path other than #{@expected}"
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
def point_to_path(path)
|
229
|
+
AbsolutePathMatcher.new(path)
|
230
|
+
end
|
231
|
+
|
232
|
+
|
233
|
+
def suppress_stdout
|
234
|
+
stdout = $stdout
|
235
|
+
$stdout = StringIO.new
|
236
|
+
begin
|
237
|
+
yield
|
238
|
+
ensure
|
239
|
+
$stdout = stdout
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
def dryrun
|
244
|
+
Buildr.application.options.dryrun = true
|
245
|
+
begin
|
246
|
+
suppress_stdout { yield }
|
247
|
+
ensure
|
248
|
+
Buildr.application.options.dryrun = false
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
252
|
+
# We run tests with tracing off. Then things break. And we need to figure out what went wrong.
|
253
|
+
# So just use trace() as you would use verbose() to find and squash the bug.
|
254
|
+
def trace(value = nil)
|
255
|
+
old_value = Buildr.application.options.trace
|
256
|
+
Buildr.application.options.trace = value unless value.nil?
|
257
|
+
if block_given?
|
258
|
+
begin
|
259
|
+
yield
|
260
|
+
ensure
|
261
|
+
Buildr.application.options.trace = old_value
|
262
|
+
end
|
263
|
+
end
|
264
|
+
Buildr.application.options.trace
|
265
|
+
end
|
266
|
+
|
267
|
+
# Change the Buildr original directory, faking invocation from a different directory.
|
268
|
+
def in_original_dir(dir)
|
269
|
+
begin
|
270
|
+
original_dir = Buildr.application.original_dir
|
271
|
+
Buildr.application.instance_eval { @original_dir = File.expand_path(dir) }
|
272
|
+
yield
|
273
|
+
ensure
|
274
|
+
Buildr.application.instance_eval { @original_dir = original_dir }
|
275
|
+
end
|
276
|
+
end
|
277
|
+
|
278
|
+
|
279
|
+
# Buildr's define method creates a project definition but does not evaluate it
|
280
|
+
# (that happens once the buildfile is loaded), and we include Buildr's define in
|
281
|
+
# the test context so we can use it without prefixing with Buildr. This just patches
|
282
|
+
# define to evaluate the project definition before returning it.
|
283
|
+
def define(name, properties = nil, &block) #:yields:project
|
284
|
+
Project.define(name, properties, &block).tap { |project| project.invoke }
|
285
|
+
end
|
286
|
+
|
287
|
+
end
|
288
|
+
|
289
|
+
|
290
|
+
# Allow using matchers within the project definition.
|
291
|
+
class Buildr::Project
|
292
|
+
include ::Spec::Matchers, SpecHelpers
|
293
|
+
end
|
294
|
+
|
295
|
+
|
296
|
+
Spec::Runner.configure do |config|
|
297
|
+
# Make all Buildr methods accessible from test cases, and add various helper methods.
|
298
|
+
config.include Buildr, SpecHelpers
|
299
|
+
|
300
|
+
# Sanbdox Buildr for each test.
|
301
|
+
config.include Sandbox
|
302
|
+
end
|
303
|
+
|
304
|
+
end
|
@@ -0,0 +1,123 @@
|
|
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
|
metadata
ADDED
@@ -0,0 +1,369 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: assaf-buildr
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.3.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Apache Buildr
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-10-08 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rake
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - "="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.8.1
|
23
|
+
version:
|
24
|
+
- !ruby/object:Gem::Dependency
|
25
|
+
name: builder
|
26
|
+
version_requirement:
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - "="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: 2.1.2
|
32
|
+
version:
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: net-ssh
|
35
|
+
version_requirement:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.0.4
|
41
|
+
version:
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: net-sftp
|
44
|
+
version_requirement:
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 2.0.1
|
50
|
+
version:
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
name: rubyzip
|
53
|
+
version_requirement:
|
54
|
+
version_requirements: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - "="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: 0.9.1
|
59
|
+
version:
|
60
|
+
- !ruby/object:Gem::Dependency
|
61
|
+
name: highline
|
62
|
+
version_requirement:
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 1.4.0
|
68
|
+
version:
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubyforge
|
71
|
+
version_requirement:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 1.0.0
|
77
|
+
version:
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: hoe
|
80
|
+
version_requirement:
|
81
|
+
version_requirements: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - "="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 1.7.0
|
86
|
+
version:
|
87
|
+
- !ruby/object:Gem::Dependency
|
88
|
+
name: rjb
|
89
|
+
version_requirement:
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - "="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: 1.1.6
|
95
|
+
version:
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
name: Antwrap
|
98
|
+
version_requirement:
|
99
|
+
version_requirements: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.7.0
|
104
|
+
version:
|
105
|
+
- !ruby/object:Gem::Dependency
|
106
|
+
name: rspec
|
107
|
+
version_requirement:
|
108
|
+
version_requirements: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - "="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: 1.1.5
|
113
|
+
version:
|
114
|
+
- !ruby/object:Gem::Dependency
|
115
|
+
name: xml-simple
|
116
|
+
version_requirement:
|
117
|
+
version_requirements: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - "="
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: 1.0.11
|
122
|
+
version:
|
123
|
+
- !ruby/object:Gem::Dependency
|
124
|
+
name: archive-tar-minitar
|
125
|
+
version_requirement:
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - "="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: 0.5.2
|
131
|
+
version:
|
132
|
+
description:
|
133
|
+
email: buildr-user@incubator.apache.org
|
134
|
+
executables:
|
135
|
+
- buildr
|
136
|
+
extensions: []
|
137
|
+
|
138
|
+
extra_rdoc_files:
|
139
|
+
- README.rdoc
|
140
|
+
- CHANGELOG
|
141
|
+
- LICENSE
|
142
|
+
- NOTICE
|
143
|
+
- DISCLAIMER
|
144
|
+
files:
|
145
|
+
- lib/buildr
|
146
|
+
- lib/buildr/ide
|
147
|
+
- lib/buildr/ide/idea.ipr.template
|
148
|
+
- lib/buildr/ide/eclipse.rb
|
149
|
+
- lib/buildr/ide/idea7x.ipr.template
|
150
|
+
- lib/buildr/ide/idea7x.rb
|
151
|
+
- lib/buildr/ide/idea.rb
|
152
|
+
- lib/buildr/core
|
153
|
+
- lib/buildr/core/progressbar.rb
|
154
|
+
- lib/buildr/core/transports.rb
|
155
|
+
- lib/buildr/core/common.rb
|
156
|
+
- lib/buildr/core/filter.rb
|
157
|
+
- lib/buildr/core/compile.rb
|
158
|
+
- lib/buildr/core/test.rb
|
159
|
+
- lib/buildr/core/application_cli.rb
|
160
|
+
- lib/buildr/core/help.rb
|
161
|
+
- lib/buildr/core/project.rb
|
162
|
+
- lib/buildr/core/checks.rb
|
163
|
+
- lib/buildr/core/build.rb
|
164
|
+
- lib/buildr/core/util.rb
|
165
|
+
- lib/buildr/core/generate.rb
|
166
|
+
- lib/buildr/core/environment.rb
|
167
|
+
- lib/buildr/core/application.rb
|
168
|
+
- lib/buildr/java
|
169
|
+
- lib/buildr/java/org
|
170
|
+
- lib/buildr/java/org/apache
|
171
|
+
- lib/buildr/java/org/apache/buildr
|
172
|
+
- lib/buildr/java/org/apache/buildr/JavaTestFilter.class
|
173
|
+
- lib/buildr/java/org/apache/buildr/JavaTestFilter.java
|
174
|
+
- lib/buildr/java/packaging.rb
|
175
|
+
- lib/buildr/java/commands.rb
|
176
|
+
- lib/buildr/java/jruby.rb
|
177
|
+
- lib/buildr/java/jtestr_runner.rb.erb
|
178
|
+
- lib/buildr/java/compiler.rb
|
179
|
+
- lib/buildr/java/version_requirement.rb
|
180
|
+
- lib/buildr/java/tests.rb
|
181
|
+
- lib/buildr/java/deprecated.rb
|
182
|
+
- lib/buildr/java/bdd.rb
|
183
|
+
- lib/buildr/java/ant.rb
|
184
|
+
- lib/buildr/java/pom.rb
|
185
|
+
- lib/buildr/java/rjb.rb
|
186
|
+
- lib/buildr/java/test_result.rb
|
187
|
+
- lib/buildr/core.rb
|
188
|
+
- lib/buildr/packaging.rb
|
189
|
+
- lib/buildr/scala
|
190
|
+
- lib/buildr/scala/compiler.rb
|
191
|
+
- lib/buildr/scala/tests.rb
|
192
|
+
- lib/buildr/scala.rb
|
193
|
+
- lib/buildr/groovy
|
194
|
+
- lib/buildr/groovy/compiler.rb
|
195
|
+
- lib/buildr/groovy/bdd.rb
|
196
|
+
- lib/buildr/ide.rb
|
197
|
+
- lib/buildr/groovy.rb
|
198
|
+
- lib/buildr/resources
|
199
|
+
- lib/buildr/resources/buildr.icns
|
200
|
+
- lib/buildr/packaging
|
201
|
+
- lib/buildr/packaging/artifact_search.rb
|
202
|
+
- lib/buildr/packaging/artifact_namespace.rb
|
203
|
+
- lib/buildr/packaging/gems.rb
|
204
|
+
- lib/buildr/packaging/tar.rb
|
205
|
+
- lib/buildr/packaging/zip.rb
|
206
|
+
- lib/buildr/packaging/artifact.rb
|
207
|
+
- lib/buildr/packaging/package.rb
|
208
|
+
- lib/buildr/java.rb
|
209
|
+
- lib/buildr.rb
|
210
|
+
- bin/buildr
|
211
|
+
- addon/buildr
|
212
|
+
- addon/buildr/org
|
213
|
+
- addon/buildr/org/apache
|
214
|
+
- addon/buildr/org/apache/buildr
|
215
|
+
- addon/buildr/org/apache/buildr/JettyWrapper.java
|
216
|
+
- addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class
|
217
|
+
- addon/buildr/org/apache/buildr/BuildrNail.java
|
218
|
+
- addon/buildr/org/apache/buildr/JettyWrapper.class
|
219
|
+
- addon/buildr/org/apache/buildr/BuildrNail$Main.class
|
220
|
+
- addon/buildr/org/apache/buildr/BuildrNail.class
|
221
|
+
- addon/buildr/org/apache/buildr/JettyWrapper$1.class
|
222
|
+
- addon/buildr/nailgun.rb
|
223
|
+
- addon/buildr/cobertura.rb
|
224
|
+
- addon/buildr/hibernate.rb
|
225
|
+
- addon/buildr/antlr.rb
|
226
|
+
- addon/buildr/jetty.rb
|
227
|
+
- addon/buildr/emma.rb
|
228
|
+
- addon/buildr/xmlbeans.rb
|
229
|
+
- addon/buildr/openjpa.rb
|
230
|
+
- addon/buildr/javacc.rb
|
231
|
+
- addon/buildr/jdepend.rb
|
232
|
+
- addon/buildr/jibx.rb
|
233
|
+
- doc/css
|
234
|
+
- doc/css/default.css
|
235
|
+
- doc/css/syntax.css
|
236
|
+
- doc/css/print.css
|
237
|
+
- doc/pages
|
238
|
+
- doc/pages/settings_profiles.textile
|
239
|
+
- doc/pages/artifacts.textile
|
240
|
+
- doc/pages/whats_new.textile
|
241
|
+
- doc/pages/extending.textile
|
242
|
+
- doc/pages/index.textile
|
243
|
+
- doc/pages/recipes.textile
|
244
|
+
- doc/pages/more_stuff.textile
|
245
|
+
- doc/pages/mailing_lists.textile
|
246
|
+
- doc/pages/testing.textile
|
247
|
+
- doc/pages/projects.textile
|
248
|
+
- doc/pages/contributing.textile
|
249
|
+
- doc/pages/download.textile
|
250
|
+
- doc/pages/building.textile
|
251
|
+
- doc/pages/languages.textile
|
252
|
+
- doc/pages/getting_started.textile
|
253
|
+
- doc/pages/packaging.textile
|
254
|
+
- doc/pages/troubleshooting.textile
|
255
|
+
- doc/scripts
|
256
|
+
- doc/scripts/install-linux.sh
|
257
|
+
- doc/scripts/buildr-git.rb
|
258
|
+
- doc/scripts/install-jruby.sh
|
259
|
+
- doc/scripts/install-osx.sh
|
260
|
+
- doc/print.toc.yaml
|
261
|
+
- doc/site.toc.yaml
|
262
|
+
- doc/images
|
263
|
+
- doc/images/favicon.png
|
264
|
+
- doc/images/note.png
|
265
|
+
- doc/images/apache-incubator-logo.png
|
266
|
+
- doc/images/tip.png
|
267
|
+
- doc/images/zbuildr.tif
|
268
|
+
- doc/images/buildr.png
|
269
|
+
- doc/images/growl-icon.tiff
|
270
|
+
- doc/images/buildr-hires.png
|
271
|
+
- doc/images/project-structure.png
|
272
|
+
- doc/site.haml
|
273
|
+
- doc/print.haml
|
274
|
+
- spec/ide
|
275
|
+
- spec/ide/eclipse_spec.rb
|
276
|
+
- spec/core
|
277
|
+
- spec/core/artifact_namespace_spec.rb
|
278
|
+
- spec/core/build_spec.rb
|
279
|
+
- spec/core/generate_spec.rb
|
280
|
+
- spec/core/test_spec.rb
|
281
|
+
- spec/core/compile_spec.rb
|
282
|
+
- spec/core/checks_spec.rb
|
283
|
+
- spec/core/transport_spec.rb
|
284
|
+
- spec/core/common_spec.rb
|
285
|
+
- spec/core/application_spec.rb
|
286
|
+
- spec/core/project_spec.rb
|
287
|
+
- spec/java
|
288
|
+
- spec/java/compiler_spec.rb
|
289
|
+
- spec/java/tests_spec.rb
|
290
|
+
- spec/java/packaging_spec.rb
|
291
|
+
- spec/java/ant.rb
|
292
|
+
- spec/java/java_spec.rb
|
293
|
+
- spec/java/bdd_spec.rb
|
294
|
+
- spec/addon
|
295
|
+
- spec/addon/test_coverage_spec.rb
|
296
|
+
- spec/addon/emma_spec.rb
|
297
|
+
- spec/addon/cobertura_spec.rb
|
298
|
+
- spec/scala
|
299
|
+
- spec/scala/compiler_spec.rb
|
300
|
+
- spec/scala/tests_spec.rb
|
301
|
+
- spec/sandbox.rb
|
302
|
+
- spec/spec_helpers.rb
|
303
|
+
- spec/groovy
|
304
|
+
- spec/groovy/compiler_spec.rb
|
305
|
+
- spec/groovy/bdd_spec.rb
|
306
|
+
- spec/version_requirement_spec.rb
|
307
|
+
- spec/packaging
|
308
|
+
- spec/packaging/artifact_spec.rb
|
309
|
+
- spec/packaging/packaging_spec.rb
|
310
|
+
- spec/packaging/packaging_helper.rb
|
311
|
+
- spec/packaging/archive_spec.rb
|
312
|
+
- README.rdoc
|
313
|
+
- LICENSE
|
314
|
+
- NOTICE
|
315
|
+
- DISCLAIMER
|
316
|
+
- CHANGELOG
|
317
|
+
- buildr.gemspec
|
318
|
+
- buildr.buildfile
|
319
|
+
- Rakefile
|
320
|
+
- rakelib/apache.rake
|
321
|
+
- rakelib/changelog.rake
|
322
|
+
- rakelib/rubyforge.rake
|
323
|
+
- rakelib/scm.rake
|
324
|
+
- rakelib/rspec.rake
|
325
|
+
- rakelib/stage.rake
|
326
|
+
- rakelib/setup.rake
|
327
|
+
- rakelib/release.rake
|
328
|
+
- rakelib/doc.rake
|
329
|
+
- rakelib/package.rake
|
330
|
+
- _buildr
|
331
|
+
- etc/KEYS
|
332
|
+
- etc/git-svn-authors
|
333
|
+
has_rdoc: true
|
334
|
+
homepage: http://incubator.apache.org/buildr
|
335
|
+
post_install_message:
|
336
|
+
rdoc_options:
|
337
|
+
- --title
|
338
|
+
- Buildr
|
339
|
+
- --main
|
340
|
+
- README.rdoc
|
341
|
+
- --line-numbers
|
342
|
+
- --inline-source
|
343
|
+
- -p
|
344
|
+
- --webcvs
|
345
|
+
- http://svn.apache.org/repos/asf/incubator/buildr/trunk/
|
346
|
+
require_paths:
|
347
|
+
- lib
|
348
|
+
- addon
|
349
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
350
|
+
requirements:
|
351
|
+
- - ">="
|
352
|
+
- !ruby/object:Gem::Version
|
353
|
+
version: "0"
|
354
|
+
version:
|
355
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
356
|
+
requirements:
|
357
|
+
- - ">="
|
358
|
+
- !ruby/object:Gem::Version
|
359
|
+
version: "0"
|
360
|
+
version:
|
361
|
+
requirements: []
|
362
|
+
|
363
|
+
rubyforge_project: buildr
|
364
|
+
rubygems_version: 1.2.0
|
365
|
+
signing_key:
|
366
|
+
specification_version: 2
|
367
|
+
summary: A build system that doesn't suck
|
368
|
+
test_files: []
|
369
|
+
|