buildr 1.4.6-x86-mswin32 → 1.4.7-x86-mswin32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. data/CHANGELOG +81 -0
  2. data/Rakefile +5 -2
  3. data/addon/buildr/antlr.rb +0 -4
  4. data/addon/buildr/bnd.rb +3 -1
  5. data/addon/buildr/checkstyle.rb +201 -0
  6. data/addon/buildr/cobertura.rb +0 -1
  7. data/addon/buildr/drb.rb +0 -2
  8. data/addon/buildr/emma.rb +0 -1
  9. data/addon/buildr/findbugs.rb +227 -0
  10. data/addon/buildr/gwt.rake +82 -0
  11. data/addon/buildr/hibernate.rb +0 -4
  12. data/addon/buildr/javacc.rb +0 -4
  13. data/addon/buildr/javancss.rb +155 -0
  14. data/addon/buildr/jdepend.rb +138 -24
  15. data/addon/buildr/jdepend.rb.orig +178 -0
  16. data/addon/buildr/jetty.rb +0 -5
  17. data/addon/buildr/jibx.rb +85 -86
  18. data/addon/buildr/nailgun.rb +2 -2
  19. data/addon/buildr/openjpa.rb +0 -4
  20. data/addon/buildr/pmd.rb +166 -0
  21. data/addon/buildr/protobuf.rb +0 -1
  22. data/addon/buildr/sonar.rb +142 -0
  23. data/addon/buildr/xmlbeans.rb +0 -5
  24. data/buildr.gemspec +36 -21
  25. data/doc/_layouts/default.html +1 -0
  26. data/doc/contributing.textile +11 -2
  27. data/doc/download.textile +17 -5
  28. data/doc/index.textile +21 -46
  29. data/doc/installing.textile +18 -8
  30. data/doc/installing.textile.orig +282 -0
  31. data/doc/languages.textile +0 -38
  32. data/doc/more_stuff.textile +199 -12
  33. data/doc/more_stuff.textile.orig +1004 -0
  34. data/doc/packaging.textile +10 -0
  35. data/doc/settings_profiles.textile +2 -2
  36. data/etc/KEYS +44 -0
  37. data/lib/buildr.rb +67 -4
  38. data/lib/buildr/clojure.rb +0 -2
  39. data/lib/buildr/core/application.rb +23 -32
  40. data/lib/buildr/core/build.rb +0 -7
  41. data/lib/buildr/core/cc.rb +0 -5
  42. data/lib/buildr/core/checks.rb +0 -4
  43. data/lib/buildr/core/common.rb +0 -5
  44. data/lib/buildr/core/compile.rb +5 -10
  45. data/lib/buildr/core/doc.rb +9 -3
  46. data/lib/buildr/core/environment.rb +0 -1
  47. data/lib/buildr/core/filter.rb +0 -5
  48. data/lib/buildr/core/generate.rb +2 -6
  49. data/lib/buildr/core/help.rb +1 -6
  50. data/lib/buildr/core/linux.rb +0 -1
  51. data/lib/buildr/core/osx.rb +0 -1
  52. data/lib/buildr/core/project.rb +0 -4
  53. data/lib/buildr/core/run.rb +1 -5
  54. data/lib/buildr/core/shell.rb +1 -6
  55. data/lib/buildr/core/test.rb +1 -7
  56. data/lib/buildr/core/transports.rb +4 -6
  57. data/lib/buildr/core/util.rb +2 -65
  58. data/lib/buildr/groovy/doc.rb +0 -3
  59. data/lib/buildr/groovy/shell.rb +0 -2
  60. data/lib/buildr/ide/eclipse.rb +4 -13
  61. data/lib/buildr/ide/eclipse/java.rb +0 -4
  62. data/lib/buildr/ide/eclipse/plugin.rb +0 -4
  63. data/lib/buildr/ide/eclipse/scala.rb +0 -4
  64. data/lib/buildr/ide/idea.rb +284 -52
  65. data/lib/buildr/java/ant.rb +2 -6
  66. data/lib/buildr/java/bdd.rb +5 -123
  67. data/lib/buildr/java/cobertura.rb +16 -10
  68. data/lib/buildr/java/commands.rb +33 -7
  69. data/lib/buildr/java/compiler.rb +0 -7
  70. data/lib/buildr/java/deprecated.rb +0 -4
  71. data/lib/buildr/java/doc.rb +0 -2
  72. data/lib/buildr/java/emma.rb +0 -4
  73. data/lib/buildr/java/jruby.rb +0 -2
  74. data/lib/buildr/java/packaging.rb +0 -4
  75. data/lib/buildr/java/pom.rb +24 -16
  76. data/lib/buildr/java/rjb.rb +1 -1
  77. data/lib/buildr/java/test_result.rb +1 -2
  78. data/lib/buildr/java/tests.rb +68 -6
  79. data/lib/buildr/packaging/archive.rb +0 -1
  80. data/lib/buildr/packaging/artifact.rb +19 -16
  81. data/lib/buildr/packaging/artifact_namespace.rb +51 -24
  82. data/lib/buildr/packaging/artifact_search.rb +1 -2
  83. data/lib/buildr/packaging/gems.rb +1 -13
  84. data/lib/buildr/packaging/package.rb +0 -6
  85. data/lib/buildr/packaging/tar.rb +2 -4
  86. data/lib/buildr/packaging/version_requirement.rb +1 -1
  87. data/lib/buildr/packaging/zip.rb +1 -2
  88. data/lib/buildr/packaging/ziptask.rb +0 -4
  89. data/lib/buildr/run.rb +3 -3
  90. data/lib/buildr/scala/bdd.rb +129 -11
  91. data/lib/buildr/scala/compiler.rb +53 -6
  92. data/lib/buildr/scala/doc.rb +6 -4
  93. data/lib/buildr/scala/org/apache/buildr/Specs2Runner.class +0 -0
  94. data/lib/buildr/scala/org/apache/buildr/Specs2Runner.java +38 -0
  95. data/lib/buildr/scala/shell.rb +0 -4
  96. data/lib/buildr/scala/tests.rb +15 -6
  97. data/lib/buildr/shell.rb +0 -1
  98. data/lib/buildr/version.rb +1 -1
  99. data/rakelib/all-in-one.rake +20 -11
  100. data/rakelib/checks.rake +0 -31
  101. data/rakelib/doc.rake +86 -100
  102. data/rakelib/package.rake +3 -3
  103. data/rakelib/release.rake +1 -1
  104. data/rakelib/rspec.rake +23 -7
  105. data/rakelib/stage.rake +18 -21
  106. data/spec/addon/bnd_spec.rb +2 -2
  107. data/spec/addon/jaxb_xjc_spec.rb +5 -0
  108. data/spec/core/application_spec.rb +11 -64
  109. data/spec/core/cc_spec.rb +12 -5
  110. data/spec/core/compile_spec.rb +11 -0
  111. data/spec/core/doc_spec.rb +1 -1
  112. data/spec/core/run_spec.rb +17 -4
  113. data/spec/core/test_spec.rb +5 -3
  114. data/spec/ide/idea_spec.rb +60 -0
  115. data/spec/java/bdd_spec.rb +8 -218
  116. data/spec/java/cobertura_spec.rb +4 -0
  117. data/spec/java/compiler_spec.rb +11 -8
  118. data/spec/java/emma_spec.rb +4 -1
  119. data/spec/java/java_spec.rb +1 -1
  120. data/spec/java/pom_spec.rb +125 -0
  121. data/spec/java/tests_spec.rb +185 -0
  122. data/spec/packaging/archive_spec.rb +1 -1
  123. data/spec/packaging/artifact_namespace_spec.rb +15 -0
  124. data/spec/packaging/artifact_spec.rb +26 -1
  125. data/spec/sandbox.rb +7 -1
  126. data/spec/scala/bdd_spec.rb +111 -8
  127. data/spec/scala/tests_spec.rb +5 -1
  128. data/spec/spec_helpers.rb +9 -4
  129. data/spec/version_requirement_spec.rb +2 -0
  130. metadata +570 -505
  131. data/lib/buildr/core.rb +0 -34
  132. data/lib/buildr/ide.rb +0 -19
  133. data/lib/buildr/java.rb +0 -25
  134. data/lib/buildr/java/jtestr_result.rb +0 -331
  135. data/lib/buildr/java/jtestr_runner.rb.erb +0 -116
  136. data/lib/buildr/packaging.rb +0 -25
  137. data/rakelib/setup.rake +0 -68
