buildr 1.3.0-java

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.
Files changed (138) hide show
  1. data/CHANGELOG +780 -0
  2. data/DISCLAIMER +7 -0
  3. data/KEYS +151 -0
  4. data/LICENSE +176 -0
  5. data/NOTICE +31 -0
  6. data/README +173 -0
  7. data/Rakefile +63 -0
  8. data/addon/buildr/antlr.rb +65 -0
  9. data/addon/buildr/cobertura.rb +232 -0
  10. data/addon/buildr/hibernate.rb +142 -0
  11. data/addon/buildr/javacc.rb +85 -0
  12. data/addon/buildr/jdepend.rb +60 -0
  13. data/addon/buildr/jetty.rb +248 -0
  14. data/addon/buildr/nailgun.rb +892 -0
  15. data/addon/buildr/openjpa.rb +90 -0
  16. data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
  17. data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
  18. data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
  19. data/addon/buildr/org/apache/buildr/JettyWrapper.java +144 -0
  20. data/addon/buildr/xmlbeans.rb +93 -0
  21. data/bin/buildr +21 -0
  22. data/buildr.gemspec +50 -0
  23. data/doc/css/default.css +225 -0
  24. data/doc/css/print.css +95 -0
  25. data/doc/css/syntax.css +43 -0
  26. data/doc/images/apache-incubator-logo.png +0 -0
  27. data/doc/images/buildr-hires.png +0 -0
  28. data/doc/images/buildr.png +0 -0
  29. data/doc/images/note.png +0 -0
  30. data/doc/images/tip.png +0 -0
  31. data/doc/images/zbuildr.tif +0 -0
  32. data/doc/pages/artifacts.textile +317 -0
  33. data/doc/pages/building.textile +501 -0
  34. data/doc/pages/contributing.textile +178 -0
  35. data/doc/pages/download.textile +25 -0
  36. data/doc/pages/extending.textile +229 -0
  37. data/doc/pages/getting_started.textile +337 -0
  38. data/doc/pages/index.textile +63 -0
  39. data/doc/pages/mailing_lists.textile +17 -0
  40. data/doc/pages/more_stuff.textile +367 -0
  41. data/doc/pages/packaging.textile +592 -0
  42. data/doc/pages/projects.textile +449 -0
  43. data/doc/pages/recipes.textile +127 -0
  44. data/doc/pages/settings_profiles.textile +339 -0
  45. data/doc/pages/testing.textile +475 -0
  46. data/doc/pages/troubleshooting.textile +121 -0
  47. data/doc/pages/whats_new.textile +389 -0
  48. data/doc/print.haml +52 -0
  49. data/doc/print.toc.yaml +28 -0
  50. data/doc/scripts/buildr-git.rb +411 -0
  51. data/doc/scripts/install-jruby.sh +44 -0
  52. data/doc/scripts/install-linux.sh +64 -0
  53. data/doc/scripts/install-osx.sh +52 -0
  54. data/doc/site.haml +55 -0
  55. data/doc/site.toc.yaml +44 -0
  56. data/lib/buildr.rb +47 -0
  57. data/lib/buildr/core.rb +27 -0
  58. data/lib/buildr/core/application.rb +373 -0
  59. data/lib/buildr/core/application_cli.rb +134 -0
  60. data/lib/buildr/core/build.rb +262 -0
  61. data/lib/buildr/core/checks.rb +382 -0
  62. data/lib/buildr/core/common.rb +155 -0
  63. data/lib/buildr/core/compile.rb +594 -0
  64. data/lib/buildr/core/environment.rb +120 -0
  65. data/lib/buildr/core/filter.rb +258 -0
  66. data/lib/buildr/core/generate.rb +195 -0
  67. data/lib/buildr/core/help.rb +118 -0
  68. data/lib/buildr/core/progressbar.rb +156 -0
  69. data/lib/buildr/core/project.rb +890 -0
  70. data/lib/buildr/core/test.rb +690 -0
  71. data/lib/buildr/core/transports.rb +486 -0
  72. data/lib/buildr/core/util.rb +235 -0
  73. data/lib/buildr/ide.rb +19 -0
  74. data/lib/buildr/ide/eclipse.rb +181 -0
  75. data/lib/buildr/ide/idea.ipr.template +300 -0
  76. data/lib/buildr/ide/idea.rb +194 -0
  77. data/lib/buildr/ide/idea7x.ipr.template +290 -0
  78. data/lib/buildr/ide/idea7x.rb +210 -0
  79. data/lib/buildr/java.rb +26 -0
  80. data/lib/buildr/java/ant.rb +71 -0
  81. data/lib/buildr/java/bdd_frameworks.rb +267 -0
  82. data/lib/buildr/java/commands.rb +210 -0
  83. data/lib/buildr/java/compilers.rb +432 -0
  84. data/lib/buildr/java/deprecated.rb +141 -0
  85. data/lib/buildr/java/groovyc.rb +137 -0
  86. data/lib/buildr/java/jruby.rb +99 -0
  87. data/lib/buildr/java/org/apache/buildr/BuildrNail$Main.class +0 -0
  88. data/lib/buildr/java/org/apache/buildr/BuildrNail.class +0 -0
  89. data/lib/buildr/java/org/apache/buildr/BuildrNail.java +41 -0
  90. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
  91. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +116 -0
  92. data/lib/buildr/java/packaging.rb +706 -0
  93. data/lib/buildr/java/pom.rb +178 -0
  94. data/lib/buildr/java/rjb.rb +142 -0
  95. data/lib/buildr/java/test_frameworks.rb +290 -0
  96. data/lib/buildr/java/version_requirement.rb +172 -0
  97. data/lib/buildr/packaging.rb +21 -0
  98. data/lib/buildr/packaging/artifact.rb +729 -0
  99. data/lib/buildr/packaging/artifact_namespace.rb +957 -0
  100. data/lib/buildr/packaging/artifact_search.rb +140 -0
  101. data/lib/buildr/packaging/gems.rb +102 -0
  102. data/lib/buildr/packaging/package.rb +233 -0
  103. data/lib/buildr/packaging/tar.rb +104 -0
  104. data/lib/buildr/packaging/zip.rb +719 -0
  105. data/rakelib/apache.rake +126 -0
  106. data/rakelib/changelog.rake +56 -0
  107. data/rakelib/doc.rake +103 -0
  108. data/rakelib/package.rake +44 -0
  109. data/rakelib/release.rake +53 -0
  110. data/rakelib/rspec.rake +81 -0
  111. data/rakelib/rubyforge.rake +45 -0
  112. data/rakelib/scm.rake +49 -0
  113. data/rakelib/setup.rake +59 -0
  114. data/rakelib/stage.rake +45 -0
  115. data/spec/application_spec.rb +316 -0
  116. data/spec/archive_spec.rb +494 -0
  117. data/spec/artifact_namespace_spec.rb +635 -0
  118. data/spec/artifact_spec.rb +738 -0
  119. data/spec/build_spec.rb +193 -0
  120. data/spec/checks_spec.rb +537 -0
  121. data/spec/common_spec.rb +579 -0
  122. data/spec/compile_spec.rb +561 -0
  123. data/spec/groovy_compilers_spec.rb +239 -0
  124. data/spec/java_bdd_frameworks_spec.rb +238 -0
  125. data/spec/java_compilers_spec.rb +446 -0
  126. data/spec/java_packaging_spec.rb +1042 -0
  127. data/spec/java_test_frameworks_spec.rb +414 -0
  128. data/spec/packaging_helper.rb +63 -0
  129. data/spec/packaging_spec.rb +589 -0
  130. data/spec/project_spec.rb +739 -0
  131. data/spec/sandbox.rb +116 -0
  132. data/spec/scala_compilers_spec.rb +239 -0
  133. data/spec/spec.opts +6 -0
  134. data/spec/spec_helpers.rb +283 -0
  135. data/spec/test_spec.rb +871 -0
  136. data/spec/transport_spec.rb +300 -0
  137. data/spec/version_requirement_spec.rb +115 -0
  138. metadata +324 -0
