mguymon-buildr 1.4.5-java
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +1291 -0
- data/LICENSE +176 -0
- data/NOTICE +26 -0
- data/README.rdoc +134 -0
- data/Rakefile +44 -0
- data/_buildr +35 -0
- data/_jbuildr +35 -0
- data/addon/buildr/antlr.rb +65 -0
- data/addon/buildr/bnd.rb +147 -0
- data/addon/buildr/cobertura.rb +22 -0
- data/addon/buildr/drb.rb +281 -0
- data/addon/buildr/emma.rb +22 -0
- data/addon/buildr/hibernate.rb +149 -0
- data/addon/buildr/javacc.rb +85 -0
- data/addon/buildr/jaxb_xjc.rb +72 -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 +221 -0
- data/addon/buildr/openjpa.rb +88 -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/protobuf.rb +88 -0
- data/addon/buildr/xmlbeans.rb +93 -0
- data/bin/buildr +19 -0
- data/buildr.buildfile +58 -0
- data/buildr.gemspec +78 -0
- data/doc/_config.yml +1 -0
- data/doc/_layouts/default.html +90 -0
- data/doc/_layouts/preface.html +22 -0
- data/doc/artifacts.textile +217 -0
- data/doc/building.textile +276 -0
- data/doc/contributing.textile +268 -0
- data/doc/css/default.css +236 -0
- data/doc/css/print.css +101 -0
- data/doc/css/syntax.css +23 -0
- data/doc/download.textile +151 -0
- data/doc/extending.textile +212 -0
- data/doc/images/1442160941-frontcover.jpg +0 -0
- data/doc/images/asf-logo.gif +0 -0
- data/doc/images/asf-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.png +0 -0
- data/doc/images/zbuildr.tif +0 -0
- data/doc/index.textile +109 -0
- data/doc/installing.textile +284 -0
- data/doc/languages.textile +599 -0
- data/doc/mailing_lists.textile +29 -0
- data/doc/more_stuff.textile +845 -0
- data/doc/packaging.textile +618 -0
- data/doc/preface.textile +54 -0
- data/doc/projects.textile +276 -0
- data/doc/quick_start.textile +210 -0
- data/doc/releasing.textile +117 -0
- data/doc/scripts/buildr-git.rb +512 -0
- data/doc/scripts/gitflow.rb +296 -0
- data/doc/scripts/install-jruby.sh +44 -0
- data/doc/scripts/install-linux.sh +73 -0
- data/doc/scripts/install-osx.sh +52 -0
- data/doc/settings_profiles.textile +287 -0
- data/doc/testing.textile +247 -0
- data/etc/KEYS +189 -0
- data/lib/buildr.rb +44 -0
- data/lib/buildr/clojure.rb +34 -0
- data/lib/buildr/clojure/shell.rb +52 -0
- data/lib/buildr/core.rb +34 -0
- data/lib/buildr/core/application.rb +700 -0
- data/lib/buildr/core/build.rb +516 -0
- data/lib/buildr/core/cc.rb +166 -0
- data/lib/buildr/core/checks.rb +253 -0
- data/lib/buildr/core/common.rb +151 -0
- data/lib/buildr/core/compile.rb +622 -0
- data/lib/buildr/core/doc.rb +276 -0
- data/lib/buildr/core/environment.rb +129 -0
- data/lib/buildr/core/filter.rb +404 -0
- data/lib/buildr/core/generate.rb +197 -0
- data/lib/buildr/core/help.rb +119 -0
- data/lib/buildr/core/jrebel.rb +42 -0
- data/lib/buildr/core/linux.rb +30 -0
- data/lib/buildr/core/osx.rb +46 -0
- data/lib/buildr/core/progressbar.rb +161 -0
- data/lib/buildr/core/project.rb +975 -0
- data/lib/buildr/core/run.rb +43 -0
- data/lib/buildr/core/shell.rb +137 -0
- data/lib/buildr/core/test.rb +843 -0
- data/lib/buildr/core/transports.rb +575 -0
- data/lib/buildr/core/util.rb +537 -0
- data/lib/buildr/groovy.rb +20 -0
- data/lib/buildr/groovy/bdd.rb +106 -0
- data/lib/buildr/groovy/compiler.rb +153 -0
- data/lib/buildr/groovy/doc.rb +76 -0
- data/lib/buildr/groovy/shell.rb +57 -0
- data/lib/buildr/ide.rb +19 -0
- data/lib/buildr/ide/eclipse.rb +427 -0
- data/lib/buildr/ide/eclipse/java.rb +53 -0
- data/lib/buildr/ide/eclipse/plugin.rb +71 -0
- data/lib/buildr/ide/eclipse/scala.rb +68 -0
- data/lib/buildr/ide/idea.rb +576 -0
- data/lib/buildr/java.rb +25 -0
- data/lib/buildr/java/ant.rb +94 -0
- data/lib/buildr/java/bdd.rb +460 -0
- data/lib/buildr/java/cobertura.rb +297 -0
- data/lib/buildr/java/commands.rb +223 -0
- data/lib/buildr/java/compiler.rb +135 -0
- data/lib/buildr/java/deprecated.rb +141 -0
- data/lib/buildr/java/doc.rb +86 -0
- data/lib/buildr/java/ecj.rb +69 -0
- data/lib/buildr/java/emma.rb +244 -0
- data/lib/buildr/java/external.rb +73 -0
- data/lib/buildr/java/jruby.rb +122 -0
- data/lib/buildr/java/jtestr_result.rb +295 -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 +142 -0
- data/lib/buildr/java/packaging.rb +734 -0
- data/lib/buildr/java/pom.rb +178 -0
- data/lib/buildr/java/rjb.rb +154 -0
- data/lib/buildr/java/test_result.rb +101 -0
- data/lib/buildr/java/tests.rb +362 -0
- data/lib/buildr/java/version_requirement.rb +172 -0
- data/lib/buildr/packaging.rb +25 -0
- data/lib/buildr/packaging/archive.rb +535 -0
- data/lib/buildr/packaging/artifact.rb +904 -0
- data/lib/buildr/packaging/artifact_namespace.rb +984 -0
- data/lib/buildr/packaging/artifact_search.rb +140 -0
- data/lib/buildr/packaging/gems.rb +105 -0
- data/lib/buildr/packaging/package.rb +249 -0
- data/lib/buildr/packaging/repository_array.rb +108 -0
- data/lib/buildr/packaging/tar.rb +189 -0
- data/lib/buildr/packaging/version_requirement.rb +192 -0
- data/lib/buildr/packaging/zip.rb +178 -0
- data/lib/buildr/packaging/ziptask.rb +356 -0
- data/lib/buildr/resources/buildr.icns +0 -0
- data/lib/buildr/resources/completed.png +0 -0
- data/lib/buildr/resources/failed.png +0 -0
- data/lib/buildr/resources/icons-license.txt +17 -0
- data/lib/buildr/run.rb +195 -0
- data/lib/buildr/scala.rb +26 -0
- data/lib/buildr/scala/bdd.rb +118 -0
- data/lib/buildr/scala/compiler.rb +242 -0
- data/lib/buildr/scala/doc.rb +142 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.java +57 -0
- data/lib/buildr/scala/shell.rb +52 -0
- data/lib/buildr/scala/tests.rb +171 -0
- data/lib/buildr/shell.rb +185 -0
- data/lib/buildr/version.rb +18 -0
- data/rakelib/all-in-one.rake +113 -0
- data/rakelib/checks.rake +57 -0
- data/rakelib/doc.rake +137 -0
- data/rakelib/metrics.rake +39 -0
- data/rakelib/package.rake +73 -0
- data/rakelib/release.rake +160 -0
- data/rakelib/rspec.rake +91 -0
- data/rakelib/setup.rake +66 -0
- data/rakelib/stage.rake +220 -0
- data/spec/addon/bnd_spec.rb +330 -0
- data/spec/addon/drb_spec.rb +328 -0
- data/spec/addon/jaxb_xjc_spec.rb +125 -0
- data/spec/core/application_spec.rb +631 -0
- data/spec/core/build_spec.rb +837 -0
- data/spec/core/cc_spec.rb +224 -0
- data/spec/core/checks_spec.rb +519 -0
- data/spec/core/common_spec.rb +725 -0
- data/spec/core/compile_spec.rb +658 -0
- data/spec/core/doc_spec.rb +195 -0
- data/spec/core/extension_spec.rb +201 -0
- data/spec/core/generate_spec.rb +33 -0
- data/spec/core/project_spec.rb +772 -0
- data/spec/core/run_spec.rb +93 -0
- data/spec/core/shell_spec.rb +146 -0
- data/spec/core/test_spec.rb +1320 -0
- data/spec/core/transport_spec.rb +544 -0
- data/spec/core/util_spec.rb +141 -0
- data/spec/groovy/bdd_spec.rb +80 -0
- data/spec/groovy/compiler_spec.rb +251 -0
- data/spec/groovy/doc_spec.rb +65 -0
- data/spec/ide/eclipse_spec.rb +739 -0
- data/spec/ide/idea_spec.rb +1145 -0
- data/spec/java/ant_spec.rb +37 -0
- data/spec/java/bdd_spec.rb +374 -0
- data/spec/java/cobertura_spec.rb +112 -0
- data/spec/java/commands_spec.rb +93 -0
- data/spec/java/compiler_spec.rb +252 -0
- data/spec/java/doc_spec.rb +56 -0
- data/spec/java/ecj_spec.rb +115 -0
- data/spec/java/emma_spec.rb +121 -0
- data/spec/java/external_spec.rb +56 -0
- data/spec/java/java_spec.rb +132 -0
- data/spec/java/packaging_spec.rb +1266 -0
- data/spec/java/run_spec.rb +78 -0
- data/spec/java/test_coverage_helper.rb +257 -0
- data/spec/java/tests_spec.rb +497 -0
- data/spec/packaging/archive_spec.rb +775 -0
- data/spec/packaging/artifact_namespace_spec.rb +743 -0
- data/spec/packaging/artifact_spec.rb +1074 -0
- data/spec/packaging/packaging_helper.rb +63 -0
- data/spec/packaging/packaging_spec.rb +719 -0
- data/spec/packaging/repository_array_spec.rb +109 -0
- data/spec/sandbox.rb +165 -0
- data/spec/scala/bdd_spec.rb +124 -0
- data/spec/scala/compiler_spec.rb +289 -0
- data/spec/scala/doc_spec.rb +88 -0
- data/spec/scala/scala.rb +38 -0
- data/spec/scala/tests_spec.rb +283 -0
- data/spec/spec_helpers.rb +369 -0
- data/spec/version_requirement_spec.rb +143 -0
- data/spec/xpath_matchers.rb +121 -0
- metadata +600 -0
@@ -0,0 +1,743 @@
|
|
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
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helpers'))
|
17
|
+
|
18
|
+
describe Buildr::ArtifactNamespace do
|
19
|
+
|
20
|
+
before(:each) { Buildr::ArtifactNamespace.clear }
|
21
|
+
|
22
|
+
def abc_module
|
23
|
+
Object.module_eval 'module A; module B; module C; end; end; end'
|
24
|
+
yield
|
25
|
+
ensure
|
26
|
+
Object.send :remove_const, :A
|
27
|
+
end
|
28
|
+
|
29
|
+
describe '.root' do
|
30
|
+
it 'should return the top level namespace' do
|
31
|
+
Buildr::ArtifactNamespace.root.should be_root
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should yield the namespace if a block is given' do
|
35
|
+
flag = false
|
36
|
+
Buildr::ArtifactNamespace.root { |ns| flag = true; ns.should be_root }
|
37
|
+
flag.should == true
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'should return the root when used outside of a project definition' do
|
41
|
+
artifact_ns.should be_root
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'should yield to a block when used outside of a project definition' do
|
45
|
+
flag = false
|
46
|
+
artifact_ns {|ns| flag = true; ns.should be_root}
|
47
|
+
flag.should == true
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe '.instance' do
|
52
|
+
it 'should return the top level namespace when invoked outside a project definition' do
|
53
|
+
artifact_ns.should be_root
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'should return the namespace for the receiving project' do
|
57
|
+
define('foo') { }
|
58
|
+
project('foo').artifact_ns.name.should == 'foo'
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'should return the current project namespace when invoked inside a project' do
|
62
|
+
define 'foo' do
|
63
|
+
artifact_ns.should_not be_root
|
64
|
+
artifact_ns.name.should == 'foo'
|
65
|
+
task :doit do
|
66
|
+
artifact_ns.should_not be_root
|
67
|
+
artifact_ns.name.should == 'foo'
|
68
|
+
end.invoke
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'should return the root namespace if given :root' do
|
73
|
+
artifact_ns(:root).should be_root
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'should return the namespace for the given name' do
|
77
|
+
artifact_ns(:foo).name.should == 'foo'
|
78
|
+
artifact_ns('foo:bar').name.should == 'foo:bar'
|
79
|
+
artifact_ns(['foo', 'bar', 'baz']).name.should == 'foo:bar:baz'
|
80
|
+
abc_module do
|
81
|
+
artifact_ns(A::B::C).name.should == 'A::B::C'
|
82
|
+
end
|
83
|
+
artifact_ns(:root).should be_root
|
84
|
+
artifact_ns(:current).should be_root
|
85
|
+
define 'foo' do
|
86
|
+
artifact_ns(:current).name.should == 'foo'
|
87
|
+
define 'baz' do
|
88
|
+
artifact_ns(:current).name.should == 'foo:baz'
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
describe '#parent' do
|
95
|
+
it 'should be nil for root namespace' do
|
96
|
+
artifact_ns(:root).parent.should be_nil
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'should be the parent namespace for nested modules' do
|
100
|
+
abc_module do
|
101
|
+
artifact_ns(A::B::C).parent.should == artifact_ns(A::B)
|
102
|
+
artifact_ns(A::B).parent.should == artifact_ns(A)
|
103
|
+
artifact_ns(A).parent.should == artifact_ns(:root)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
it 'should be the parent namespace for nested projects' do
|
108
|
+
define 'a' do
|
109
|
+
define 'b' do
|
110
|
+
define 'c' do
|
111
|
+
artifact_ns.parent.should == artifact_ns(parent)
|
112
|
+
end
|
113
|
+
artifact_ns.parent.should == artifact_ns(parent)
|
114
|
+
end
|
115
|
+
artifact_ns.parent.should == artifact_ns(:root)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
describe '#parent=' do
|
121
|
+
it 'should reject to set parent for root namespace' do
|
122
|
+
lambda { artifact_ns(:root).parent = :foo }.should raise_error(Exception, /cannot set parent/i)
|
123
|
+
end
|
124
|
+
|
125
|
+
it 'should allow to set parent' do
|
126
|
+
artifact_ns(:bar).parent = :foo
|
127
|
+
artifact_ns(:bar).parent.should == artifact_ns(:foo)
|
128
|
+
artifact_ns(:bar).parent = artifact_ns(:baz)
|
129
|
+
artifact_ns(:bar).parent.should == artifact_ns(:baz)
|
130
|
+
end
|
131
|
+
|
132
|
+
it 'should allow to set parent to :current' do
|
133
|
+
abc_module do
|
134
|
+
mod = A::B
|
135
|
+
artifact_ns(mod).parent = :current
|
136
|
+
def mod.stuff
|
137
|
+
Buildr::artifact_ns(self)
|
138
|
+
end
|
139
|
+
define 'a' do
|
140
|
+
define 'b' do
|
141
|
+
mod.stuff.parent.should == artifact_ns
|
142
|
+
end
|
143
|
+
mod.stuff.parent.should == artifact_ns
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
describe '#need' do
|
150
|
+
it 'should accept an artifact spec' do
|
151
|
+
define 'one' do
|
152
|
+
artifact_ns.need 'a:b:c:1'
|
153
|
+
# referenced by spec
|
154
|
+
artifact_ns['a:b:c'].should_not be_selected
|
155
|
+
|
156
|
+
# referenced by name
|
157
|
+
artifact_ns[:b].should_not be_selected
|
158
|
+
artifact_ns[:b].should be_satisfied_by('a:b:c:1')
|
159
|
+
artifact_ns[:b].should_not be_satisfied_by('a:b:c:2')
|
160
|
+
artifact_ns[:b].should_not be_satisfied_by('d:b:c:1')
|
161
|
+
artifact_ns[:b].version.should == '1'
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
it 'should accept a requirement_spec' do
|
166
|
+
define 'one' do
|
167
|
+
artifact_ns.need 'thing -> a:b:c:2.1 -> ~>2.0'
|
168
|
+
# referenced by spec
|
169
|
+
artifact_ns['a:b:c'].should_not be_selected
|
170
|
+
|
171
|
+
# referenced by name
|
172
|
+
artifact_ns.key?(:b).should be_false
|
173
|
+
artifact_ns[:thing].should_not be_selected
|
174
|
+
artifact_ns[:thing].should be_satisfied_by('a:b:c:2.5')
|
175
|
+
artifact_ns[:thing].should_not be_satisfied_by('a:b:c:3')
|
176
|
+
artifact_ns[:thing].version.should == '2.1'
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
it 'should accept a hash :name -> requirement_spec' do
|
181
|
+
define 'one' do
|
182
|
+
artifact_ns.need :thing => 'a:b:c:2.1 -> ~>2.0'
|
183
|
+
artifact_ns[:thing].should be_satisfied_by('a:b:c:2.5')
|
184
|
+
artifact_ns[:thing].should_not be_satisfied_by('a:b:c:3')
|
185
|
+
artifact_ns[:thing].version.should == '2.1'
|
186
|
+
end
|
187
|
+
|
188
|
+
define 'two' do
|
189
|
+
artifact_ns.need :thing => 'a:b:c:(~>2.0 | 2.1)'
|
190
|
+
artifact_ns[:thing].should be_satisfied_by('a:b:c:2.5')
|
191
|
+
artifact_ns[:thing].should_not be_satisfied_by('a:b:c:3')
|
192
|
+
artifact_ns[:thing].version.should == '2.1'
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
it 'should take a hash :name -> specs_array' do
|
197
|
+
define 'one' do
|
198
|
+
artifact_ns.need :things => ['foo:bar:jar:1.0',
|
199
|
+
'foo:baz:jar:2.0',]
|
200
|
+
artifact_ns['foo:bar:jar'].should_not be_selected
|
201
|
+
artifact_ns['foo:baz:jar'].should_not be_selected
|
202
|
+
artifact_ns[:bar, :baz].should == [nil, nil]
|
203
|
+
artifact_ns[:things].map(&:unversioned_spec).should include('foo:bar:jar', 'foo:baz:jar')
|
204
|
+
artifact_ns.alias :baz, 'foo:baz:jar'
|
205
|
+
artifact_ns[:baz].should == artifact_ns['foo:baz:jar']
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
it 'should select best matching version if defined' do
|
210
|
+
define 'one' do
|
211
|
+
artifact_ns.use :a => 'foo:bar:jar:1.5'
|
212
|
+
artifact_ns.use :b => 'foo:baz:jar:2.0'
|
213
|
+
define 'two' do
|
214
|
+
artifact_ns[:a].requirement.should be_nil
|
215
|
+
artifact_ns[:a].should be_selected
|
216
|
+
|
217
|
+
artifact_ns.need :c => 'foo:bat:jar:3.0'
|
218
|
+
artifact_ns['foo:bat:jar'].should_not be_selected
|
219
|
+
artifact_ns[:c].should_not be_selected
|
220
|
+
|
221
|
+
artifact_ns.need :one => 'foo:bar:jar:>=1.0'
|
222
|
+
artifact_ns[:one].version.should == '1.5'
|
223
|
+
artifact_ns[:one].should be_selected
|
224
|
+
artifact_ns[:a].requirement.should be_nil
|
225
|
+
|
226
|
+
artifact_ns.need :two => 'foo:baz:jar:>2'
|
227
|
+
artifact_ns[:two].version.should be_nil
|
228
|
+
artifact_ns[:two].should_not be_selected
|
229
|
+
artifact_ns[:b].requirement.should be_nil
|
230
|
+
end
|
231
|
+
end
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
describe '#use' do
|
236
|
+
it 'should register the artifact on namespace' do
|
237
|
+
define 'one' do
|
238
|
+
artifact_ns.use :thing => 'a:b:c:1'
|
239
|
+
artifact_ns[:thing].requirement.should be_nil
|
240
|
+
artifact_ns[:thing].version.should == '1'
|
241
|
+
artifact_ns[:thing].id.should == 'b'
|
242
|
+
define 'one' do
|
243
|
+
artifact_ns.use :thing => 'a:d:c:2'
|
244
|
+
artifact_ns[:thing].requirement.should be_nil
|
245
|
+
artifact_ns[:thing].version.should == '2'
|
246
|
+
artifact_ns[:thing].id.should == 'd'
|
247
|
+
|
248
|
+
artifact_ns.use :copied => artifact_ns.parent[:thing]
|
249
|
+
artifact_ns[:copied].should_not == artifact_ns.parent[:thing]
|
250
|
+
artifact_ns[:copied].requirement.should be_nil
|
251
|
+
artifact_ns[:copied].version.should == '1'
|
252
|
+
artifact_ns[:copied].id.should == 'b'
|
253
|
+
|
254
|
+
artifact_ns.use :aliased => :copied
|
255
|
+
artifact_ns[:aliased].should == artifact_ns[:copied]
|
256
|
+
|
257
|
+
lambda { artifact_ns.use :invalid => :unknown }.should raise_error(NameError, /undefined/i)
|
258
|
+
end
|
259
|
+
artifact_ns[:copied].should be_nil
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
263
|
+
it 'should register two artifacts with different version on namespace' do
|
264
|
+
define 'one' do
|
265
|
+
artifact_ns.use :foo => 'a:b:c:1'
|
266
|
+
artifact_ns.use :bar => 'a:b:c:2'
|
267
|
+
artifact_ns[:foo].version.should == '1'
|
268
|
+
artifact_ns[:bar].version.should == '2'
|
269
|
+
# unversioned references the last version set.
|
270
|
+
artifact_ns['a:b:c'].version.should == '2'
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
it 'should complain if namespace requirement is not satisfied' do
|
275
|
+
define 'one' do
|
276
|
+
artifact_ns.need :bar => 'foo:bar:baz:~>1.5'
|
277
|
+
lambda { artifact_ns.use :bar => '1.4' }.should raise_error(Exception, /unsatisfied/i)
|
278
|
+
end
|
279
|
+
end
|
280
|
+
|
281
|
+
it 'should be able to register a group' do
|
282
|
+
specs = ['its:me:here:1', 'its:you:there:2']
|
283
|
+
artifact_ns.use :them => specs
|
284
|
+
artifact_ns[:them].map(&:to_spec).should == specs
|
285
|
+
artifact_ns['its:me:here'].should_not be_nil
|
286
|
+
artifact_ns[:you].should be_nil
|
287
|
+
end
|
288
|
+
|
289
|
+
it 'should be able to assign sub namespaces' do
|
290
|
+
artifact_ns(:foo).bar = "foo:bar:baz:0"
|
291
|
+
artifact_ns(:moo).foo = artifact_ns(:foo)
|
292
|
+
artifact_ns(:moo).foo.should == artifact_ns(:foo)
|
293
|
+
artifact_ns(:moo).foo_bar.should == artifact_ns(:foo).bar
|
294
|
+
end
|
295
|
+
|
296
|
+
it 'should handle symbols with dashes and periods' do
|
297
|
+
[:'a-b', :'a.b'].each do |symbol|
|
298
|
+
artifact_ns.use symbol => 'a:b:c:1'
|
299
|
+
artifact_ns[symbol].version.should == '1'
|
300
|
+
artifact_ns[symbol].id.should == 'b'
|
301
|
+
end
|
302
|
+
end
|
303
|
+
|
304
|
+
it 'should handle version string' do
|
305
|
+
foo = artifact_ns do |ns|
|
306
|
+
ns.bar = 'a:b:c:1'
|
307
|
+
end
|
308
|
+
foo.use :bar => '2.0'
|
309
|
+
foo.bar.version.should == '2.0'
|
310
|
+
end
|
311
|
+
end
|
312
|
+
|
313
|
+
describe '#values' do
|
314
|
+
it 'returns the artifacts defined on namespace' do
|
315
|
+
define 'foo' do
|
316
|
+
artifact_ns.use 'foo:one:baz:1.0'
|
317
|
+
define 'bar' do
|
318
|
+
artifact_ns.use 'foo:two:baz:1.0'
|
319
|
+
|
320
|
+
specs = artifact_ns.values.map(&:to_spec)
|
321
|
+
specs.should include('foo:two:baz:1.0')
|
322
|
+
specs.should_not include('foo:one:baz:1.0')
|
323
|
+
|
324
|
+
specs = artifact_ns.values(true).map(&:to_spec)
|
325
|
+
specs.should include('foo:two:baz:1.0', 'foo:one:baz:1.0')
|
326
|
+
end
|
327
|
+
end
|
328
|
+
end
|
329
|
+
end
|
330
|
+
|
331
|
+
describe '#values_at' do
|
332
|
+
it 'returns the named artifacts' do
|
333
|
+
define 'foo' do
|
334
|
+
artifact_ns.use 'foo:one:baz:1.0'
|
335
|
+
define 'bar' do
|
336
|
+
artifact_ns.use :foo_baz => 'foo:two:baz:1.0'
|
337
|
+
|
338
|
+
specs = artifact_ns.values_at('one').map(&:to_spec)
|
339
|
+
specs.should include('foo:one:baz:1.0')
|
340
|
+
specs.should_not include('foo:two:baz:1.0')
|
341
|
+
|
342
|
+
specs = artifact_ns.values_at('foo_baz').map(&:to_spec)
|
343
|
+
specs.should include('foo:two:baz:1.0')
|
344
|
+
specs.should_not include('foo:one:baz:1.0')
|
345
|
+
end
|
346
|
+
end
|
347
|
+
end
|
348
|
+
|
349
|
+
it 'returns first artifacts by their unversioned spec' do
|
350
|
+
define 'foo' do
|
351
|
+
artifact_ns.use 'foo:one:baz:2.0'
|
352
|
+
define 'bar' do
|
353
|
+
artifact_ns.use :older => 'foo:one:baz:1.0'
|
354
|
+
|
355
|
+
specs = artifact_ns.values_at('foo:one:baz').map(&:to_spec)
|
356
|
+
specs.should include('foo:one:baz:1.0')
|
357
|
+
specs.should_not include('foo:one:baz:2.0')
|
358
|
+
end
|
359
|
+
specs = artifact_ns.values_at('foo:one:baz').map(&:to_spec)
|
360
|
+
specs.should include('foo:one:baz:2.0')
|
361
|
+
specs.should_not include('foo:one:baz:1.0')
|
362
|
+
end
|
363
|
+
end
|
364
|
+
|
365
|
+
it 'return first artifact satisfying a dependency' do
|
366
|
+
define 'foo' do
|
367
|
+
artifact_ns.use 'foo:one:baz:2.0'
|
368
|
+
define 'bar' do
|
369
|
+
artifact_ns.use :older => 'foo:one:baz:1.0'
|
370
|
+
|
371
|
+
specs = artifact_ns.values_at('foo:one:baz:>1.0').map(&:to_spec)
|
372
|
+
specs.should include('foo:one:baz:2.0')
|
373
|
+
specs.should_not include('foo:one:baz:1.0')
|
374
|
+
end
|
375
|
+
end
|
376
|
+
end
|
377
|
+
end
|
378
|
+
|
379
|
+
describe '#artifacts' do
|
380
|
+
it 'returns artifacts in namespace' do
|
381
|
+
define 'one' do
|
382
|
+
artifact_ns[:foo] = 'group:foo:jar:1'
|
383
|
+
artifact_ns[:bar] = 'group:bar:jar:1'
|
384
|
+
artifact_ns.artifacts.map{|a| a.to_spec}.should include('group:foo:jar:1', 'group:bar:jar:1')
|
385
|
+
end
|
386
|
+
end
|
387
|
+
end
|
388
|
+
|
389
|
+
describe '#keys' do
|
390
|
+
it 'returns names in namespace' do
|
391
|
+
define 'one' do
|
392
|
+
artifact_ns[:foo] = 'group:foo:jar:1'
|
393
|
+
artifact_ns[:bar] = 'group:bar:jar:1'
|
394
|
+
artifact_ns.keys.should include('foo', 'bar')
|
395
|
+
end
|
396
|
+
end
|
397
|
+
end
|
398
|
+
|
399
|
+
describe '#delete' do
|
400
|
+
it 'deletes corresponding artifact requirement' do
|
401
|
+
define 'one' do
|
402
|
+
artifact_ns[:foo] = 'group:foo:jar:1'
|
403
|
+
artifact_ns[:bar] = 'group:bar:jar:1'
|
404
|
+
artifact_ns.delete :bar
|
405
|
+
artifact_ns.artifacts.map{|a| a.to_spec}.should include('group:foo:jar:1')
|
406
|
+
artifact_ns[:foo].to_spec.should eql('group:foo:jar:1')
|
407
|
+
end
|
408
|
+
end
|
409
|
+
end
|
410
|
+
|
411
|
+
describe '#clear' do
|
412
|
+
it 'clears all artifact requirements in namespace' do
|
413
|
+
define 'one' do
|
414
|
+
artifact_ns[:foo] = 'group:foo:jar:1'
|
415
|
+
artifact_ns[:bar] = 'group:bar:jar:1'
|
416
|
+
artifact_ns.clear
|
417
|
+
artifact_ns.artifacts.should be_empty
|
418
|
+
end
|
419
|
+
end
|
420
|
+
end
|
421
|
+
|
422
|
+
describe '#method_missing' do
|
423
|
+
it 'should use cool_aid! to create a requirement' do
|
424
|
+
define 'foo' do
|
425
|
+
artifact_ns.cool_aid!('cool:aid:jar:2').should be_kind_of(ArtifactNamespace::ArtifactRequirement)
|
426
|
+
artifact_ns[:cool_aid].version.should == '2'
|
427
|
+
artifact_ns[:cool_aid].should_not be_selected
|
428
|
+
define 'bar' do
|
429
|
+
artifact_ns.cool_aid! 'cool:aid:man:3', '>2'
|
430
|
+
artifact_ns[:cool_aid].version.should == '3'
|
431
|
+
artifact_ns[:cool_aid].requirement.should be_satisfied_by('2.5')
|
432
|
+
artifact_ns[:cool_aid].should_not be_selected
|
433
|
+
end
|
434
|
+
end
|
435
|
+
end
|
436
|
+
|
437
|
+
it 'should use cool_aid= as shorhand for [:cool_aid]=' do
|
438
|
+
artifact_ns.cool_aid = 'cool:aid:jar:1'
|
439
|
+
artifact_ns[:cool_aid].should be_selected
|
440
|
+
end
|
441
|
+
|
442
|
+
it 'should use cool_aid as shorthand for [:cool_aid]' do
|
443
|
+
artifact_ns.need :cool_aid => 'cool:aid:jar:1'
|
444
|
+
artifact_ns.cool_aid.should_not be_selected
|
445
|
+
end
|
446
|
+
|
447
|
+
it 'should use cool_aid? to test if artifact has been defined and selected' do
|
448
|
+
artifact_ns.need :cool_aid => 'cool:aid:jar:>1'
|
449
|
+
artifact_ns.should_not have_cool_aid
|
450
|
+
artifact_ns.should_not have_unknown
|
451
|
+
artifact_ns.cool_aid = '2'
|
452
|
+
artifact_ns.should have_cool_aid
|
453
|
+
end
|
454
|
+
end
|
455
|
+
|
456
|
+
describe '#ns' do
|
457
|
+
it 'should create a sub namespace' do
|
458
|
+
artifact_ns.ns :foo
|
459
|
+
artifact_ns[:foo].should be_kind_of(ArtifactNamespace)
|
460
|
+
artifact_ns(:foo).should_not === artifact_ns.foo
|
461
|
+
artifact_ns.foo.parent.should == artifact_ns
|
462
|
+
end
|
463
|
+
|
464
|
+
it 'should take any use arguments' do
|
465
|
+
artifact_ns.ns :foo, :bar => 'foo:bar:jar:0', :baz => 'foo:baz:jar:0'
|
466
|
+
artifact_ns.foo.bar.should be_selected
|
467
|
+
artifact_ns.foo[:baz].should be_selected
|
468
|
+
end
|
469
|
+
|
470
|
+
it 'should access sub artifacts using with foo_bar like syntax' do
|
471
|
+
artifact_ns.ns :foo, :bar => 'foo:bar:jar:0', :baz => 'foo:baz:jar:0'
|
472
|
+
artifact_ns[:foo_baz].should be_selected
|
473
|
+
artifact_ns.foo_bar.should be_selected
|
474
|
+
|
475
|
+
artifact_ns.foo.ns :bat, 'bat:man:jar:>1'
|
476
|
+
batman = artifact_ns.foo.bat.man
|
477
|
+
batman.should be_selected
|
478
|
+
artifact_ns[:foo_bat_man] = '3'
|
479
|
+
artifact_ns[:foo_bat_man].should == batman
|
480
|
+
artifact_ns[:foo_bat_man].version.should == '3'
|
481
|
+
end
|
482
|
+
|
483
|
+
it 'should include sub artifacts when calling #values' do
|
484
|
+
artifact_ns.ns :bat, 'bat:man:jar:>1'
|
485
|
+
artifact_ns.values.should_not be_empty
|
486
|
+
artifact_ns.values.first.unversioned_spec.should == 'bat:man:jar'
|
487
|
+
end
|
488
|
+
|
489
|
+
it 'should reopen a sub-namespace' do
|
490
|
+
artifact_ns.ns :bat, 'bat:man:jar:>1'
|
491
|
+
bat = artifact_ns[:bat]
|
492
|
+
bat.should == artifact_ns.ns(:bat)
|
493
|
+
end
|
494
|
+
|
495
|
+
it 'should fail reopening if not a sub-namespace' do
|
496
|
+
artifact_ns.foo = 'foo:bar:baz:0'
|
497
|
+
lambda { artifact_ns.ns(:foo) }.should raise_error(TypeError, /not a sub/i)
|
498
|
+
end
|
499
|
+
|
500
|
+
it 'should clone artifacts when assigned' do
|
501
|
+
artifact_ns(:foo).bar = "foo:bar:jar:0"
|
502
|
+
artifact_ns(:moo).ns :muu, :miu => artifact_ns(:foo).bar
|
503
|
+
artifact_ns(:moo).muu.miu.should_not == artifact_ns(:foo).bar
|
504
|
+
artifact_ns(:moo).muu.miu.to_spec.should == artifact_ns(:foo).bar.to_spec
|
505
|
+
end
|
506
|
+
|
507
|
+
it 'should clone parent artifacts by name' do
|
508
|
+
define 'foo' do
|
509
|
+
artifact_ns.bar = "foo:bar:jar:0"
|
510
|
+
define 'moo' do
|
511
|
+
artifact_ns.ns(:muu).use :bar
|
512
|
+
artifact_ns.muu_bar.should be_selected
|
513
|
+
artifact_ns.muu.bar.should_not == artifact_ns.bar
|
514
|
+
end
|
515
|
+
end
|
516
|
+
end
|
517
|
+
end
|
518
|
+
|
519
|
+
it 'should be an Enumerable' do
|
520
|
+
artifact_ns.should be_kind_of(Enumerable)
|
521
|
+
artifact_ns.use 'foo:bar:baz:1.0'
|
522
|
+
artifact_ns.map(&:artifact).should include(artifact('foo:bar:baz:1.0'))
|
523
|
+
end
|
524
|
+
|
525
|
+
end # ArtifactNamespace
|
526
|
+
|
527
|
+
describe Buildr::ArtifactNamespace::ArtifactRequirement do
|
528
|
+
before(:each) { Buildr::ArtifactNamespace.clear }
|
529
|
+
it 'should be created from artifact_ns' do
|
530
|
+
foo = artifact_ns do |ns|
|
531
|
+
ns.bar = 'a:b:c:1.0'
|
532
|
+
end
|
533
|
+
foo.bar.should be_kind_of(ArtifactNamespace::ArtifactRequirement)
|
534
|
+
end
|
535
|
+
|
536
|
+
it 'should handle version as string' do
|
537
|
+
foo = artifact_ns do |ns|
|
538
|
+
ns.bar = 'a:b:c:1.0'
|
539
|
+
end
|
540
|
+
foo.bar.version = '2.0'
|
541
|
+
foo.bar.version.should == '2.0'
|
542
|
+
end
|
543
|
+
|
544
|
+
it 'should handle version string directly' do
|
545
|
+
foo = artifact_ns do |ns|
|
546
|
+
ns.bar = 'a:b:c:1.0'
|
547
|
+
end
|
548
|
+
foo.bar = '2.0'
|
549
|
+
foo.bar.version.should == '2.0'
|
550
|
+
end
|
551
|
+
|
552
|
+
end # ArtifactRequirement
|
553
|
+
|
554
|
+
describe Buildr do
|
555
|
+
before(:each) { Buildr::ArtifactNamespace.clear }
|
556
|
+
|
557
|
+
describe '.artifacts' do
|
558
|
+
it 'should take ruby symbols and ask the current namespace for them' do
|
559
|
+
define 'foo' do
|
560
|
+
artifact_ns.cool = 'cool:aid:jar:1.0'
|
561
|
+
artifact_ns.use 'some:other:jar:1.0'
|
562
|
+
artifact_ns.use 'bat:man:jar:1.0'
|
563
|
+
compile.with :cool, :other, :'bat:man:jar'
|
564
|
+
compile.dependencies.map(&:to_spec).should include('cool:aid:jar:1.0', 'some:other:jar:1.0', 'bat:man:jar:1.0')
|
565
|
+
end
|
566
|
+
end
|
567
|
+
|
568
|
+
it 'should take a namespace' do
|
569
|
+
artifact_ns(:moo).muu = 'moo:muu:jar:1.0'
|
570
|
+
define 'foo' do
|
571
|
+
compile.with artifact_ns(:moo)
|
572
|
+
compile.dependencies.map(&:to_spec).should include('moo:muu:jar:1.0')
|
573
|
+
end
|
574
|
+
end
|
575
|
+
end
|
576
|
+
|
577
|
+
describe '.artifact' do
|
578
|
+
it 'should search current namespace if given a symbol' do
|
579
|
+
define 'foo' do
|
580
|
+
artifact_ns.use :cool => 'cool:aid:jar:1.0'
|
581
|
+
define 'bar' do
|
582
|
+
artifact(:cool).should == artifact_ns[:cool].artifact
|
583
|
+
end
|
584
|
+
end
|
585
|
+
end
|
586
|
+
|
587
|
+
it 'should search current namespace if given a symbol spec' do
|
588
|
+
define 'foo' do
|
589
|
+
artifact_ns.use 'cool:aid:jar:1.0'
|
590
|
+
define 'bar' do
|
591
|
+
artifact(:'cool:aid:jar').should == artifact_ns[:aid].artifact
|
592
|
+
end
|
593
|
+
end
|
594
|
+
end
|
595
|
+
|
596
|
+
it 'should fail when no artifact by that name is found' do
|
597
|
+
define 'foo' do
|
598
|
+
artifact_ns.use 'cool:aid:jar:1.0'
|
599
|
+
define 'bar' do
|
600
|
+
lambda { artifact(:cool) }.should raise_error(IndexError, /artifact/)
|
601
|
+
end
|
602
|
+
end
|
603
|
+
end
|
604
|
+
end
|
605
|
+
end
|
606
|
+
|
607
|
+
describe "Extension using ArtifactNamespace" do
|
608
|
+
before(:each) { Buildr::ArtifactNamespace.clear }
|
609
|
+
|
610
|
+
def abc_module
|
611
|
+
Object.module_eval 'module A; module B; module C; end; end; end'
|
612
|
+
yield
|
613
|
+
ensure
|
614
|
+
Object.send :remove_const, :A
|
615
|
+
end
|
616
|
+
|
617
|
+
it 'can register namespace listeners' do
|
618
|
+
abc_module do
|
619
|
+
# An example extension to illustrate namespace listeners and method forwarding
|
620
|
+
class A::Example
|
621
|
+
|
622
|
+
module Ext
|
623
|
+
include Buildr::Extension
|
624
|
+
def example; @example ||= A::Example.new; end
|
625
|
+
before_define do |p|
|
626
|
+
Rake::Task.define_task('example') { p.example.doit }
|
627
|
+
end
|
628
|
+
end
|
629
|
+
|
630
|
+
REQUIRES = ArtifactNamespace.for(self) do |ns|
|
631
|
+
ns.xmlbeans! 'org.apache.xmlbeans:xmlbeans:jar:2.3.0', '>2'
|
632
|
+
ns.stax_api! 'stax:stax-api:jar:>=1.0.1'
|
633
|
+
end
|
634
|
+
|
635
|
+
attr_reader :options, :requires
|
636
|
+
|
637
|
+
def initialize
|
638
|
+
# We could actually use the REQUIRES namespace, but to make things
|
639
|
+
# a bit more interesting, suppose each Example instance can have its
|
640
|
+
# own artifact requirements in adition to those specified on REQUIRES.
|
641
|
+
# To achieve this we create an anonymous namespace.
|
642
|
+
@requires = ArtifactNamespace.new # a namespace per instance
|
643
|
+
REQUIRES.each { |requirement| @requires.need requirement }
|
644
|
+
|
645
|
+
# For user convenience, we make the options object respond to
|
646
|
+
# :xmlbeans, :xmlbeans=, :xmlbeans?
|
647
|
+
# forwarding them to the namespace.
|
648
|
+
@options = OpenObject.new.extend(@requires.accessor(:xmlbeans, :stax_api))
|
649
|
+
# Register callbacks so we can perform some logic when an artifact
|
650
|
+
# is selected by the user.
|
651
|
+
options.xmlbeans.add_listener &method(:selected_xmlbeans)
|
652
|
+
options.stax_api.add_listener do |stax|
|
653
|
+
# Now using a proc
|
654
|
+
stax.should be_selected
|
655
|
+
stax.version.should == '1.6180'
|
656
|
+
options[:math] = :golden # customize our options for this version
|
657
|
+
# In this example we set the stax version when running outside
|
658
|
+
# a project definition. This means we have no access to the project
|
659
|
+
# namespace unless we had a reference to the project or knew it's name
|
660
|
+
Buildr.artifact_ns(:current).name.should == 'root'
|
661
|
+
end
|
662
|
+
end
|
663
|
+
|
664
|
+
include RSpec::Matchers # for assertions
|
665
|
+
|
666
|
+
# Called with the ArtifactRequirement that has just been selected
|
667
|
+
# by a user. This allows extension author to selectively perform
|
668
|
+
# some action by inspecting the requirement state.
|
669
|
+
def selected_xmlbeans(xmlbeans)
|
670
|
+
xmlbeans.should be_selected
|
671
|
+
xmlbeans.version.should == '3.1415'
|
672
|
+
options[:math] = :pi
|
673
|
+
# This example just sets xmlbeans for foo:bar project
|
674
|
+
# So the currently running namespace should have the foo:bar name
|
675
|
+
Buildr.artifact_ns(:current).name.should == 'foo:bar'
|
676
|
+
end
|
677
|
+
|
678
|
+
# Suppose we invoke an ant task here or something else.
|
679
|
+
def doit
|
680
|
+
# Now call ant task with our selected artifact and options
|
681
|
+
classpath = requires.map(&:artifact).map(&:to_s).join(File::PATH_SEPARATOR)
|
682
|
+
lambda { ant('thing') { |ant| ant.classpath classpath, :math => options[:math] } }
|
683
|
+
|
684
|
+
# We are not a Project instance, hence we have no artifact_ns
|
685
|
+
lambda { artifact_ns }.should raise_error(NameError)
|
686
|
+
|
687
|
+
# Extension authors may NOT rely project's namespaces.
|
688
|
+
# However the ruby-way gives you power and at the same time
|
689
|
+
# makes you dangerous, (think open-modules, monkey-patching)
|
690
|
+
# Given that buildr is pure ruby, consider it a sharp-edged sword.
|
691
|
+
# Having said that, you may actually inspect a project's
|
692
|
+
# namespace, but don't write on it without letting your users
|
693
|
+
# know you will.
|
694
|
+
# This example obtains the current project namespace to make
|
695
|
+
# some assertions.
|
696
|
+
|
697
|
+
# To obtain a project's namespace we need either
|
698
|
+
# 1) a reference to the project, and call artifact_ns on it
|
699
|
+
# project.artifact_ns # the namespace for project
|
700
|
+
# 2) know the project name
|
701
|
+
# Buildr.artifact_ns('the:project')
|
702
|
+
# 3) Use :current to reference the currently running project
|
703
|
+
# Buildr.artifact_ns(:current)
|
704
|
+
name = Buildr.artifact_ns(:current).name
|
705
|
+
case name
|
706
|
+
when 'foo:bar'
|
707
|
+
options[:math].should == :pi
|
708
|
+
requires.xmlbeans.version.should == '3.1415'
|
709
|
+
requires.stax_api.version.should == '1.0.1'
|
710
|
+
when 'foo:baz'
|
711
|
+
options[:math].should == :golden
|
712
|
+
requires.xmlbeans.version.should == '2.3.0'
|
713
|
+
requires.stax_api.version.should == '1.6180'
|
714
|
+
else
|
715
|
+
fail "This example expects foo:bar or foo:baz projects not #{name.inspect}"
|
716
|
+
end
|
717
|
+
end
|
718
|
+
end
|
719
|
+
|
720
|
+
define 'foo' do
|
721
|
+
define 'bar' do
|
722
|
+
extend A::Example::Ext
|
723
|
+
task('setup') do
|
724
|
+
example.options.xmlbeans = '3.1415'
|
725
|
+
end
|
726
|
+
task('run' => [:setup, :example])
|
727
|
+
end
|
728
|
+
define 'baz' do
|
729
|
+
extend A::Example::Ext
|
730
|
+
end
|
731
|
+
end
|
732
|
+
|
733
|
+
project('foo:bar').example.requires.should_not == project('foo:baz').example.requires
|
734
|
+
project('foo:bar').example.requires.xmlbeans.should_not == project('foo:baz').example.requires.xmlbeans
|
735
|
+
|
736
|
+
# current namespace outside a project is :root, see the stax callback
|
737
|
+
project('foo:baz').example.options.stax_api = '1.6180'
|
738
|
+
# we call the task outside the project, see #doit
|
739
|
+
lambda { task('foo:bar:run').invoke }.should run_task('foo:bar:example')
|
740
|
+
lambda { task('foo:baz:example').invoke }.should run_task('foo:baz:example')
|
741
|
+
end
|
742
|
+
end
|
743
|
+
end
|