@@ -15,6 +15,8 @@
15
15
 
16
16
 
17
17
  require File.expand_path(File.join(File.dirname(__FILE__), 'test_coverage_helper'))
18
+ if ENV_JAVA['java.version'] < "1.7"
19
+
18
20
  Sandbox.require_optional_extension 'buildr/java/cobertura'
19
21
  artifacts(Buildr::Cobertura::dependencies).map(&:invoke)
20
22
 
@@ -110,3 +112,5 @@ JAVA
110
112
  end
111
113
  end
112
114
  end
115
+
116
+ end
@@ -68,15 +68,18 @@ describe 'javac compiler' do
68
68
  end
69
69
  end
70
70
 
71
- it 'should include classpath dependencies' do
72
- write 'src/dependency/Dependency.java', 'class Dependency {}'
73
- define 'dependency', :version=>'1.0' do
74
- compile.from('src/dependency').into('target/dependency')
75
- package(:jar)
71
+ # Doesn't work under jdk1.5 - caused in one of the commits 1167678, 1170604, 1170605, 1180125
72
+ if Java.java.lang.System.getProperty("java.runtime.version") >= "1.6"
73
+ it 'should include classpath dependencies' do
74
+ write 'src/dependency/Dependency.java', 'class Dependency {}'
75
+ define 'dependency', :version=>'1.0' do
76
+ compile.from('src/dependency').into('target/dependency')
77
+ package(:jar)
78
+ end
79
+ write 'src/test/DependencyTest.java', 'class DependencyTest { Dependency _var; }'
80
+ define('foo').compile.from('src/test').with(project('dependency')).invoke
81
+ file('target/classes/DependencyTest.class').should exist
76
82
  end