@@ -0,0 +1,239 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with this
3
+ # work for additional information regarding copyright ownership. The ASF
4
+ # licenses this file to you under the Apache License, Version 2.0 (the
5
+ # "License"); you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+ # License for the specific language governing permissions and limitations under
14
+ # the License.
15
+
16
+
17
+ require File.join(File.dirname(__FILE__), 'spec_helpers')
18
+
19
+ describe 'groovyc compiler' do
20
+
21
+ it 'should identify itself from groovy source directories' do
22
+ write 'src/main/groovy/some/Hello.groovy', 'println "Hello Groovy"'
23
+ write 'src/test/groovy/some/Hello.groovy', 'println "Hello Groovy"'
24
+ define('foo') do
25
+ compile.compiler.should eql(:groovyc)
26
+ test.compile.compiler.should eql(:groovyc)
27
+ end
28
+ end
29
+
30
+ it 'should identify if groovy sources are found on java directories' do
31
+ write 'src/main/java/some/Hello.groovy', 'println "Hello Groovy"'
32
+ write 'src/test/java/some/Hello.groovy', 'println "Hello Groovy"'
33
+ define('foo') do
34
+ compile.compiler.should eql(:groovyc)
35
+ test.compile.compiler.should eql(:groovyc)
36
+ end
37
+ end
38
+
39
+ it 'should identify itself even if groovy and java sources are found' do
40
+ write 'src/main/java/some/Empty.java', 'package some; public interface Empty {}'
41
+ write 'src/main/groovy/some/Hello.groovy', 'println "Hello Groovy"'
42
+ write 'src/test/java/some/Empty.java', 'package some; public interface Empty {}'
43
+ write 'src/test/groovy/some/Hello.groovy', 'println "Hello Groovy"'
44
+ define('foo') do
45
+ compile.compiler.should eql(:groovyc)
46
+ test.compile.compiler.should eql(:groovyc)
47
+ end
48
+ end
49
+
50
+ it 'should identify from custom layout' do
51
+ write 'groovy/Hello.groovy', 'println "Hello world"'
52
+ write 'testing/Hello.groovy', 'println "Hello world"'
53
+ custom = Layout.new
54
+ custom[:source, :main, :groovy] = 'groovy'
55
+ custom[:source, :test, :groovy] = 'testing'
56
+ define 'foo', :layout=>custom do
57
+ compile.compiler.should eql(:groovyc)
58
+ test.compile.compiler.should eql(:groovyc)
59
+ end
60
+ end
61
+
62
+ it 'should identify from compile source directories' do
63
+ write 'src/com/example/Code.groovy', 'println "monkey code"'
64
+ write 'testing/com/example/Test.groovy', 'println "some test"'
65
+ define 'foo' do
66
+ lambda { compile.from 'src' }.should change { compile.compiler }.to(:groovyc)
67
+ lambda { test.compile.from 'testing' }.should change { test.compile.compiler }.to(:groovyc)
68
+ end
69
+ end
70
+
71
+ it 'should report the multi-language as :groovy, :java' do
72
+ define('foo').compile.using(:groovyc).language.should == :groovy
73
+ end
74
+
75
+ it 'should set the target directory to target/classes' do
76
+ define 'foo' do
77
+ lambda { compile.using(:groovyc) }.should change { compile.target.to_s }.to(File.expand_path('target/classes'))
78
+ end
79
+ end
80
+
81
+ it 'should not override existing target directory' do
82
+ define 'foo' do
83
+ compile.into('classes')
84
+ lambda { compile.using(:groovyc) }.should_not change { compile.target }
85
+ end
86
+ end
87
+
88
+ it 'should not change existing list of sources' do
89
+ define 'foo' do
90
+ compile.from('sources')
91
+ lambda { compile.using(:groovyc) }.should_not change { compile.sources }
92
+ end
93
+ end
94
+
95
+ it 'should compile groovy sources' do
96
+ write 'src/main/groovy/some/Example.groovy', 'package some; class Example { static main(args) { println "Hello" } }'
97
+ define('foo').compile.invoke
98
+ file('target/classes/some/Example.class').should exist
99
+ end
100
+
101
+ it 'should include as classpath dependency' do
102
+ write 'src/bar/groovy/some/Foo.groovy', 'package some; interface Foo {}'
103
+ write 'src/main/groovy/some/Example.groovy', 'package some; class Example implements Foo { }'
104
+ define('bar', :version => '1.0') do
105
+ compile.from('src/bar/groovy').into('target/bar')
106
+ package(:jar)
107
+ end
108
+ lambda { define('foo').compile.with(project('bar').package(:jar)).invoke }.should run_task('foo:compile')
109
+ file('target/classes/some/Example.class').should exist
110
+ end
111
+
112
+ it 'should cross compile java sources' do
113
+ write 'src/main/java/some/Foo.java', 'package some; public interface Foo { public void hello(); }'
114
+ write 'src/main/java/some/Baz.java', 'package some; public class Baz extends Bar { }'
115
+ write 'src/main/groovy/some/Bar.groovy', 'package some; class Bar implements Foo { def void hello() { } }'
116
+ define('foo').compile.invoke
117
+ %w{Foo Bar Baz}.each { |f| file("target/classes/some/#{f}.class").should exist }
118
+ end
119
+
120
+ it 'should cross compile test java sources' do
121
+ write 'src/test/java/some/Foo.java', 'package some; public interface Foo { public void hello(); }'
122
+ write 'src/test/java/some/Baz.java', 'package some; public class Baz extends Bar { }'
123
+ write 'src/test/groovy/some/Bar.groovy', 'package some; class Bar implements Foo { def void hello() { } }'
124
+ define('foo').test.compile.invoke
125
+ %w{Foo Bar Baz}.each { |f| file("target/test/classes/some/#{f}.class").should exist }
126
+ end
127
+
128
+ it 'should package classes into a jar file' do
129
+ write 'src/main/groovy/some/Example.groovy', 'package some; class Example { }'
130
+ define('foo', :version => '1.0').package.invoke
131
+ file('target/foo-1.0.jar').should exist
132
+ Zip::ZipFile.open(project('foo').package(:jar).to_s) do |jar|
133
+ jar.file.exist?('some/Example.class').should be_true
134
+ end
135
+ end
136
+
137
+ end
138
+
139
+ describe 'groovyc compiler options' do
140
+
141
+ def groovyc(&prc)
142
+ define('foo') do
143
+ compile.using(:groovyc)
144
+ @compiler = compile.instance_eval { @compiler }
145
+ class << @compiler
146
+ public :groovyc_options, :javac_options
147
+ end
148
+ if block_given?
149
+ instance_eval(&prc)
150
+ else
151
+ return compile
152
+ end
153
+ end
154
+ end
155
+
156
+ it 'should set warning option to false by default' do
157
+ groovyc do
158
+ compile.options.warnings.should be_false
159
+ @compiler.javac_options[:nowarn].should be_true
160
+ end
161
+ end
162
+
163
+ it 'should set warning option to true when running with --verbose option' do
164
+ verbose true
165
+ groovyc do
166
+ compile.options.warnings.should be_true
167
+ @compiler.javac_options[:nowarn].should be_false
168
+ end
169
+ end
170
+
171
+ it 'should not set verbose option by default' do
172
+ groovyc.options.verbose.should be_false
173
+ end
174
+
175
+ it 'should set verbose option when running with --trace option' do
176
+ trace true
177
+ groovyc.options.verbose.should be_true
178
+ end
179
+
180
+ it 'should set debug option to false based on Buildr.options' do
181
+ Buildr.options.debug = false
182
+ groovyc.options.debug.should be_false
183
+ end
184
+
185
+ it 'should set debug option to false based on debug environment variable' do
186
+ ENV['debug'] = 'no'
187
+ groovyc.options.debug.should be_false
188
+ end
189
+
190
+ it 'should set debug option to false based on DEBUG environment variable' do
191
+ ENV['DEBUG'] = 'no'
192
+ groovyc.options.debug.should be_false
193
+ end
194
+
195
+ it 'should set deprecation option to false by default' do
196
+ groovyc.options.deprecation.should be_false
197
+ end
198
+
199
+ it 'should use deprecation argument when deprecation is true' do
200
+ groovyc do
201
+ compile.using(:deprecation=>true)
202
+ compile.options.deprecation.should be_true
203
+ @compiler.javac_options[:deprecation].should be_true
204
+ end
205
+ end
206
+
207
+ it 'should not use deprecation argument when deprecation is false' do
208
+ groovyc do
209
+ compile.using(:deprecation=>false)
210
+ compile.options.deprecation.should be_false
211
+ @compiler.javac_options[:deprecation].should_not be_true
212
+ end
213
+ end
214
+
215
+ it 'should set optimise option to false by default' do
216
+ groovyc.options.optimise.should be_false
217
+ end
218
+
219
+ it 'should use optimize argument when deprecation is true' do
220
+ groovyc do
221
+ compile.using(:optimise=>true)
222
+ @compiler.javac_options[:optimize].should be_true
223
+ end
224
+ end
225
+
226
+ it 'should not use optimize argument when deprecation is false' do
227
+ groovyc do
228
+ compile.using(:optimise=>false)
229
+ @compiler.javac_options[:optimize].should be_false
230
+ end
231
+ end
232
+
233
+ after do
234
+ Buildr.options.debug = nil
235
+ ENV.delete "debug"
236
+ ENV.delete "DEBUG"
237
+ end
238
+
239
+ end
@@ -0,0 +1,238 @@
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.join(File.dirname(__FILE__), 'spec_helpers')
17
+
18
+ describe Buildr::RSpec do
19
+
20
+ def foo(*args, &prc)
21
+ define('foo', *args) do
22
+ test.using :rspec
23
+ if prc
24
+ instance_eval(&prc)
25
+ else
26
+ self
27
+ end
28
+ end
29
+ end
30
+
31
+ it 'should be selected by :rspec name' do
32
+ foo { test.framework.should eql(:rspec) }
33
+ end
34
+
35
+ it 'should include src/spec/ruby/**/*_spec.rb' do
36
+ verbose true
37
+ foo do
38
+ spec = _(:source, :spec, :ruby, 'some_spec.rb')
39
+ write spec, ''
40
+ test.invoke
41
+ test.tests.should include(spec)
42
+ end
43
+ end
44
+
45
+
46
+ end if PLATFORM =~ /java/ # RSpec
47
+
48
+ describe Buildr::JtestR do
49
+
50
+ def foo(*args, &prc)
51
+ define('foo', *args) do
52
+ test.using :jtestr
53
+ if prc
54
+ instance_eval(&prc)
55
+ else
56
+ self
57
+ end
58
+ end
59
+ end
60
+
61
+ it 'should be selected by :jtestr name' do
62
+ foo { test.framework.should eql(:jtestr) }
63
+ end
64
+
65
+ it 'should include src/spec/ruby/**/*_spec.rb'
66
+ it 'should auto generate jtestr configuration'
67
+ it 'should run runit test cases'
68
+ it 'should use a java compiler if java sources found'
69
+ it 'should run junit test cases'
70
+
71
+ end # JtestR
72
+
73
+ describe Buildr::JBehave do
74
+ def foo(*args, &prc)
75
+ define('foo', *args) do
76
+ test.using :jbehave
77
+ if prc
78
+ instance_eval(&prc)
79
+ else
80
+ self
81
+ end
82
+ end
83
+ end
84
+
85
+ it 'should apply to projects having JBehave sources' do
86
+ define('one', :base_dir => 'one') do
87
+ write _(:source, :spec, :java, 'SomeBehaviour.java'), 'public class SomeBehaviour {}'
88
+ JBehave.applies_to?(self).should be_true
89
+ end
90
+ define('two', :base_dir => 'two') do
91
+ write _(:source, :test, :java, 'SomeBehaviour.java'), 'public class SomeBehaviour {}'
92
+ JBehave.applies_to?(self).should be_false
93
+ end
94
+ define('three', :base_dir => 'three') do
95
+ write _(:source, :spec, :java, 'SomeBehavior.java'), 'public class SomeBehavior {}'
96
+ JBehave.applies_to?(self).should be_true
97
+ end
98
+ define('four', :base_dir => 'four') do
99
+ write _(:source, :test, :java, 'SomeBehavior.java'), 'public class SomeBehavior {}'
100
+ JBehave.applies_to?(self).should be_false
101
+ end
102
+ end
103
+
104
+ it 'should be selected by :jbehave name' do
105
+ foo { test.framework.should eql(:jbehave) }
106
+ end
107
+
108
+ it 'should select a java compiler for its sources' do
109
+ foo do
110
+ write _(:source, :spec, :java, 'SomeBehavior.java'), 'public class SomeBehavior {}'
111
+ test.compile.language.should eql(:java)
112
+ end
113
+ end
114
+
115
+ it 'should include JBehave dependencies' do
116
+ foo do
117
+ test.compile.dependencies.should include(*artifacts(JBehave::REQUIRES))
118
+ test.dependencies.should include(*artifacts(JBehave::REQUIRES))
119
+ end
120
+ end
121
+
122
+ it 'should include JMock dependencies' do
123
+ foo do
124
+ test.compile.dependencies.should include(*artifacts(JMock::REQUIRES))
125
+ test.dependencies.should include(*artifacts(JMock::REQUIRES))
126
+ end
127
+ end
128
+
129
+ it 'should include classes whose name ends with Behavior' do
130
+ write 'src/spec/java/some/FooBehavior.java', <<-JAVA
131
+ package some;
132
+ public class FooBehavior {
133
+ public void shouldFoo() { assert true; }
134
+ }
135
+ JAVA
136
+ write 'src/spec/java/some/NotATest.java', <<-JAVA
137
+ package some;
138
+ public class NotATest { }
139
+ JAVA
140
+ foo.tap do |project|
141
+ project.test.invoke
142
+ project.test.tests.should include('some.FooBehavior')
143
+ end
144
+ end
145
+
146
+
147
+ it 'should include classes implementing Behaviours' do
148
+ write 'src/spec/java/some/MyBehaviours.java', <<-JAVA
149
+ package some;
150
+ public class MyBehaviours implements
151
+ org.jbehave.core.behaviour.Behaviours {
152
+ public Class[] getBehaviours() {
153
+ return new Class[] { some.FooBehave.class };
154
+ }
155
+ }
156
+ JAVA
157
+ write 'src/spec/java/some/FooBehave.java', <<-JAVA
158
+ package some;
159
+ public class FooBehave {
160
+ public void shouldFoo() { assert true; }
161
+ }
162
+ JAVA
163
+ write 'src/spec/java/some/NotATest.java', <<-JAVA
164
+ package some;
165
+ public class NotATest { }
166
+ JAVA
167
+ foo.tap do |project|
168
+ project.test.invoke
169
+ project.test.tests.should include('some.MyBehaviours')
170
+ end
171
+ end
172
+
173
+ end # JBehave
174
+
175
+ describe Buildr::EasyB do
176
+
177
+ def foo(*args, &prc)
178
+ define('foo', *args) do
179
+ test.using :easyb
180
+ if prc
181
+ instance_eval(&prc)
182
+ else
183
+ self
184
+ end
185
+ end
186
+ end
187
+
188
+ it 'should apply to a project having EasyB sources' do
189
+ define('one', :base_dir => 'one') do
190
+ write _(:source, :spec, :groovy, 'SomeBehaviour.groovy'), 'true;'
191
+ EasyB.applies_to?(self).should be_true
192
+ end
193
+ define('two', :base_dir => 'two') do
194
+ write _(:source, :test, :groovy, 'SomeBehaviour.groovy'), 'true;'
195
+ EasyB.applies_to?(self).should be_false
196
+ end
197
+ define('three', :base_dir => 'three') do
198
+ write _(:source, :spec, :groovy, 'SomeStory.groovy'), 'true;'
199
+ EasyB.applies_to?(self).should be_true
200
+ end
201
+ define('four', :base_dir => 'four') do
202
+ write _(:source, :test, :groovy, 'SomeStory.groovy'), 'true;'
203
+ EasyB.applies_to?(self).should be_false
204
+ end
205
+ end
206
+
207
+ it 'should be selected by :easyb name' do
208
+ foo { test.framework.should eql(:easyb) }
209
+ end
210
+
211
+ it 'should select a java compiler if java sources are found' do
212
+ foo do
213
+ write _(:source, :spec, :java, 'SomeBehavior.java'), 'public class SomeBehavior {}'
214
+ test.compile.language.should eql(:java)
215
+ end
216
+ end
217
+
218
+ it 'should include src/spec/groovy/*Behavior.groovy' do
219
+ foo do
220
+ spec = _(:source, :spec, :groovy, 'SomeBehavior.groovy')
221
+ write spec, 'true'
222
+ test.invoke
223
+ test.tests.should include(spec)
224
+ end
225
+ end
226
+
227
+ it 'should include src/spec/groovy/*Story.groovy' do
228
+ foo do
229
+ spec = _(:source, :spec, :groovy, 'SomeStory.groovy')
230
+ write spec, 'true'
231
+ test.invoke
232
+ test.tests.should include(spec)
233
+ end
234
+ end
235
+
236
+ end # EasyB
237
+
238
+