buildr 1.4.25 → 1.5.0.dev2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +50 -0
- data/NOTICE +1 -1
- data/README.rdoc +1 -1
- data/addon/buildr/bnd.rb +0 -6
- data/addon/buildr/custom_pom.rb +6 -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/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/wsgen.rb +27 -27
- data/buildr.buildfile +1 -1
- data/buildr.gemspec +13 -9
- data/doc/_config.yml +3 -1
- data/doc/_layouts/default.html +1 -1
- data/doc/artifacts.textile +42 -0
- data/doc/download.textile +18 -6
- data/doc/languages.textile +15 -1
- data/doc/packaging.textile +1 -1
- data/doc/preface.textile +1 -1
- data/doc/projects.textile +13 -0
- data/doc/releasing.textile +14 -0
- data/doc/settings_profiles.textile +4 -0
- data/lib/buildr.rb +1 -0
- data/lib/buildr/core/application.rb +2 -3
- data/lib/buildr/core/build.rb +21 -34
- data/lib/buildr/core/compile.rb +0 -12
- data/lib/buildr/core/filter.rb +7 -0
- data/lib/buildr/core/generate.rb +1 -0
- data/lib/buildr/core/project.rb +14 -4
- data/lib/buildr/core/test.rb +2 -4
- data/lib/buildr/core/transports.rb +2 -0
- data/lib/buildr/groovy/bdd.rb +0 -7
- data/lib/buildr/ide/eclipse.rb +3 -3
- data/lib/buildr/java/ant.rb +0 -6
- data/lib/buildr/java/bdd.rb +0 -7
- data/lib/buildr/java/commands.rb +1 -1
- data/lib/buildr/java/deprecated.rb +0 -60
- data/lib/buildr/java/ecj.rb +16 -3
- data/lib/buildr/java/jruby.rb +19 -1
- data/lib/buildr/java/packaging.rb +4 -8
- data/lib/buildr/java/pom.rb +17 -12
- data/lib/buildr/java/rjb.rb +21 -3
- data/lib/buildr/java/tests.rb +0 -21
- data/lib/buildr/packaging/archive.rb +1 -1
- data/lib/buildr/packaging/artifact.rb +132 -3
- data/lib/buildr/packaging/zip.rb +32 -29
- data/lib/buildr/packaging/ziptask.rb +7 -5
- data/lib/buildr/scala.rb +0 -1
- data/lib/buildr/scala/bdd.rb +28 -122
- data/lib/buildr/scala/compiler.rb +24 -10
- data/lib/buildr/scala/doc.rb +0 -1
- data/lib/buildr/scala/org/apache/buildr/Specs2Runner.class +0 -0
- data/lib/buildr/scala/org/apache/buildr/Specs2Runner.java +4 -3
- data/lib/buildr/scala/org/apache/buildr/ZincRunner.class +0 -0
- data/lib/buildr/scala/org/apache/buildr/ZincRunner.java +37 -0
- data/lib/buildr/scala/tests.rb +18 -26
- data/lib/buildr/version.rb +1 -1
- data/spec/addon/bnd_spec.rb +5 -5
- data/spec/addon/custom_pom_spec.rb +38 -32
- data/spec/addon/jaxb_xjc_spec.rb +0 -4
- data/spec/core/application_spec.rb +4 -5
- data/spec/core/build_spec.rb +10 -51
- data/spec/core/common_spec.rb +7 -0
- data/spec/core/compile_spec.rb +0 -6
- data/spec/core/console_spec.rb +1 -1
- data/spec/core/generate_from_eclipse_spec.rb +22 -8
- data/spec/core/project_spec.rb +34 -70
- data/spec/core/test_spec.rb +6 -9
- data/spec/core/transport_spec.rb +16 -7
- data/spec/groovy/compiler_spec.rb +2 -2
- data/spec/java/ant_spec.rb +0 -5
- data/spec/java/compiler_spec.rb +4 -4
- data/spec/java/ecj_spec.rb +244 -45
- data/spec/java/java_spec.rb +7 -9
- data/spec/java/packaging_spec.rb +23 -23
- data/spec/java/pom_spec.rb +37 -0
- data/spec/java/tests_spec.rb +0 -5
- data/spec/packaging/archive_spec.rb +1 -1
- data/spec/packaging/artifact_spec.rb +129 -7
- data/spec/packaging/packaging_spec.rb +1 -1
- data/spec/sandbox.rb +2 -2
- data/spec/scala/bdd_spec.rb +0 -101
- data/spec/scala/compiler_spec.rb +20 -16
- data/spec/scala/doc_spec.rb +0 -11
- data/spec/scala/tests_spec.rb +6 -15
- data/spec/spec_helpers.rb +1 -1
- data/spec/xpath_matchers.rb +2 -1
- metadata +64 -22
- data/addon/buildr/cobertura.rb +0 -21
- data/addon/buildr/emma.rb +0 -21
data/spec/java/java_spec.rb
CHANGED
@@ -51,6 +51,12 @@ else
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
+
describe 'Java.classpath' do
|
55
|
+
it 'should issue a warning if the classpath is modified after Java is loaded' do
|
56
|
+
lambda { Java.classpath << 'foo:bar:1.0' }.should show_warning(/Java is already loaded/)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
54
60
|
|
55
61
|
describe 'Java.tools_jar' do
|
56
62
|
before do
|
@@ -121,12 +127,4 @@ describe 'Java#java' do
|
|
121
127
|
after do
|
122
128
|
ENV['JAVA_HOME'] = @old_home
|
123
129
|
end
|
124
|
-
end
|
125
|
-
|
126
|
-
|
127
|
-
describe Java::JavaWrapper do
|
128
|
-
it 'should be removed in version 1.5 since it was deprecated in version 1.3' do
|
129
|
-
Buildr::VERSION.should < '1.5'
|
130
|
-
lambda { Java::JavaWrapper }.should_not raise_error
|
131
|
-
end
|
132
|
-
end
|
130
|
+
end
|
data/spec/java/packaging_spec.rb
CHANGED
@@ -91,13 +91,13 @@ shared_examples_for 'package with manifest' do
|
|
91
91
|
it 'should not exist when manifest=false' do
|
92
92
|
package_with_manifest false
|
93
93
|
@project.package(@packaging).invoke
|
94
|
-
Zip::
|
95
|
-
zip.
|
94
|
+
Zip::File.open(@project.package(@packaging).to_s) do |zip|
|
95
|
+
zip.exist?('META-INF/MANIFEST.MF').should be_false
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
99
99
|
it 'should generate a new manifest for a file that does not have one' do
|
100
|
-
Zip::
|
100
|
+
Zip::OutputStream.open 'tmp.zip' do |zip|
|
101
101
|
zip.put_next_entry 'empty.txt'
|
102
102
|
end
|
103
103
|
begin
|
@@ -135,7 +135,7 @@ shared_examples_for 'package with manifest' do
|
|
135
135
|
package_with_manifest 'Foo'=>1, :bar=>'Bar'
|
136
136
|
package = project('foo').package(@packaging)
|
137
137
|
package.invoke
|
138
|
-
Zip::
|
138
|
+
Zip::File.open(package.to_s) { |zip| zip.read('META-INF/MANIFEST.MF').should =~ /#{Buildr::Packaging::Java::Manifest::LINE_SEPARATOR}$/ }
|
139
139
|
end
|
140
140
|
|
141
141
|
it 'should break hash manifest lines longer than 72 characters using continuations' do
|
@@ -160,7 +160,7 @@ shared_examples_for 'package with manifest' do
|
|
160
160
|
package_with_manifest [ { :foo=>'first' }, { :bar=>'second' } ]
|
161
161
|
package = project('foo').package(@packaging)
|
162
162
|
package.invoke
|
163
|
-
Zip::
|
163
|
+
Zip::File.open(package.to_s) { |zip| zip.read('META-INF/MANIFEST.MF')[-1].should == ?\n }
|
164
164
|
end
|
165
165
|
|
166
166
|
it 'should break array manifest lines longer than 72 characters using continuations' do
|
@@ -202,8 +202,8 @@ shared_examples_for 'package with manifest' do
|
|
202
202
|
package_with_manifest [ {}, { 'Name'=>'first', :Foo=>'first', :bar=>'second' } ]
|
203
203
|
package ||= project('foo').package(@packaging)
|
204
204
|
package.invoke
|
205
|
-
Zip::
|
206
|
-
permissions = format("%o", zip.
|
205
|
+
Zip::File.open(package.to_s) do |zip|
|
206
|
+
permissions = format("%o", zip.find_entry('META-INF/MANIFEST.MF').unix_perms)
|
207
207
|
expected_mode = Buildr::Util.win_os? ? /666$/ : /644$/
|
208
208
|
permissions.should match expected_mode
|
209
209
|
end
|
@@ -214,7 +214,7 @@ shared_examples_for 'package with manifest' do
|
|
214
214
|
package_with_manifest 'MANIFEST.MF'
|
215
215
|
package ||= project('foo').package(@packaging)
|
216
216
|
package.invoke
|
217
|
-
Zip::
|
217
|
+
Zip::File.open(package.to_s) do |zip|
|
218
218
|
zip.read('META-INF/MANIFEST.MF').scan(/(Manifest-Version)/m).size.should == 1
|
219
219
|
end
|
220
220
|
end
|
@@ -251,7 +251,7 @@ shared_examples_for 'package with manifest' do
|
|
251
251
|
packaging = @packaging
|
252
252
|
package = define('foo', :version=>'1.0') { package(packaging) }.packages.first
|
253
253
|
package.invoke
|
254
|
-
Zip::
|
254
|
+
Zip::File.open(package.to_s) do |zip|
|
255
255
|
zip.entries.map(&:to_s).should include('META-INF/')
|
256
256
|
end
|
257
257
|
end
|
@@ -361,7 +361,7 @@ shared_examples_for 'package with meta_inf' do
|
|
361
361
|
package = project('foo').package(@packaging)
|
362
362
|
package.invoke
|
363
363
|
assumed = Array(@meta_inf_ignore)
|
364
|
-
Zip::
|
364
|
+
Zip::File.open(package.to_s) do |zip|
|
365
365
|
entries = zip.entries.map(&:name).select { |f| File.dirname(f) == 'META-INF' }.map { |f| File.basename(f) }
|
366
366
|
assumed.each { |f| entries.should include(f) }
|
367
367
|
yield entries - assumed if block_given?
|
@@ -435,7 +435,7 @@ describe Packaging, 'jar' do
|
|
435
435
|
write 'src/main/java/Test.java', 'class Test {}'
|
436
436
|
define('foo', :version=>'1.0') { package(:jar) }
|
437
437
|
project('foo').package(:jar).invoke
|
438
|
-
Zip::
|
438
|
+
Zip::File.open(project('foo').package(:jar).to_s) do |jar|
|
439
439
|
entries_to_s = jar.entries.map(&:to_s).delete_if {|entry| entry[-1,1] == "/"}
|
440
440
|
# Sometimes META-INF/ is counted as first entry, which is fair game.
|
441
441
|
(entries_to_s.first == 'META-INF/MANIFEST.MF' || entries_to_s[1] == 'META-INF/MANIFEST.MF').should be_true
|
@@ -446,7 +446,7 @@ describe Packaging, 'jar' do
|
|
446
446
|
write 'src/main/java/Test.java', 'class Test {}'
|
447
447
|
define('foo', :version=>'1.0') { package(:jar) }
|
448
448
|
project('foo').package(:jar).invoke
|
449
|
-
Zip::
|
449
|
+
Zip::File.open(project('foo').package(:jar).to_s) do |jar|
|
450
450
|
jar.entries.map(&:to_s).sort.should include('META-INF/MANIFEST.MF', 'Test.class')
|
451
451
|
end
|
452
452
|
end
|
@@ -455,7 +455,7 @@ describe Packaging, 'jar' do
|
|
455
455
|
write 'src/main/resources/test/important.properties'
|
456
456
|
define('foo', :version=>'1.0') { package(:jar) }
|
457
457
|
project('foo').package(:jar).invoke
|
458
|
-
Zip::
|
458
|
+
Zip::File.open(project('foo').package(:jar).to_s) do |jar|
|
459
459
|
jar.entries.map(&:to_s).sort.should include('test/important.properties')
|
460
460
|
end
|
461
461
|
end
|
@@ -464,7 +464,7 @@ describe Packaging, 'jar' do
|
|
464
464
|
write 'src/main/java/code/Test.java', 'package code ; class Test {}'
|
465
465
|
define('foo', :version=>'1.0') { package(:jar) }
|
466
466
|
project('foo').package(:jar).invoke
|
467
|
-
Zip::
|
467
|
+
Zip::File.open(project('foo').package(:jar).to_s) do |jar|
|
468
468
|
jar.entries.map(&:to_s).sort.should include('code/')
|
469
469
|
end
|
470
470
|
end
|
@@ -473,7 +473,7 @@ describe Packaging, 'jar' do
|
|
473
473
|
write 'src/main/resources/test/.config'
|
474
474
|
define('foo', :version=>'1.0') { package(:jar) }
|
475
475
|
project('foo').package(:jar).invoke
|
476
|
-
Zip::
|
476
|
+
Zip::File.open(project('foo').package(:jar).to_s) do |jar|
|
477
477
|
jar.entries.map(&:to_s).sort.should include('test/.config')
|
478
478
|
end
|
479
479
|
end
|
@@ -482,7 +482,7 @@ describe Packaging, 'jar' do
|
|
482
482
|
mkpath 'src/main/resources/empty'
|
483
483
|
define('foo', :version=>'1.0') { package(:jar) }
|
484
484
|
project('foo').package(:jar).invoke
|
485
|
-
Zip::
|
485
|
+
Zip::File.open(project('foo').package(:jar).to_s) do |jar|
|
486
486
|
jar.entries.map(&:to_s).sort.should include('empty/')
|
487
487
|
end
|
488
488
|
end
|
@@ -497,7 +497,7 @@ describe Packaging, 'jar' do
|
|
497
497
|
write 'src/main/resources/foo.xml', ''
|
498
498
|
foo = define('foo', :version => '1.0') { package(:jar).exclude('foo.xml')}
|
499
499
|
foo.package(:jar).invoke
|
500
|
-
Zip::
|
500
|
+
Zip::File.open(foo.package(:jar).to_s) do |jar|
|
501
501
|
jar.entries.map(&:to_s).sort.should_not include('foo.xml')
|
502
502
|
end
|
503
503
|
end
|
@@ -519,7 +519,7 @@ describe Packaging, 'war' do
|
|
519
519
|
|
520
520
|
def inspect_war
|
521
521
|
project('foo').package(:war).invoke
|
522
|
-
Zip::
|
522
|
+
Zip::File.open(project('foo').package(:war).to_s) do |war|
|
523
523
|
yield war.entries.map(&:to_s).sort
|
524
524
|
end
|
525
525
|
end
|
@@ -678,7 +678,7 @@ describe Packaging, 'aar' do
|
|
678
678
|
|
679
679
|
def inspect_aar
|
680
680
|
project('foo').package(:aar).invoke
|
681
|
-
Zip::
|
681
|
+
Zip::File.open(project('foo').package(:aar).to_s) do |aar|
|
682
682
|
yield aar.entries.map(&:to_s).sort
|
683
683
|
end
|
684
684
|
end
|
@@ -752,23 +752,23 @@ describe Packaging, 'ear' do
|
|
752
752
|
|
753
753
|
def inspect_ear
|
754
754
|
project('foo').package(:ear).invoke
|
755
|
-
Zip::
|
755
|
+
Zip::File.open(project('foo').package(:ear).to_s) do |ear|
|
756
756
|
yield ear.entries.map(&:to_s).sort
|
757
757
|
end
|
758
758
|
end
|
759
759
|
|
760
760
|
def inspect_application_xml
|
761
761
|
project('foo').package(:ear).invoke
|
762
|
-
Zip::
|
762
|
+
Zip::File.open(project('foo').package(:ear).to_s) do |ear|
|
763
763
|
yield REXML::Document.new(ear.read('META-INF/application.xml')).root
|
764
764
|
end
|
765
765
|
end
|
766
766
|
|
767
767
|
def inspect_classpath(package)
|
768
768
|
project('foo').package(:ear).invoke
|
769
|
-
Zip::
|
769
|
+
Zip::File.open(project('foo').package(:ear).to_s) do |ear|
|
770
770
|
File.open('tmp.zip', 'wb') do |tmp|
|
771
|
-
tmp.write ear.
|
771
|
+
tmp.write ear.read(package)
|
772
772
|
end
|
773
773
|
manifest = Buildr::Packaging::Java::Manifest.from_zip('tmp.zip')
|
774
774
|
yield manifest.main['Class-Path'].split(' ')
|
data/spec/java/pom_spec.rb
CHANGED
@@ -123,3 +123,40 @@ XML
|
|
123
123
|
pom.properties.should eql(specs)
|
124
124
|
end
|
125
125
|
end
|
126
|
+
|
127
|
+
describe Buildr::POM do
|
128
|
+
before do
|
129
|
+
repositories.remote = 'http://buildr.apache.org/repository/noexist'
|
130
|
+
@parent = 'group:app-parent:jar:1.1.1'
|
131
|
+
write artifact(@parent).pom.to_s, <<-XML
|
132
|
+
<project>
|
133
|
+
<artifactId>app-parent</artifactId>
|
134
|
+
<groupId>group</groupId>
|
135
|
+
<version>1.1.1</version>
|
136
|
+
</project>
|
137
|
+
XML
|
138
|
+
@app = 'group:app:jar:1.0'
|
139
|
+
write artifact(@app).pom.to_s, <<-XML
|
140
|
+
<project>
|
141
|
+
<artifactId>app</artifactId>
|
142
|
+
<groupId>group</groupId>
|
143
|
+
<parent>
|
144
|
+
<groupId>group</groupId>
|
145
|
+
<artifactId>app-parent</artifactId>
|
146
|
+
<version>1.1.1</version>
|
147
|
+
</parent>
|
148
|
+
<dependencies>
|
149
|
+
<dependency>
|
150
|
+
<artifactId>library</artifactId>
|
151
|
+
<groupId>org.example</groupId>
|
152
|
+
<version>${project.parent.version}</version>
|
153
|
+
</dependency>
|
154
|
+
</dependencies>
|
155
|
+
</project>
|
156
|
+
XML
|
157
|
+
end
|
158
|
+
it "should manage to resolve the version from the parent version" do
|
159
|
+
pom = POM.load(artifact(@app).pom)
|
160
|
+
pom.dependencies.should include('org.example:library:jar:1.1.1')
|
161
|
+
end
|
162
|
+
end
|
data/spec/java/tests_spec.rb
CHANGED
@@ -40,11 +40,6 @@ describe Buildr::JUnit do
|
|
40
40
|
project('foo').test.dependencies.should include(artifact("junit:junit:jar:#{JUnit.version}"))
|
41
41
|
end
|
42
42
|
|
43
|
-
it 'should have REQUIRES up to version 1.5 since it was deprecated in 1.3.3' do
|
44
|
-
Buildr::VERSION.should < '1.5'
|
45
|
-
lambda { JUnit::REQUIRES }.should_not raise_error
|
46
|
-
end
|
47
|
-
|
48
43
|
it 'should pick JUnit version from junit build settings' do
|
49
44
|
Buildr::JUnit.instance_eval { @dependencies = nil }
|
50
45
|
write 'build.yaml', 'junit: 1.2.3'
|
@@ -524,7 +524,7 @@ describe "ZipTask" do
|
|
524
524
|
|
525
525
|
def inspect_archive
|
526
526
|
entries = {}
|
527
|
-
Zip::
|
527
|
+
Zip::File.open @archive do |zip|
|
528
528
|
zip.entries.each do |entry|
|
529
529
|
if entry.directory?
|
530
530
|
# Ignore the / directory created for empty ZIPs when using java.util.zip.
|
@@ -209,6 +209,100 @@ describe Repositories, 'local' do
|
|
209
209
|
end
|
210
210
|
end
|
211
211
|
|
212
|
+
describe Repositories, 'remote_uri' do
|
213
|
+
before do
|
214
|
+
Buildr.repositories.instance_eval do
|
215
|
+
@local = @remote = @release_to = nil
|
216
|
+
end
|
217
|
+
|
218
|
+
@repos = [ 'https://oss.sonatype.org/', 'http://www.ibiblio.org/maven2', { :url => 'http://repo1.maven.org/maven2', :username => 'user', :password => 'password' } ]
|
219
|
+
end
|
220
|
+
|
221
|
+
it 'should convert remote to array of uri' do
|
222
|
+
uri = URI.parse( 'http://repo1.maven.org/maven2' )
|
223
|
+
uri.user = 'user'
|
224
|
+
uri.password = 'password'
|
225
|
+
|
226
|
+
uris = [ URI.parse( 'https://oss.sonatype.org/'), URI.parse( 'http://www.ibiblio.org/maven2' ), uri ]
|
227
|
+
|
228
|
+
repositories.remote = @repos
|
229
|
+
repositories.remote_uri.should eql(uris)
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
describe Repositories, 'mirrors' do
|
234
|
+
before do
|
235
|
+
Buildr.repositories.instance_eval do
|
236
|
+
@local = @remote = @release_to = @mirrors = nil
|
237
|
+
end
|
238
|
+
|
239
|
+
@repos = [ 'http://www.ibiblio.org/maven2', 'http://repo1.maven.org/maven2' ]
|
240
|
+
end
|
241
|
+
|
242
|
+
it 'should be empty initially' do
|
243
|
+
repositories.mirrors.should be_empty
|
244
|
+
end
|
245
|
+
|
246
|
+
it 'should be settable' do
|
247
|
+
repositories.mirrors = @repos.first
|
248
|
+
repositories.mirrors.should eql([@repos.first])
|
249
|
+
end
|
250
|
+
|
251
|
+
it 'should be settable from array' do
|
252
|
+
repositories.mirrors = @repos
|
253
|
+
repositories.mirrors.should eql(@repos)
|
254
|
+
end
|
255
|
+
|
256
|
+
it 'should add and return repositories in order' do
|
257
|
+
@repos.each { |url| repositories.mirrors << url }
|
258
|
+
repositories.mirrors.should eql(@repos)
|
259
|
+
end
|
260
|
+
|
261
|
+
it 'should log that it is overridding the remote repositories with the mirrors' do
|
262
|
+
@repos.each { |url| repositories.mirrors << url }
|
263
|
+
lambda { repositories.remote }.should show_info /Remote repositories overridden by mirrors /
|
264
|
+
end
|
265
|
+
|
266
|
+
it 'should load with all repositories specified in settings file' do
|
267
|
+
write 'home/.buildr/settings.yaml', <<-YAML
|
268
|
+
repositories:
|
269
|
+
mirrors:
|
270
|
+
- http://example.com/repository/noexist
|
271
|
+
remote:
|
272
|
+
- http://foobar.com
|
273
|
+
YAML
|
274
|
+
repositories.mirrors.should include('http://example.com/repository/noexist')
|
275
|
+
end
|
276
|
+
|
277
|
+
it 'should load with all repositories specified in build.yaml file' do
|
278
|
+
write 'build.yaml', <<-YAML
|
279
|
+
repositories:
|
280
|
+
mirrors:
|
281
|
+
- http://example.com/repository/noexist
|
282
|
+
remote:
|
283
|
+
- http://foobar.com
|
284
|
+
YAML
|
285
|
+
repositories.mirrors.should include('http://example.com/repository/noexist')
|
286
|
+
end
|
287
|
+
|
288
|
+
it 'should load with all repositories specified in settings and build.yaml files' do
|
289
|
+
write 'home/.buildr/settings.yaml', <<-YAML
|
290
|
+
repositories:
|
291
|
+
mirrors:
|
292
|
+
- http://example.com/repository/noexist
|
293
|
+
remote:
|
294
|
+
- http://foobar.com
|
295
|
+
YAML
|
296
|
+
write 'build.yaml', <<-YAML
|
297
|
+
repositories:
|
298
|
+
mirrors:
|
299
|
+
- http://example.com/repo2
|
300
|
+
remote:
|
301
|
+
- http://foobar.com
|
302
|
+
YAML
|
303
|
+
repositories.mirrors.should include('http://example.com/repository/noexist', 'http://example.com/repo2')
|
304
|
+
end
|
305
|
+
end
|
212
306
|
|
213
307
|
describe Repositories, 'remote' do
|
214
308
|
before do
|
@@ -581,6 +675,10 @@ describe Buildr, '#artifact' do
|
|
581
675
|
artifact(@spec.merge(:type=>nil)).should respond_to(:invoke)
|
582
676
|
end
|
583
677
|
|
678
|
+
it 'should use JAR type if type is set to bundle' do
|
679
|
+
artifact(@spec.merge(:type=>:bundle)).to_s.should match('\.jar$')
|
680
|
+
end
|
681
|
+
|
584
682
|
it 'should accept string specification' do
|
585
683
|
artifact('com.example:library:jar:2.0').should respond_to(:invoke)
|
586
684
|
end
|
@@ -855,7 +953,6 @@ describe Buildr, '#install' do
|
|
855
953
|
@spec = 'group:id:jar:all:1.0'
|
856
954
|
pom = artifact(@spec).pom
|
857
955
|
write @file
|
858
|
-
p method(:install)
|
859
956
|
install artifact(@spec).from(@file)
|
860
957
|
lambda { install.invoke }.should_not change { File.exist?(repositories.locate(pom)) }.to(true)
|
861
958
|
end
|
@@ -901,6 +998,7 @@ end
|
|
901
998
|
|
902
999
|
|
903
1000
|
describe ActsAsArtifact, '#upload' do
|
1001
|
+
|
904
1002
|
it 'should be used to upload artifact' do
|
905
1003
|
artifact = artifact('com.example:library:jar:2.0')
|
906
1004
|
# Prevent artifact from downloading anything.
|
@@ -929,6 +1027,24 @@ describe ActsAsArtifact, '#upload' do
|
|
929
1027
|
write repositories.locate(artifact.pom)
|
930
1028
|
lambda { artifact.upload }.should raise_error(Exception, /where to upload/)
|
931
1029
|
end
|
1030
|
+
|
1031
|
+
it 'should upload SNAPSHOT with timestamped unique version and maven metadata' do
|
1032
|
+
artifact = artifact('com.example:library:jar:2.0-SNAPSHOT')
|
1033
|
+
# Prevent artifact from downloading anything.
|
1034
|
+
write repositories.locate(artifact)
|
1035
|
+
write repositories.locate(artifact.pom)
|
1036
|
+
|
1037
|
+
time = Time.gm(2011,"mar",11,14,02,36,123)
|
1038
|
+
Time.stub(:now).and_return(time)
|
1039
|
+
|
1040
|
+
URI.should_receive(:upload).once.
|
1041
|
+
with(URI.parse('sftp://example.com/base/com/example/library/2.0-SNAPSHOT/library-2.0-20110311.140236-1.pom'), artifact.pom.to_s, anything)
|
1042
|
+
URI.should_receive(:upload).once.
|
1043
|
+
with(URI.parse('sftp://example.com/base/com/example/library/2.0-SNAPSHOT/library-2.0-20110311.140236-1.jar'), artifact.to_s, anything)
|
1044
|
+
URI.should_receive(:write).once.
|
1045
|
+
with(URI.parse('sftp://example.com/base/com/example/library/2.0-SNAPSHOT/maven_metadata.xml'), anything, anything)
|
1046
|
+
verbose(false) { artifact.upload(:url=>'sftp://example.com/base') }
|
1047
|
+
end
|
932
1048
|
|
933
1049
|
it 'should accept repositories.release_to setting' do
|
934
1050
|
artifact = artifact('com.example:library:jar:2.0')
|
@@ -942,28 +1058,36 @@ describe ActsAsArtifact, '#upload' do
|
|
942
1058
|
end
|
943
1059
|
|
944
1060
|
it 'should use repositories.release_to setting even for snapshots when snapshot_to is not set' do
|
1061
|
+
time = Time.gm(2016,"nov",11,14,02,36,123)
|
1062
|
+
Time.stub(:now).and_return(time)
|
945
1063
|
artifact = artifact('com.example:library:jar:2.0-SNAPSHOT')
|
946
1064
|
# Prevent artifact from downloading anything.
|
947
1065
|
write repositories.locate(artifact)
|
948
1066
|
write repositories.locate(artifact.pom)
|
949
1067
|
URI.should_receive(:upload).once.
|
950
|
-
with(URI.parse('sftp://buildr.apache.org/repository/noexist/base/com/example/library/2.0-SNAPSHOT/library-2.0-
|
1068
|
+
with(URI.parse('sftp://buildr.apache.org/repository/noexist/base/com/example/library/2.0-SNAPSHOT/library-2.0-20161111.140236-1.pom'), artifact.pom.to_s, anything)
|
951
1069
|
URI.should_receive(:upload).once.
|
952
|
-
with(URI.parse('sftp://buildr.apache.org/repository/noexist/base/com/example/library/2.0-SNAPSHOT/library-2.0-
|
1070
|
+
with(URI.parse('sftp://buildr.apache.org/repository/noexist/base/com/example/library/2.0-SNAPSHOT/library-2.0-20161111.140236-1.jar'), artifact.to_s, anything)
|
1071
|
+
URI.should_receive(:write).once.
|
1072
|
+
with(URI.parse('sftp://buildr.apache.org/repository/noexist/base/com/example/library/2.0-SNAPSHOT/maven_metadata.xml'), anything, anything)
|
953
1073
|
repositories.release_to = 'sftp://buildr.apache.org/repository/noexist/base'
|
954
1074
|
artifact.upload
|
955
1075
|
lambda { artifact.upload }.should_not raise_error
|
956
1076
|
end
|
957
1077
|
|
958
1078
|
it 'should use repositories.snapshot_to setting when snapshot_to is set' do
|
1079
|
+
time = Time.gm(2016,"nov",11,14,02,36,123)
|
1080
|
+
Time.stub(:now).and_return(time)
|
959
1081
|
artifact = artifact('com.example:library:jar:2.0-SNAPSHOT')
|
960
1082
|
# Prevent artifact from downloading anything.
|
961
1083
|
write repositories.locate(artifact)
|
962
1084
|
write repositories.locate(artifact.pom)
|
963
1085
|
URI.should_receive(:upload).once.
|
964
|
-
with(URI.parse('sftp://buildr.apache.org/repository/noexist/snapshot/com/example/library/2.0-SNAPSHOT/library-2.0-
|
1086
|
+
with(URI.parse('sftp://buildr.apache.org/repository/noexist/snapshot/com/example/library/2.0-SNAPSHOT/library-2.0-20161111.140236-1.pom'), artifact.pom.to_s, anything)
|
965
1087
|
URI.should_receive(:upload).once.
|
966
|
-
with(URI.parse('sftp://buildr.apache.org/repository/noexist/snapshot/com/example/library/2.0-SNAPSHOT/library-2.0-
|
1088
|
+
with(URI.parse('sftp://buildr.apache.org/repository/noexist/snapshot/com/example/library/2.0-SNAPSHOT/library-2.0-20161111.140236-1.jar'), artifact.to_s, anything)
|
1089
|
+
URI.should_receive(:write).once.
|
1090
|
+
with(URI.parse('sftp://buildr.apache.org/repository/noexist/snapshot/com/example/library/2.0-SNAPSHOT/maven_metadata.xml'), anything, anything)
|
967
1091
|
repositories.release_to = 'sftp://buildr.apache.org/repository/noexist/base'
|
968
1092
|
repositories.snapshot_to = 'sftp://buildr.apache.org/repository/noexist/snapshot'
|
969
1093
|
artifact.upload
|
@@ -978,8 +1102,6 @@ describe ActsAsArtifact, '#upload' do
|
|
978
1102
|
repositories.snapshot_to = 'sftp://buildr.apache.org/repository/noexist/snapshot'
|
979
1103
|
lambda { artifact.upload }.should raise_error(Exception, /where to upload/)
|
980
1104
|
end
|
981
|
-
|
982
|
-
|
983
1105
|
end
|
984
1106
|
|
985
1107
|
|