77
- write 'src/test/DependencyTest.java', 'class DependencyTest { Dependency _var; }'
78
- define('foo').compile.from('src/test').with(project('dependency')).invoke
79
- file('target/classes/DependencyTest.class').should exist
80
83
  end
81
84
 
82
85
  it 'should include tools.jar dependency' do
@@ -13,8 +13,9 @@
13
13
  # License for the specific language governing permissions and limitations under
14
14
  # the License.
15
15
 
16
-
17
16
  require File.expand_path(File.join(File.dirname(__FILE__), 'test_coverage_helper'))
17
+ if ENV_JAVA['java.version'] < "1.7"
18
+
18
19
  Sandbox.require_optional_extension 'buildr/java/emma'
19
20
  artifacts(Buildr::Emma::dependencies).map(&:invoke)
20
21
 
@@ -119,3 +120,5 @@ describe Buildr::Emma do
119
120
  end
120
121
  end
121
122
  end
123
+
124
+ end
@@ -22,7 +22,7 @@ unless RUBY_PLATFORM =~ /java/
22
22
  before do
23
23
  @old_home, ENV['JAVA_HOME'] = ENV['JAVA_HOME'], nil
24
24
  @old_env_java = Object.module_eval { remove_const :ENV_JAVA }
25
- Config::CONFIG.should_receive(:[]).with('host_os').and_return('darwin0.9')
25
+ RbConfig::CONFIG.should_receive(:[]).with('host_os').and_return('darwin0.9')
26
26
  end
27
27
 
28
28
  it 'should point to default JVM' do
