buildr 1.3.5-x86-mswin32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +998 -0
- data/LICENSE +176 -0
- data/NOTICE +26 -0
- data/README.rdoc +134 -0
- data/Rakefile +45 -0
- data/_buildr +29 -0
- data/_jbuildr +29 -0
- data/addon/buildr/antlr.rb +65 -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 +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 +221 -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 +19 -0
- data/buildr.buildfile +58 -0
- data/buildr.gemspec +65 -0
- data/doc/_config.yml +1 -0
- data/doc/_layouts/default.html +88 -0
- data/doc/_layouts/preface.html +22 -0
- data/doc/artifacts.textile +211 -0
- data/doc/building.textile +244 -0
- data/doc/contributing.textile +252 -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 +79 -0
- data/doc/extending.textile +186 -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 +69 -0
- data/doc/installing.textile +266 -0
- data/doc/languages.textile +459 -0
- data/doc/mailing_lists.textile +25 -0
- data/doc/more_stuff.textile +457 -0
- data/doc/packaging.textile +430 -0
- data/doc/preface.textile +54 -0
- data/doc/projects.textile +271 -0
- data/doc/quick_start.textile +210 -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 +72 -0
- data/doc/scripts/install-osx.sh +52 -0
- data/doc/settings_profiles.textile +280 -0
- data/doc/testing.textile +222 -0
- data/etc/KEYS +151 -0
- data/lib/buildr.rb +36 -0
- data/lib/buildr/core.rb +35 -0
- data/lib/buildr/core/application.rb +656 -0
- data/lib/buildr/core/build.rb +452 -0
- data/lib/buildr/core/checks.rb +254 -0
- data/lib/buildr/core/common.rb +150 -0
- data/lib/buildr/core/compile.rb +608 -0
- data/lib/buildr/core/environment.rb +129 -0
- data/lib/buildr/core/filter.rb +362 -0
- data/lib/buildr/core/generate.rb +195 -0
- data/lib/buildr/core/help.rb +119 -0
- data/lib/buildr/core/osx.rb +46 -0
- data/lib/buildr/core/progressbar.rb +156 -0
- data/lib/buildr/core/project.rb +866 -0
- data/lib/buildr/core/shell.rb +198 -0
- data/lib/buildr/core/test.rb +723 -0
- data/lib/buildr/core/transports.rb +559 -0
- data/lib/buildr/core/util.rb +449 -0
- data/lib/buildr/groovy.rb +19 -0
- data/lib/buildr/groovy/bdd.rb +106 -0
- data/lib/buildr/groovy/compiler.rb +138 -0
- data/lib/buildr/groovy/shell.rb +48 -0
- data/lib/buildr/ide.rb +19 -0
- data/lib/buildr/ide/eclipse.rb +334 -0
- data/lib/buildr/ide/eclipse/java.rb +53 -0
- data/lib/buildr/ide/eclipse/plugin.rb +68 -0
- data/lib/buildr/ide/eclipse/scala.rb +66 -0
- data/lib/buildr/ide/idea.ipr.template +300 -0
- data/lib/buildr/ide/idea.rb +190 -0
- data/lib/buildr/ide/idea7x.ipr.template +290 -0
- data/lib/buildr/ide/idea7x.rb +212 -0
- data/lib/buildr/java.rb +23 -0
- data/lib/buildr/java/ant.rb +94 -0
- data/lib/buildr/java/bdd.rb +459 -0
- data/lib/buildr/java/cobertura.rb +274 -0
- data/lib/buildr/java/commands.rb +213 -0
- data/lib/buildr/java/compiler.rb +349 -0
- data/lib/buildr/java/deprecated.rb +141 -0
- data/lib/buildr/java/emma.rb +244 -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 +137 -0
- data/lib/buildr/java/packaging.rb +716 -0
- data/lib/buildr/java/pom.rb +174 -0
- data/lib/buildr/java/rjb.rb +155 -0
- data/lib/buildr/java/test_result.rb +353 -0
- data/lib/buildr/java/tests.rb +333 -0
- data/lib/buildr/java/version_requirement.rb +172 -0
- data/lib/buildr/packaging.rb +24 -0
- data/lib/buildr/packaging/archive.rb +488 -0
- data/lib/buildr/packaging/artifact.rb +749 -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 +238 -0
- data/lib/buildr/packaging/tar.rb +186 -0
- data/lib/buildr/packaging/version_requirement.rb +172 -0
- data/lib/buildr/packaging/zip.rb +73 -0
- data/lib/buildr/packaging/ziptask.rb +316 -0
- data/lib/buildr/resources/buildr.icns +0 -0
- data/lib/buildr/scala.rb +25 -0
- data/lib/buildr/scala/bdd.rb +109 -0
- data/lib/buildr/scala/compiler.rb +195 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner$.class +0 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.scala +35 -0
- data/lib/buildr/scala/shell.rb +55 -0
- data/lib/buildr/scala/tests.rb +157 -0
- data/lib/buildr/shell.rb +180 -0
- data/rakelib/checks.rake +57 -0
- data/rakelib/doc.rake +92 -0
- data/rakelib/jekylltask.rb +120 -0
- data/rakelib/package.rake +73 -0
- data/rakelib/release.rake +149 -0
- data/rakelib/rspec.rake +73 -0
- data/rakelib/setup.rake +54 -0
- data/rakelib/stage.rake +213 -0
- data/rakelib/stage.rake~ +213 -0
- data/spec/addon/drb_spec.rb +328 -0
- data/spec/core/application_spec.rb +502 -0
- data/spec/core/build_spec.rb +677 -0
- data/spec/core/checks_spec.rb +519 -0
- data/spec/core/common_spec.rb +670 -0
- data/spec/core/compile_spec.rb +583 -0
- data/spec/core/extension_spec.rb +93 -0
- data/spec/core/generate_spec.rb +33 -0
- data/spec/core/project_spec.rb +762 -0
- data/spec/core/test_spec.rb +1098 -0
- data/spec/core/transport_spec.rb +537 -0
- data/spec/core/util_spec.rb +67 -0
- data/spec/groovy/bdd_spec.rb +80 -0
- data/spec/groovy/compiler_spec.rb +240 -0
- data/spec/ide/eclipse_spec.rb +501 -0
- data/spec/ide/idea7x_spec.rb +84 -0
- data/spec/java/ant_spec.rb +33 -0
- data/spec/java/bdd_spec.rb +382 -0
- data/spec/java/cobertura_spec.rb +85 -0
- data/spec/java/compiler_spec.rb +446 -0
- data/spec/java/emma_spec.rb +119 -0
- data/spec/java/java_spec.rb +124 -0
- data/spec/java/packaging_spec.rb +1134 -0
- data/spec/java/test_coverage_helper.rb +257 -0
- data/spec/java/tests_spec.rb +493 -0
- data/spec/packaging/archive_spec.rb +527 -0
- data/spec/packaging/artifact_namespace_spec.rb +654 -0
- data/spec/packaging/artifact_spec.rb +795 -0
- data/spec/packaging/packaging_helper.rb +63 -0
- data/spec/packaging/packaging_spec.rb +684 -0
- data/spec/sandbox.rb +142 -0
- data/spec/scala/bdd_spec.rb +119 -0
- data/spec/scala/compiler_spec.rb +284 -0
- data/spec/scala/scala.rb +38 -0
- data/spec/scala/tests_spec.rb +261 -0
- data/spec/spec_helpers.rb +340 -0
- data/spec/version_requirement_spec.rb +129 -0
- metadata +383 -0
@@ -0,0 +1,63 @@
|
|
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
|
+
shared_examples_for 'packaging' do
|
18
|
+
it 'should create artifact of proper type' do
|
19
|
+
packaging = @packaging
|
20
|
+
package_type = @package_type || @packaging
|
21
|
+
define 'foo', :version=>'1.0' do
|
22
|
+
package(packaging).type.should eql(package_type) rescue exit!
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should create file with proper extension' do
|
27
|
+
packaging = @packaging
|
28
|
+
package_type = @package_type || @packaging
|
29
|
+
define 'foo', :version=>'1.0' do
|
30
|
+
package(packaging).to_s.should match(/.#{package_type}$/)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should always return same task for the same package' do
|
35
|
+
packaging = @packaging
|
36
|
+
define 'foo', :version=>'1.0' do
|
37
|
+
package(packaging)
|
38
|
+
package(packaging, :id=>'other')
|
39
|
+
end
|
40
|
+
project('foo').packages.uniq.size.should eql(2)
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'should complain if option not known' do
|
44
|
+
packaging = @packaging
|
45
|
+
define 'foo', :version=>'1.0' do
|
46
|
+
lambda { package(packaging, :unknown_option=>true) }.should raise_error(ArgumentError, /no such option/)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'should respond to with() and return self' do
|
51
|
+
packaging = @packaging
|
52
|
+
define 'foo', :version=>'1.0' do
|
53
|
+
package(packaging).with({}).should be(package(packaging))
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'should respond to with() and complain if unknown option' do
|
58
|
+
packaging = @packaging
|
59
|
+
define 'foo', :version=>'1.0' do
|
60
|
+
lambda { package(packaging).with(:unknown_option=>true) }.should raise_error(ArgumentError, /does not support the option/)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,684 @@
|
|
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
|
+
require File.join(File.dirname(__FILE__), 'packaging_helper')
|
19
|
+
|
20
|
+
|
21
|
+
describe Project, '#group' do
|
22
|
+
it 'should default to project name' do
|
23
|
+
desc 'My Project'
|
24
|
+
define('foo').group.should eql('foo')
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'should be settable' do
|
28
|
+
define('foo', :group=>'bar').group.should eql('bar')
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should inherit from parent project' do
|
32
|
+
define('foo', :group=>'groupie') { define 'bar' }
|
33
|
+
project('foo:bar').group.should eql('groupie')
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
describe Project, '#version' do
|
39
|
+
it 'should default to nil' do
|
40
|
+
define('foo').version.should be_nil
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'should be settable' do
|
44
|
+
define('foo', :version=>'2.1').version.should eql('2.1')
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'should inherit from parent project' do
|
48
|
+
define('foo', :version=>'2.1') { define 'bar' }
|
49
|
+
project('foo:bar').version.should eql('2.1')
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
describe Project, '#id' do
|
56
|
+
it 'should be same as project name' do
|
57
|
+
define('foo').id.should eql('foo')
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'should replace colons with dashes' do
|
61
|
+
define('foo', :version=>'2.1') { define 'bar' }
|
62
|
+
project('foo:bar').id.should eql('foo-bar')
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'should not be settable' do
|
66
|
+
lambda { define 'foo', :id=>'bar' }.should raise_error(NoMethodError)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
|
71
|
+
describe Project, '#package' do
|
72
|
+
it 'should default to id from project' do
|
73
|
+
define('foo', :version=>'1.0') do
|
74
|
+
package(:jar).id.should eql('foo')
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'should default to composed id for nested projects' do
|
79
|
+
define('foo', :version=>'1.0') do
|
80
|
+
define 'bar' do
|
81
|
+
package(:jar).id.should eql('foo-bar')
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'should take id from option if specified' do
|
87
|
+
define 'foo', :version=>'1.0' do
|
88
|
+
package(:jar, :id=>'bar').id.should eql('bar')
|
89
|
+
define 'bar' do
|
90
|
+
package(:jar, :id=>'baz').id.should eql('baz')
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'should default to group from project' do
|
96
|
+
define 'foo', :version=>'1.0' do
|
97
|
+
package(:jar).group.should eql('foo')
|
98
|
+
define 'bar' do
|
99
|
+
package(:jar).group.should eql('foo')
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'should take group from option if specified' do
|
105
|
+
define 'foo', :version=>'1.0' do
|
106
|
+
package(:jar, :group=>'foos').group.should eql('foos')
|
107
|
+
define 'bar' do
|
108
|
+
package(:jar, :group=>'bars').group.should eql('bars')
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'should default to version from project' do
|
114
|
+
define 'foo', :version=>'1.0' do
|
115
|
+
package(:jar).version.should eql('1.0')
|
116
|
+
define 'bar' do
|
117
|
+
package(:jar).version.should eql('1.0')
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
it 'should take version from option if specified' do
|
123
|
+
define 'foo', :version=>'1.0' do
|
124
|
+
package(:jar, :version=>'1.1').version.should eql('1.1')
|
125
|
+
define 'bar' do
|
126
|
+
package(:jar, :version=>'1.2').version.should eql('1.2')
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
it 'should accept package type as first argument' do
|
132
|
+
define 'foo', :version=>'1.0' do
|
133
|
+
package(:war).type.should eql(:war)
|
134
|
+
define 'bar' do
|
135
|
+
package(:jar).type.should eql(:jar)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
it 'should support optional type' do
|
141
|
+
define 'foo', :version=>'1.0' do
|
142
|
+
package.type.should eql(:zip)
|
143
|
+
package(:classifier=>'srcs').type.should eql(:zip)
|
144
|
+
end
|
145
|
+
define 'bar', :version=>'1.0' do
|
146
|
+
compile.using :javac
|
147
|
+
package(:classifier=>'srcs').type.should eql(:jar)
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
it 'should assume :zip package type unless specified' do
|
152
|
+
define 'foo', :version=>'1.0' do
|
153
|
+
package.type.should eql(:zip)
|
154
|
+
define 'bar' do
|
155
|
+
package.type.should eql(:zip)
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
it 'should infer packaging type from compiler' do
|
161
|
+
define 'foo', :version=>'1.0' do
|
162
|
+
compile.using :javac
|
163
|
+
package.type.should eql(:jar)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
it 'should fail if packaging not supported' do
|
168
|
+
lambda { define('foo') { package(:weirdo) } }.should raise_error(RuntimeError, /Don't know how to create a package/)
|
169
|
+
end
|
170
|
+
|
171
|
+
it 'should call package_as_foo when using package(:foo)' do
|
172
|
+
class Buildr::Project
|
173
|
+
def package_as_foo(file_name)
|
174
|
+
file(file_name) do |t|
|
175
|
+
mkdir_p File.dirname(t.to_s)
|
176
|
+
File.open(t.to_s, 'w') {|f| f.write('foo') }
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
define('foo', :version => '1.0') do |project|
|
181
|
+
package(:foo).invoke
|
182
|
+
package(:foo).should exist
|
183
|
+
package(:foo).should contain('foo')
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
it 'should allow to respec package(:sources) using package_as_sources_spec()' do
|
188
|
+
class Buildr::Project
|
189
|
+
def package_as_sources_spec(spec)
|
190
|
+
spec.merge({ :type=>:jar, :classifier=>'sources' })
|
191
|
+
end
|
192
|
+
end
|
193
|
+
define('foo', :version => '1.0') do
|
194
|
+
package(:sources).type.should eql(:jar)
|
195
|
+
package(:sources).classifier.should eql('sources')
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
it 'should produce different packages for different specs' do
|
200
|
+
class Buildr::Project
|
201
|
+
def package_as_foo(file_name)
|
202
|
+
file(file_name)
|
203
|
+
end
|
204
|
+
|
205
|
+
def package_as_foo_spec(spec)
|
206
|
+
spec.merge(:type => :zip)
|
207
|
+
end
|
208
|
+
|
209
|
+
def package_as_bar(file_name)
|
210
|
+
file(file_name)
|
211
|
+
end
|
212
|
+
|
213
|
+
def package_as_bar_spec(spec)
|
214
|
+
spec.merge(:type => :zip, :classifier => "foobar")
|
215
|
+
end
|
216
|
+
|
217
|
+
end
|
218
|
+
define('foo', :version => '1.0') do
|
219
|
+
package(:foo).type.should eql(:zip)
|
220
|
+
package(:foo).classifier.should be_nil
|
221
|
+
package(:bar).type.should eql(:zip)
|
222
|
+
package(:bar).classifier.should eql('foobar')
|
223
|
+
package(:foo).equal?(package(:bar)).should be_false
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
it 'should default to no classifier' do
|
228
|
+
define 'foo', :version=>'1.0' do
|
229
|
+
package.classifier.should be_nil
|
230
|
+
define 'bar' do
|
231
|
+
package.classifier.should be_nil
|
232
|
+
end
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
it 'should accept classifier from option' do
|
237
|
+
define 'foo', :version=>'1.0' do
|
238
|
+
package(:classifier=>'srcs').classifier.should eql('srcs')
|
239
|
+
define 'bar' do
|
240
|
+
package(:classifier=>'docs').classifier.should eql('docs')
|
241
|
+
end
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
it 'should return a file task' do
|
246
|
+
define('foo', :version=>'1.0') { package(:jar) }
|
247
|
+
project('foo').package(:jar).should be_kind_of(Rake::FileTask)
|
248
|
+
end
|
249
|
+
|
250
|
+
it 'should return a task that acts as artifact' do
|
251
|
+
define('foo', :version=>'1.0') { package(:jar) }
|
252
|
+
project('foo').package(:jar).should respond_to(:to_spec)
|
253
|
+
project('foo').package(:jar).to_spec.should eql('foo:foo:jar:1.0')
|
254
|
+
end
|
255
|
+
|
256
|
+
it 'should create different tasks for each spec' do
|
257
|
+
define 'foo', :version=>'1.0' do
|
258
|
+
package(:jar)
|
259
|
+
package(:war)
|
260
|
+
package(:jar, :id=>'bar')
|
261
|
+
package(:jar, :classifier=>'srcs')
|
262
|
+
package(:jar, :classifier=>'doc')
|
263
|
+
end
|
264
|
+
project('foo').packages.uniq.size.should be(5)
|
265
|
+
end
|
266
|
+
|
267
|
+
it 'should create different tasks for package with classifier' do
|
268
|
+
define 'foo', :version=>'1.0' do
|
269
|
+
package(:jar)
|
270
|
+
package(:jar, :classifier=>'foo')
|
271
|
+
end
|
272
|
+
project('foo').packages.uniq.size.should be(2)
|
273
|
+
end
|
274
|
+
|
275
|
+
it 'should not create multiple packages for the same spec' do
|
276
|
+
define 'foo', :version=>'1.0' do
|
277
|
+
package(:war)
|
278
|
+
package(:war)
|
279
|
+
package(:jar, :id=>'bar')
|
280
|
+
package(:jar, :id=>'bar')
|
281
|
+
package(:jar, :id=>'baz')
|
282
|
+
end
|
283
|
+
project('foo').packages.uniq.size.should be(3)
|
284
|
+
end
|
285
|
+
|
286
|
+
it 'should return the same task for subsequent calls' do
|
287
|
+
define 'foo', :version=>'1.0' do
|
288
|
+
package.should eql(package)
|
289
|
+
package(:jar, :classifier=>'resources').should be(package(:jar, :classifier=>'resources'))
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
it 'should return a packaging task even if file already exists' do
|
294
|
+
write 'target/foo-1.0.zip', ''
|
295
|
+
define 'foo', :version=>'1.0' do
|
296
|
+
package.should be_kind_of(ZipTask)
|
297
|
+
end
|
298
|
+
end
|
299
|
+
|
300
|
+
it 'should register task as artifact' do
|
301
|
+
define 'foo', :version=>'1.0' do
|
302
|
+
package(:jar, :id=>'bar')
|
303
|
+
package(:war)
|
304
|
+
end
|
305
|
+
project('foo').packages.should eql(artifacts('foo:bar:jar:1.0', 'foo:foo:war:1.0'))
|
306
|
+
end
|
307
|
+
|
308
|
+
it 'should create in target path' do
|
309
|
+
define 'foo', :version=>'1.0' do
|
310
|
+
package(:war).should point_to_path('target/foo-1.0.war')
|
311
|
+
package(:jar, :id=>'bar').should point_to_path('target/bar-1.0.jar')
|
312
|
+
package(:zip, :classifier=>'srcs').should point_to_path('target/foo-1.0-srcs.zip')
|
313
|
+
end
|
314
|
+
end
|
315
|
+
|
316
|
+
it 'should create prerequisite for package task' do
|
317
|
+
define 'foo', :version=>'1.0' do
|
318
|
+
package(:war)
|
319
|
+
package(:jar, :id=>'bar')
|
320
|
+
package(:jar, :classifier=>'srcs')
|
321
|
+
end
|
322
|
+
project('foo').task('package').prerequisites.should include(*project('foo').packages)
|
323
|
+
end
|
324
|
+
|
325
|
+
it 'should create task requiring a build' do
|
326
|
+
define 'foo', :version=>'1.0' do
|
327
|
+
package(:war).prerequisites.should include(build)
|
328
|
+
package(:jar, :id=>'bar').prerequisites.should include(build)
|
329
|
+
package(:jar, :classifier=>'srcs').prerequisites.should include(build)
|
330
|
+
end
|
331
|
+
end
|
332
|
+
|
333
|
+
it 'should create a POM artifact in local repository' do
|
334
|
+
define 'foo', :version=>'1.0' do
|
335
|
+
package.pom.should be(artifact('foo:foo:pom:1.0'))
|
336
|
+
repositories.locate('foo:foo:pom:1.0').should eql(package.pom.to_s)
|
337
|
+
end
|
338
|
+
end
|
339
|
+
|
340
|
+
it 'should create POM artifact ignoring classifier' do
|
341
|
+
define 'foo', :version=>'1.0' do
|
342
|
+
package(:jar, :classifier=>'srcs').pom.should be(artifact('foo:foo:pom:1.0'))
|
343
|
+
end
|
344
|
+
end
|
345
|
+
|
346
|
+
it 'should create POM artifact that creates its own POM' do
|
347
|
+
define('foo', :group=>'bar', :version=>'1.0') { package(:jar, :classifier=>'srcs') }
|
348
|
+
pom = project('foo').packages.first.pom
|
349
|
+
pom.invoke
|
350
|
+
read(pom.to_s).should eql(<<-POM
|
351
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
352
|
+
<project>
|
353
|
+
<modelVersion>4.0.0</modelVersion>
|
354
|
+
<groupId>bar</groupId>
|
355
|
+
<artifactId>foo</artifactId>
|
356
|
+
<version>1.0</version>
|
357
|
+
</project>
|
358
|
+
POM
|
359
|
+
)
|
360
|
+
end
|
361
|
+
|
362
|
+
it 'should not require downloading artifact or POM' do
|
363
|
+
#task('artifacts').instance_eval { @actions.clear }
|
364
|
+
define('foo', :group=>'bar', :version=>'1.0') { package(:jar) }
|
365
|
+
lambda { task('artifacts').invoke }.should_not raise_error
|
366
|
+
end
|
367
|
+
|
368
|
+
describe "existing package access" do
|
369
|
+
it "should return the same instance for identical optionless invocations" do
|
370
|
+
define 'foo', :version => '1.0' do
|
371
|
+
package(:zip).should equal(package(:zip))
|
372
|
+
end
|
373
|
+
project('foo').packages.size.should == 1
|
374
|
+
end
|
375
|
+
|
376
|
+
it "should return the exactly matching package identical invocations with options" do
|
377
|
+
define 'foo', :version => '1.0' do
|
378
|
+
package(:zip, :id => 'src')
|
379
|
+
package(:zip, :id => 'bin')
|
380
|
+
end
|
381
|
+
project('foo').package(:zip, :id => 'src').should equal(project('foo').packages.first)
|
382
|
+
project('foo').package(:zip, :id => 'bin').should equal(project('foo').packages.last)
|
383
|
+
project('foo').packages.size.should == 2
|
384
|
+
end
|
385
|
+
|
386
|
+
it "should return the first of the same type for subsequent optionless invocations" do
|
387
|
+
define 'foo', :version => '1.0' do
|
388
|
+
package(:zip, :file => 'override.zip')
|
389
|
+
package(:jar, :file => 'another.jar')
|
390
|
+
end
|
391
|
+
project('foo').package(:zip).name.should == 'override.zip'
|
392
|
+
project('foo').package(:jar).name.should == 'another.jar'
|
393
|
+
project('foo').packages.size.should == 2
|
394
|
+
end
|
395
|
+
end
|
396
|
+
|
397
|
+
end
|
398
|
+
|
399
|
+
|
400
|
+
|
401
|
+
|
402
|
+
|
403
|
+
describe Project, '#package file' do
|
404
|
+
it 'should be a file task' do
|
405
|
+
define 'foo' do
|
406
|
+
package(:zip, :file=>'foo.zip').should be_kind_of(Rake::FileTask)
|
407
|
+
end
|
408
|
+
end
|
409
|
+
|
410
|
+
it 'should not require id, project or version' do
|
411
|
+
define 'foo', :group=>nil do
|
412
|
+
lambda { package(:zip, :file=>'foo.zip') }.should_not raise_error
|
413
|
+
lambda { package(:zip, :file=>'bar.zip', :id=>'error') }.should raise_error
|
414
|
+
lambda { package(:zip, :file=>'bar.zip', :group=>'error') }.should raise_error
|
415
|
+
lambda { package(:zip, :file=>'bar.zip', :version=>'error') }.should raise_error
|
416
|
+
end
|
417
|
+
end
|
418
|
+
|
419
|
+
it 'should not provide project or version' do
|
420
|
+
define 'foo' do
|
421
|
+
package(:zip, :file=>'foo.zip').tap do |pkg|
|
422
|
+
pkg.should_not respond_to(:group)
|
423
|
+
pkg.should_not respond_to(:version)
|
424
|
+
end
|
425
|
+
end
|
426
|
+
end
|
427
|
+
|
428
|
+
it 'should provide packaging type' do
|
429
|
+
define 'foo', :version=>'1.0' do
|
430
|
+
zip = package(:zip, :file=>'foo.zip')
|
431
|
+
jar = package(:jar, :file=>'bar.jar')
|
432
|
+
zip.type.should eql(:zip)
|
433
|
+
jar.type.should eql(:jar)
|
434
|
+
end
|
435
|
+
end
|
436
|
+
|
437
|
+
it 'should assume packaging type from extension if unspecified' do
|
438
|
+
define 'foo', :version=>'1.0' do
|
439
|
+
package(:file=>'foo.zip').class.should be(Buildr::ZipTask)
|
440
|
+
define 'bar' do
|
441
|
+
package(:file=>'bar.jar').class.should be(Buildr::Packaging::Java::JarTask)
|
442
|
+
end
|
443
|
+
end
|
444
|
+
end
|
445
|
+
|
446
|
+
it 'should support different packaging types' do
|
447
|
+
define 'foo', :version=>'1.0' do
|
448
|
+
package(:jar, :file=>'foo.jar').class.should be(Buildr::Packaging::Java::JarTask)
|
449
|
+
end
|
450
|
+
define 'bar' do
|
451
|
+
package(:type=>:war, :file=>'bar.war').class.should be(Buildr::Packaging::Java::WarTask)
|
452
|
+
end
|
453
|
+
end
|
454
|
+
|
455
|
+
it 'should fail if packaging not supported' do
|
456
|
+
lambda { define('foo') { package(:weirdo, :file=>'foo.zip') } }.should raise_error(RuntimeError, /Don't know how to create a package/)
|
457
|
+
end
|
458
|
+
|
459
|
+
it 'should create different tasks for each file' do
|
460
|
+
define 'foo', :version=>'1.0' do
|
461
|
+
package(:zip, :file=>'foo.zip')
|
462
|
+
package(:jar, :file=>'foo.jar')
|
463
|
+
end
|
464
|
+
project('foo').packages.uniq.size.should be(2)
|
465
|
+
end
|
466
|
+
|
467
|
+
it 'should return the same task for subsequent calls' do
|
468
|
+
define 'foo', :version=>'1.0' do
|
469
|
+
package(:zip, :file=>'foo.zip').should eql(package(:file=>'foo.zip'))
|
470
|
+
end
|
471
|
+
end
|
472
|
+
|
473
|
+
it 'should point to specified file' do
|
474
|
+
define 'foo', :version=>'1.0' do
|
475
|
+
package(:zip, :file=>'foo.zip').should point_to_path('foo.zip')
|
476
|
+
package(:zip, :file=>'target/foo-1.0.zip').should point_to_path('target/foo-1.0.zip')
|
477
|
+
end
|
478
|
+
end
|
479
|
+
|
480
|
+
it 'should create prerequisite for package task' do
|
481
|
+
define 'foo', :version=>'1.0' do
|
482
|
+
package(:zip, :file=>'foo.zip')
|
483
|
+
end
|
484
|
+
project('foo').task('package').prerequisites.should include(*project('foo').packages)
|
485
|
+
end
|
486
|
+
|
487
|
+
it 'should create task requiring a build' do
|
488
|
+
define 'foo', :version=>'1.0' do
|
489
|
+
package(:zip, :file=>'foo.zip').prerequisites.should include(build)
|
490
|
+
end
|
491
|
+
end
|
492
|
+
|
493
|
+
it 'should create specified file during build' do
|
494
|
+
define 'foo', :version=>'1.0' do
|
495
|
+
package(:zip, :file=>'foo.zip')
|
496
|
+
end
|
497
|
+
lambda { project('foo').task('package').invoke }.should change { File.exist?('foo.zip') }.to(true)
|
498
|
+
end
|
499
|
+
|
500
|
+
it 'should do nothing for installation/upload' do
|
501
|
+
define 'foo', :version=>'1.0' do
|
502
|
+
package(:zip, :file=>'foo.zip')
|
503
|
+
end
|
504
|
+
lambda do
|
505
|
+
task('install').invoke
|
506
|
+
task('upload').invoke
|
507
|
+
task('uninstall').invoke
|
508
|
+
end.should_not raise_error
|
509
|
+
end
|
510
|
+
|
511
|
+
end
|
512
|
+
|
513
|
+
|
514
|
+
|
515
|
+
|
516
|
+
|
517
|
+
|
518
|
+
|
519
|
+
describe Rake::Task, ' package' do
|
520
|
+
it 'should be local task' do
|
521
|
+
define 'foo', :version=>'1.0' do
|
522
|
+
package
|
523
|
+
define('bar') { package }
|
524
|
+
end
|
525
|
+
in_original_dir project('foo:bar').base_dir do
|
526
|
+
task('package').invoke
|
527
|
+
project('foo').package.should_not exist
|
528
|
+
project('foo:bar').package.should exist
|
529
|
+
end
|
530
|
+
end
|
531
|
+
|
532
|
+
it 'should be recursive task' do
|
533
|
+
define 'foo', :version=>'1.0' do
|
534
|
+
package
|
535
|
+
define('bar') { package }
|
536
|
+
end
|
537
|
+
task('package').invoke
|
538
|
+
project('foo').package.should exist
|
539
|
+
project('foo:bar').package.should exist
|
540
|
+
end
|
541
|
+
|
542
|
+
it 'should create package in target directory' do
|
543
|
+
define 'foo', :version=>'1.0' do
|
544
|
+
package
|
545
|
+
define('bar') { package }
|
546
|
+
end
|
547
|
+
task('package').invoke
|
548
|
+
FileList['**/target/*.zip'].map.sort.should == ['bar/target/foo-bar-1.0.zip', 'target/foo-1.0.zip']
|
549
|
+
end
|
550
|
+
end
|
551
|
+
|
552
|
+
|
553
|
+
describe Rake::Task, ' install' do
|
554
|
+
it 'should be local task' do
|
555
|
+
define 'foo', :version=>'1.0' do
|
556
|
+
package
|
557
|
+
define('bar') { package }
|
558
|
+
end
|
559
|
+
in_original_dir project('foo:bar').base_dir do
|
560
|
+
task('install').invoke
|
561
|
+
artifacts('foo:foo:zip:1.0', 'foo:foo:pom:1.0').each { |t| t.should_not exist }
|
562
|
+
artifacts('foo:foo-bar:zip:1.0', 'foo:foo-bar:pom:1.0').each { |t| t.should exist }
|
563
|
+
end
|
564
|
+
end
|
565
|
+
|
566
|
+
it 'should be recursive task' do
|
567
|
+
define 'foo', :version=>'1.0' do
|
568
|
+
package
|
569
|
+
define('bar') { package }
|
570
|
+
end
|
571
|
+
task('install').invoke
|
572
|
+
artifacts('foo:foo:zip:1.0', 'foo:foo:pom:1.0', 'foo:foo-bar:zip:1.0', 'foo:foo-bar:pom:1.0').each { |t| t.should exist }
|
573
|
+
end
|
574
|
+
|
575
|
+
it 'should create package in local repository' do
|
576
|
+
define 'foo', :version=>'1.0' do
|
577
|
+
package
|
578
|
+
define('bar') { package }
|
579
|
+
end
|
580
|
+
task('install').invoke
|
581
|
+
FileList[repositories.local + '/**/*'].reject { |f| File.directory?(f) }.sort.should == [
|
582
|
+
File.expand_path('foo/foo/1.0/foo-1.0.zip', repositories.local),
|
583
|
+
File.expand_path('foo/foo/1.0/foo-1.0.pom', repositories.local),
|
584
|
+
File.expand_path('foo/foo-bar/1.0/foo-bar-1.0.zip', repositories.local),
|
585
|
+
File.expand_path('foo/foo-bar/1.0/foo-bar-1.0.pom', repositories.local)].sort
|
586
|
+
end
|
587
|
+
end
|
588
|
+
|
589
|
+
|
590
|
+
describe Rake::Task, ' uninstall' do
|
591
|
+
it 'should be local task' do
|
592
|
+
define 'foo', :version=>'1.0' do
|
593
|
+
package
|
594
|
+
define('bar') { package }
|
595
|
+
end
|
596
|
+
task('install').invoke
|
597
|
+
in_original_dir project('foo:bar').base_dir do
|
598
|
+
task('uninstall').invoke
|
599
|
+
FileList[repositories.local + '/**/*'].reject { |f| File.directory?(f) }.sort.should == [
|
600
|
+
File.expand_path('foo/foo/1.0/foo-1.0.zip', repositories.local),
|
601
|
+
File.expand_path('foo/foo/1.0/foo-1.0.pom', repositories.local)].sort
|
602
|
+
end
|
603
|
+
end
|
604
|
+
|
605
|
+
it 'should be recursive task' do
|
606
|
+
define 'foo', :version=>'1.0' do
|
607
|
+
package
|
608
|
+
define('bar') { package }
|
609
|
+
end
|
610
|
+
task('install').invoke
|
611
|
+
task('uninstall').invoke
|
612
|
+
FileList[repositories.local + '/**/*'].reject { |f| File.directory?(f) }.sort.should be_empty
|
613
|
+
end
|
614
|
+
end
|
615
|
+
|
616
|
+
|
617
|
+
describe Rake::Task, ' upload' do
|
618
|
+
before do
|
619
|
+
repositories.release_to = "file://#{File.expand_path('remote')}"
|
620
|
+
end
|
621
|
+
|
622
|
+
it 'should be local task' do
|
623
|
+
define 'foo', :version=>'1.0' do
|
624
|
+
package
|
625
|
+
define('bar') { package }
|
626
|
+
end
|
627
|
+
in_original_dir project('foo:bar').base_dir do
|
628
|
+
lambda { task('upload').invoke }.should run_task('foo:bar:upload').but_not('foo:upload')
|
629
|
+
end
|
630
|
+
end
|
631
|
+
|
632
|
+
it 'should be recursive task' do
|
633
|
+
define 'foo', :version=>'1.0' do
|
634
|
+
package
|
635
|
+
define('bar') { package }
|
636
|
+
end
|
637
|
+
lambda { task('upload').invoke }.should run_tasks('foo:upload', 'foo:bar:upload')
|
638
|
+
end
|
639
|
+
|
640
|
+
it 'should upload artifact and POM' do
|
641
|
+
define('foo', :version=>'1.0') { package :jar }
|
642
|
+
task('upload').invoke
|
643
|
+
{ 'remote/foo/foo/1.0/foo-1.0.jar'=>project('foo').package(:jar),
|
644
|
+
'remote/foo/foo/1.0/foo-1.0.pom'=>project('foo').package(:jar).pom }.each do |upload, package|
|
645
|
+
read(upload).should eql(read(package))
|
646
|
+
end
|
647
|
+
end
|
648
|
+
|
649
|
+
it 'should upload signatures for artifact and POM' do
|
650
|
+
define('foo', :version=>'1.0') { package :jar }
|
651
|
+
task('upload').invoke
|
652
|
+
{ 'remote/foo/foo/1.0/foo-1.0.jar'=>project('foo').package(:jar),
|
653
|
+
'remote/foo/foo/1.0/foo-1.0.pom'=>project('foo').package(:jar).pom }.each do |upload, package|
|
654
|
+
read("#{upload}.md5").split.first.should eql(Digest::MD5.hexdigest(read(package)))
|
655
|
+
read("#{upload}.sha1").split.first.should eql(Digest::SHA1.hexdigest(read(package)))
|
656
|
+
end
|
657
|
+
end
|
658
|
+
end
|
659
|
+
|
660
|
+
|
661
|
+
describe Packaging, 'zip' do
|
662
|
+
it_should_behave_like 'packaging'
|
663
|
+
before { @packaging = :zip }
|
664
|
+
|
665
|
+
it 'should not include META-INF directory' do
|
666
|
+
define('foo', :version=>'1.0') { package(:zip) }
|
667
|
+
project('foo').package(:zip).invoke
|
668
|
+
Zip::ZipFile.open(project('foo').package(:zip).to_s) do |zip|
|
669
|
+
zip.entries.map(&:to_s).should_not include('META-INF/')
|
670
|
+
end
|
671
|
+
end
|
672
|
+
end
|
673
|
+
|
674
|
+
|
675
|
+
describe Packaging, ' tar' do
|
676
|
+
before { @packaging = :tar }
|
677
|
+
it_should_behave_like 'packaging'
|
678
|
+
end
|
679
|
+
|
680
|
+
|
681
|
+
describe Packaging, ' tgz' do
|
682
|
+
before { @packaging = :tgz }
|
683
|
+
it_should_behave_like 'packaging'
|
684
|
+
end
|