@@ -0,0 +1,125 @@
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
+ require 'fileutils'
18
+
19
+ describe Buildr::POM do
20
+ before do
21
+ repositories.remote = 'http://example.com'
22
+ @app = 'group:pomapp:jar:1.0'
23
+ write artifact(@app).pom.to_s, <<-XML
24
+ <project>
25
+ <artifactId>pomapp</artifactId>
26
+ <groupId>group</groupId>
27
+ <dependencies>
28
+ <dependency>
29
+ <artifactId>library</artifactId>
30
+ <groupId>org.example</groupId>
31
+ <version>1.1</version>
32
+ <scope>runtime</scope>
33
+ <exclusions>
34
+ <exclusion>
35
+ <groupId>javax.mail</groupId>
36
+ <artifactId>mail</artifactId>
37
+ </exclusion>
38
+ </exclusions>
39
+ </dependency>
40
+ </dependencies>
41
+ </project>
42
+ XML
43
+ @library = 'org.example:library:jar:1.1'
44
+ write artifact(@library).pom.to_s, <<-XML
45
+ <project>
46
+ <artifactId>pomapp</artifactId>
47
+ <groupId>group</groupId>
48
+ <dependencies>
49
+ <dependency>
50
+ <artifactId>mail</artifactId>
51
+ <groupId>javax.mail</groupId>
52
+ <version>1.0</version>
53
+ </dependency>
54
+ <dependency>
55
+ <artifactId>foo</artifactId>
56
+ <groupId>org.example</groupId>
57
+ <version>2.0</version>
58
+ </dependency>
59
+ </dependencies>
60
+ </project>
61
+ XML
62
+ end
63
+
64
+ it 'should respect exclusions when computing transitive dependencies' do
65
+ pom = POM.load(artifact(@app).pom)
66
+ specs = [ 'org.example:library:jar:1.1', 'org.example:foo:jar:2.0' ]
67
+ pom.dependencies.should eql(specs)
68
+ end
69
+ end
70
+
71
+ describe Buildr::POM do
72
+ before do
73
+ repositories.remote = 'http://example.com'
74
+ @app = 'group:app:jar:1.0'
75
+ write artifact(@app).pom.to_s, <<-XML
76
+ <project>
77
+ <properties>
78
+ <a.version>${b.version}</a.version>
79
+ <b.version>1.1</b.version>
80
+ </properties>
81
+ <artifactId>app</artifactId>
82
+ <groupId>group</groupId>
83
+ <dependencies>
84
+ <dependency>
85
+ <artifactId>library</artifactId>
86
+ <groupId>org.example</groupId>
87
+ <version>${a.version}</version>
88
+ <scope>runtime</scope>
89
+ <exclusions>
90
+ <exclusion>
91
+ <groupId>javax.mail</groupId>
92
+ <artifactId>mail</artifactId>
93
+ </exclusion>
94
+ </exclusions>
95
+ </dependency>
96
+ </dependencies>
97
+ </project>
98
+ XML
99
+ @library = 'org.example:library:jar:1.1'
100
+ write artifact(@library).pom.to_s, <<-XML
101
+ <project>
102
+ <artifactId>app</artifactId>
103
+ <groupId>group</groupId>
104
+ <dependencies>
105
+ <dependency>
106
+ <artifactId>mail</artifactId>
107
+ <groupId>javax.mail</groupId>
108
+ <version>1.0</version>
109
+ </dependency>
110
+ <dependency>
111
+ <artifactId>foo</artifactId>
112
+ <groupId>org.example</groupId>
113
+ <version>2.0</version>
114
+ </dependency>
115
+ </dependencies>
116
+ </project>
117
+ XML
118
+ end
119
+
120
+ it 'should respect exclusions when computing transitive dependencies when the pom includes properties' do
121
+ pom = POM.load(artifact(@app).pom)
122
+ specs = {"a.version"=>"1.1", "b.version"=>"1.1", "project.groupId"=>"group", "pom.groupId"=>"group", "groupId"=>"group", "project.artifactId"=>"app", "pom.artifactId"=>"app", "artifactId"=>"app"}
123
+ pom.properties.should eql(specs)
124
+ end
125
+ end
@@ -494,4 +494,189 @@ describe Buildr::TestNG do
494
494
  define('foo') { test.using(:testng) }
495
495
  lambda { project('foo').test.invoke }.should change { File.exist?('reports/testng/foo/index.html') }.to(true)
496
496
  end
497
+
498
+ it 'should include classes using TestNG annotations marked with a specific group' do
499
+ write 'src/test/java/com/example/AnnotatedClass.java', <<-JAVA
500
+ package com.example;
501
+ @org.testng.annotations.Test(groups={"included"})
502
+ public class AnnotatedClass { }
503
+ JAVA
504
+ write 'src/test/java/com/example/AnnotatedMethod.java', <<-JAVA
505
+ package com.example;
506
+ public class AnnotatedMethod {
507
+ @org.testng.annotations.Test
508
+ public void annotated() {
509
+ org.testng.AssertJUnit.assertTrue(false);
510
+ }
511
+ }
512
+ JAVA
513
+ define('foo').test.using :testng, :groups=>['included']
514
+ lambda { project('foo').test.invoke }.should_not raise_error
515
+ end
516
+
517
+ it 'should exclude classes using TestNG annotations marked with a specific group' do
518
+ write 'src/test/java/com/example/AnnotatedClass.java', <<-JAVA
519
+ package com.example;
520
+ @org.testng.annotations.Test(groups={"excluded"})
521
+ public class AnnotatedClass {
522
+ public void annotated() {
523
+ org.testng.AssertJUnit.assertTrue(false);
524
+ }
525
+ }
526
+ JAVA
527
+ write 'src/test/java/com/example/AnnotatedMethod.java', <<-JAVA
528
+ package com.example;
529
+ public class AnnotatedMethod {
530
+ @org.testng.annotations.Test(groups={"included"})
531
+ public void annotated() {}
532
+ }
533
+ JAVA
534
+ define('foo').test.using :testng, :excludegroups=>['excluded']
535
+ lambda { project('foo').test.invoke }.should_not raise_error
536
+ end
537
+ end
538
+
539
+ describe Buildr::MultiTest do
540
+ it 'should be selectable in project' do
541
+ define 'foo' do
542
+ test.using(:multitest, :frameworks => [])
543
+ test.framework.should eql(:multitest)
544
+ end
545
+ end
546
+
547
+ it 'should include dependencies of whichever test framework(s) are selected' do
548
+ define('foo') { test.using :multitest, :frameworks => [ Buildr::JUnit, Buildr::TestNG ] }
549
+ project('foo').test.compile.dependencies.should include(artifact("junit:junit:jar:#{JUnit.version}"))
550
+ project('foo').test.compile.dependencies.should include(artifact("org.testng:testng:jar:jdk15:#{TestNG.version}"))
551
+ project('foo').test.dependencies.should include(artifact("junit:junit:jar:#{JUnit.version}"))
552
+ project('foo').test.dependencies.should include(artifact("org.testng:testng:jar:jdk15:#{TestNG.version}"))
553
+ end
554
+
555
+ it 'should include classes of given test framework(s)' do
556
+ write 'src/test/java/com/example/JUnitTest.java', <<-JAVA
557
+ package com.example;
558
+ public class JUnitTest extends junit.framework.TestCase {
559
+ public void testNothing() { }
560
+ }
561
+ JAVA
562
+ write 'src/test/java/com/example/TestNGTest.java', <<-JAVA
563
+ package com.example;
564
+ @org.testng.annotations.Test
565
+ public class TestNGTest { }
566
+ JAVA
567
+ define('foo') { test.using :multitest, :frameworks => [ Buildr::JUnit, Buildr::TestNG ] }
568
+ project('foo').test.invoke
569
+ project('foo').test.tests.should include('com.example.JUnitTest', 'com.example.TestNGTest')
570
+ end
571
+
572
+ it 'should pass when test case passes' do
573
+ write 'src/test/java/PassingTest.java', <<-JAVA
574
+ public class PassingTest extends junit.framework.TestCase {
575
+ public void testNothing() {}
576
+ }
577
+ JAVA
578
+ define('foo') { test.using :multitest, :frameworks => [ Buildr::JUnit, Buildr::TestNG ] }
579
+ lambda { project('foo').test.invoke }.should_not raise_error
580
+ end
581
+
582
+ it 'should fail when test case fails' do
583
+ write 'src/test/java/FailingTest.java', <<-JAVA
584
+ public class FailingTest {
585
+ @org.testng.annotations.Test
586
+ public void testNothing() {
587
+ org.testng.AssertJUnit.assertTrue(false);
588
+ }
589
+ }
590
+ JAVA
591
+ define('foo') { test.using :multitest, :frameworks => [ Buildr::JUnit, Buildr::TestNG ] }
592
+ lambda { project('foo').test.invoke }.should raise_error(RuntimeError, /Tests failed/)
593
+ end
594
+
595
+ it 'should fail when multiple test case fail' do
596
+ write 'src/test/java/FailingTest1.java', <<-JAVA
597
+ public class FailingTest1 {
598
+ @org.testng.annotations.Test
599
+ public void testNothing() {
600
+ org.testng.AssertJUnit.assertTrue(false);
601
+ }
602
+ }
603
+ JAVA
604
+ write 'src/test/java/FailingTest2.java', <<-JAVA
605
+ public class FailingTest2 {
606
+ @org.testng.annotations.Test
607
+ public void testNothing() {
608
+ org.testng.AssertJUnit.assertTrue(false);
609
+ }
610
+ }
611
+ JAVA
612
+ define('foo') { test.using :multitest, :frameworks => [ Buildr::JUnit, Buildr::TestNG ] }
613
+ lambda { project('foo').test.invoke }.should raise_error(RuntimeError, /Tests failed/)
614
+ end
615
+
616
+ it 'should report failed test names' do
617
+ write 'src/test/java/FailingTest.java', <<-JAVA
618
+ public class FailingTest {
619
+ @org.testng.annotations.Test
620
+ public void testNothing() {
621
+ org.testng.AssertJUnit.assertTrue(false);
622
+ }
623
+ }
624
+ JAVA
625
+ define('foo') { test.using :multitest, :frameworks => [ Buildr::JUnit, Buildr::TestNG ] }
626
+ project('foo').test.invoke rescue nil
627
+ project('foo').test.failed_tests.should include('FailingTest')
628
+ end
629
+
630
+ it 'should generate reports' do
631
+ write 'src/test/java/PassingTest.java', <<-JAVA
632
+ public class PassingTest {
633
+ @org.testng.annotations.Test
634
+ public void testNothing() {}
635
+ }
636
+ JAVA
637
+ define('foo') { test.using :multitest, :frameworks => [ Buildr::JUnit, Buildr::TestNG ] }
638
+ lambda { project('foo').test.invoke }.should change {
639
+ p Dir['./**/*'].inspect
640
+ File.exist?('reports/multitest/foo/index.html') }.to(true)
641
+ end
642
+
643
+ it 'should include classes using TestNG annotations marked with a specific group' do
644
+ write 'src/test/java/com/example/AnnotatedClass.java', <<-JAVA
645
+ package com.example;
646
+ @org.testng.annotations.Test(groups={"included"})
647
+ public class AnnotatedClass { }
648
+ JAVA
649
+ write 'src/test/java/com/example/AnnotatedMethod.java', <<-JAVA
650
+ package com.example;
651
+ public class AnnotatedMethod {
652
+ @org.testng.annotations.Test
653
+ public void annotated() {
654
+ org.testng.AssertJUnit.assertTrue(false);
655
+ }
656
+ }
657
+ JAVA
658
+ define('foo') { test.using :multitest, :frameworks => [ Buildr::JUnit, Buildr::TestNG ], :groups=>['included'] }
659
+ lambda { project('foo').test.invoke }.should_not raise_error
660
+ end
661
+
662
+ it 'should exclude classes using TestNG annotations marked with a specific group' do
663
+ write 'src/test/java/com/example/AnnotatedClass.java', <<-JAVA
664
+ package com.example;
665
+ @org.testng.annotations.Test(groups={"excluded"})
666
+ public class AnnotatedClass {
667
+ public void annotated() {
668
+ org.testng.AssertJUnit.assertTrue(false);
669
+ }
670
+ }
671
+ JAVA
672
+ write 'src/test/java/com/example/AnnotatedMethod.java', <<-JAVA
673
+ package com.example;
674
+ public class AnnotatedMethod {
675
+ @org.testng.annotations.Test(groups={"included"})
676
+ public void annotated() {}
677
+ }
678
+ JAVA
679
+ define('foo') { test.using :multitest, :frameworks => [ Buildr::JUnit, Buildr::TestNG ], :excludegroups=>['excluded'] }
680
+ lambda { project('foo').test.invoke }.should_not raise_error
681
+ end
497
682
  end
@@ -474,7 +474,7 @@ describe "ZipTask" do
474
474
  Zip::ZipFile.open @archive do |zip|
475
475
  zip.entries.each do |entry|
476
476
  # Ignore the / directory created for empty ZIPs when using java.util.zip.
477
- entries[entry.to_s] = zip.read(entry) unless entry.to_s == '/'
477
+ entries[entry.name.to_s] = zip.read(entry.name) unless entry.name.to_s == '/'
478
478
  end
479
479
  end
480
480
  yield entries if block_given?
@@ -162,6 +162,21 @@ describe Buildr::ArtifactNamespace do
162
162
  end
163
163
  end
164
164
 
165
+ it 'should accept an artifact spec with classifier' do
166
+ define 'one' do
167
+ artifact_ns.need 'a:b:c:d:1'
168
+ # referenced by spec
169
+ artifact_ns['a:b:c:d:'].should_not be_selected
170
+
171
+ # referenced by name
172
+ artifact_ns[:b].should_not be_selected
173
+ artifact_ns[:b].should be_satisfied_by('a:b:c:d:1')
174
+ artifact_ns[:b].should_not be_satisfied_by('a:b:c:d:2')
175
+ artifact_ns[:b].should_not be_satisfied_by('d:b:c:d:1')
176
+ artifact_ns[:b].version.should == '1'
177
+ end
178
+ end
179
+
165
180
  it 'should accept a requirement_spec' do
166
181
  define 'one' do
167
182
  artifact_ns.need 'thing -> a:b:c:2.1 -> ~>2.0'
@@ -100,7 +100,7 @@ describe Artifact do
100
100
 
101
101
  it 'should handle lack of POM gracefully' do
102
102
  repositories.remote = 'http://example.com'
103
- URI.should_receive(:download).twice { |uri, target, options| raise URI::NotFoundError if uri.to_s.ends_with('.pom') }
103
+ URI.should_receive(:download).twice { |*args| raise URI::NotFoundError if args[0].to_s.end_with?('.pom') }
104
104
  lambda { @artifact.invoke }.should_not raise_error
105
105
  end
106
106
 
@@ -690,6 +690,14 @@ describe Buildr, '#artifacts' do
690
690
  artifacts('c:test').first.should be_kind_of(String)
691
691
  end
692
692
 
693
+ it 'should accept any object responding to :to_spec' do
694
+ obj = Object.new
695
+ class << obj
696
+ def to_spec; "org.example:artifact:jar:1.1"; end
697
+ end
698
+ artifacts(obj).size.should be(1)
699
+ end
700
+
693
701
  it 'should accept project and return all its packaging tasks' do
694
702
  define 'foobar', :group=>'group', :version=>'1.0' do
695
703
  package :jar, :id=>'code'
@@ -1032,6 +1040,13 @@ describe Buildr, '#transitive' do
1032
1040
  <version>8.4</version>
1033
1041
  <scope>test</scope>
1034
1042
  </dependency>
1043
+ <dependency>
1044
+ <artifactId>jlib-optional</artifactId>
1045
+ <groupId>jlib</groupId>
1046
+ <version>1.4</version>
1047
+ <scope>runtime</scope>
1048
+ <optional>true</optional>
1049
+ </dependency>
1035
1050
  </dependencies>
1036
1051
  </project>
1037
1052
  XML
@@ -1110,6 +1125,16 @@ XML
1110
1125
  it 'should bring artifact and transitive depenencies' do
1111
1126
  transitive(@transitive).should eql(artifacts(@transitive, @complex, @simple - [@provided]))
1112
1127
  end
1128
+
1129
+ it 'should filter dependencies based on :scopes argument' do
1130
+ specs = [@complex, 'saxon:saxon-dom:jar:8.4']
1131
+ transitive(@complex, :scopes => [:runtime]).should eql(specs.map { |spec| artifact(spec) })
1132
+ end
1133
+
1134
+ it 'should filter dependencies based on :optional argument' do
1135
+ specs = [@complex, 'saxon:saxon-dom:jar:8.4', 'jlib:jlib-optional:jar:1.4']
1136
+ transitive(@complex, :scopes => [:runtime], :optional => true).should eql(specs.map { |spec| artifact(spec) })
1137
+ end
1113
1138
  end
1114
1139
 
1115
1140
  def modified?(old_mtime, spec)