buildr 1.3.4 → 1.3.5
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 +35 -0
- data/README.rdoc +1 -1
- data/Rakefile +1 -1
- data/buildr.buildfile +6 -1
- data/buildr.gemspec +10 -9
- data/doc/_config.yml +1 -0
- data/doc/_layouts/default.html +25 -19
- data/doc/artifacts.textile +0 -36
- data/doc/building.textile +0 -38
- data/doc/contributing.textile +51 -15
- data/doc/css/default.css +11 -4
- data/doc/css/print.css +32 -24
- data/doc/download.textile +2 -1
- data/doc/extending.textile +10 -20
- data/doc/images/1442160941-frontcover.jpg +0 -0
- data/doc/images/asf-logo.png +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/index.textile +39 -17
- data/doc/{getting_started.textile → installing.textile} +2 -67
- data/doc/languages.textile +50 -52
- data/doc/more_stuff.textile +154 -62
- data/doc/packaging.textile +0 -82
- data/doc/preface.textile +41 -15
- data/doc/projects.textile +0 -18
- data/doc/quick_start.textile +210 -0
- data/doc/scripts/install-linux.sh +10 -2
- data/doc/settings_profiles.textile +1 -33
- data/doc/testing.textile +6 -32
- data/lib/buildr.rb +2 -1
- data/lib/buildr/core.rb +6 -0
- data/lib/buildr/core/application.rb +2 -5
- data/lib/buildr/core/build.rb +29 -19
- data/lib/buildr/core/compile.rb +22 -4
- data/lib/buildr/core/filter.rb +2 -4
- data/lib/buildr/core/project.rb +5 -4
- data/lib/buildr/core/shell.rb +198 -0
- data/lib/buildr/core/test.rb +2 -0
- data/lib/buildr/core/transports.rb +18 -19
- data/lib/buildr/core/util.rb +178 -9
- data/lib/buildr/groovy.rb +1 -0
- data/lib/buildr/groovy/bdd.rb +5 -5
- data/lib/buildr/groovy/shell.rb +48 -0
- data/lib/buildr/ide/eclipse.rb +148 -36
- 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/java/bdd.rb +16 -8
- data/lib/buildr/java/cobertura.rb +44 -13
- data/lib/buildr/java/commands.rb +5 -3
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +18 -0
- data/lib/buildr/java/packaging.rb +2 -2
- data/lib/buildr/java/rjb.rb +1 -1
- data/lib/buildr/java/test_result.rb +48 -1
- data/lib/buildr/java/tests.rb +8 -5
- data/lib/buildr/packaging/artifact_namespace.rb +1 -1
- data/lib/buildr/packaging/package.rb +6 -2
- data/lib/buildr/packaging/zip.rb +10 -1
- data/lib/buildr/packaging/ziptask.rb +5 -2
- data/lib/buildr/scala.rb +1 -0
- data/lib/buildr/scala/bdd.rb +17 -8
- data/lib/buildr/scala/compiler.rb +66 -21
- 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 +6 -5
- data/lib/buildr/shell.rb +180 -0
- data/rakelib/doc.rake +2 -3
- data/rakelib/jekylltask.rb +42 -32
- data/rakelib/package.rake +4 -2
- data/rakelib/rspec.rake +3 -3
- data/rakelib/setup.rake +7 -1
- data/rakelib/stage.rake +9 -2
- data/rakelib/stage.rake~ +213 -0
- data/spec/core/application_spec.rb +84 -1
- data/spec/core/build_spec.rb +54 -2
- data/spec/core/common_spec.rb +1 -1
- data/spec/core/compile_spec.rb +2 -1
- data/spec/core/extension_spec.rb +93 -0
- data/spec/core/test_spec.rb +2 -2
- data/spec/core/transport_spec.rb +1 -1
- data/spec/groovy/bdd_spec.rb +6 -6
- data/spec/groovy/compiler_spec.rb +1 -0
- data/spec/ide/eclipse_spec.rb +262 -72
- data/spec/java/{ant.rb → ant_spec.rb} +0 -0
- data/spec/java/bdd_spec.rb +15 -0
- data/spec/java/cobertura_spec.rb +9 -1
- data/spec/java/emma_spec.rb +1 -1
- data/spec/java/java_spec.rb +26 -0
- data/spec/java/packaging_spec.rb +9 -7
- data/spec/java/{test_coverage_spec.rb → test_coverage_helper.rb} +6 -4
- data/spec/java/tests_spec.rb +22 -0
- data/spec/packaging/archive_spec.rb +14 -0
- data/spec/packaging/artifact_spec.rb +2 -2
- data/spec/packaging/packaging_spec.rb +97 -2
- data/spec/sandbox.rb +3 -1
- data/spec/scala/bdd_spec.rb +17 -48
- data/spec/scala/compiler_spec.rb +31 -2
- data/spec/scala/tests_spec.rb +1 -0
- data/spec/spec_helpers.rb +12 -0
- metadata +145 -148
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
layout: default
|
|
3
|
-
title:
|
|
3
|
+
title: Installing and Running
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
|
|
@@ -20,7 +20,7 @@ The Ruby interpreter and JVM must use compatible architectures. For example, OS
|
|
|
20
20
|
|
|
21
21
|
h2(#linux). Installing on Linux
|
|
22
22
|
|
|
23
|
-
*The easy way:* Use this bash script to "install Buildr on Linux":scripts/install-linux.sh. This script will install the most recent version of Buildr, or if already installed, upgrade to the most recent version. It will also install Ruby 1.8.6 if not already installed (requires @apt-get@ or @
|
|
23
|
+
*The easy way:* Use this bash script to "install Buildr on Linux":scripts/install-linux.sh. This script will install the most recent version of Buildr, or if already installed, upgrade to the most recent version. It will also install Ruby 1.8.6 if not already installed (requires @apt-get@, @yum@ or @urpmi@) and upgrade to RubyGems 1.3.1 or later.
|
|
24
24
|
|
|
25
25
|
p(note). At this time, the native Ruby-Java Bridge (RJB) does not work very well on Linux with JDK 1.6. If you get Segmentation Fault errors with JDK 1.6, we recommend switching to JDK 1.5.
|
|
26
26
|
|
|
@@ -30,24 +30,19 @@ p(note). At this time, the native Ruby-Java Bridge (RJB) does not work very well
|
|
|
30
30
|
|
|
31
31
|
On *RedHat/Fedora* you can use yum to install Ruby and RubyGems, and then upgrade to the most recent version of RubyGems:
|
|
32
32
|
|
|
33
|
-
<notextile>
|
|
34
33
|
{% highlight sh %}
|
|
35
34
|
$ sudo yum install ruby rubygems ruby-devel gcc
|
|
36
35
|
$ sudo gem update --system
|
|
37
36
|
{% endhighlight %}
|
|
38
|
-
</notextile>
|
|
39
37
|
|
|
40
38
|
On *Ubuntu* you have to install several packages:
|
|
41
39
|
|
|
42
|
-
<notextile>
|
|
43
40
|
{% highlight sh %}
|
|
44
41
|
$ sudo apt-get install ruby-full ruby1.8-dev libopenssl-ruby build-essential
|
|
45
42
|
{% endhighlight %}
|
|
46
|
-
</notextile>
|
|
47
43
|
|
|
48
44
|
The Debian package for @rubygems@ will not allow you to install Buildr, so you need to install RubyGems from source:
|
|
49
45
|
|
|
50
|
-
<notextile>
|
|
51
46
|
{% highlight sh %}
|
|
52
47
|
$ wget http://rubyforge.org/frs/download.php/45905/rubygems-1.3.1.tgz
|
|
53
48
|
$ tar xzf rubygems-1.3.1.tgz
|
|
@@ -55,24 +50,19 @@ $ cd rubygems-1.3.1
|
|
|
55
50
|
$ sudo ruby setup.rb
|
|
56
51
|
$ sudo ln -s /usr/bin/gem1.8 /usr/bin/gem
|
|
57
52
|
{% endhighlight %}
|
|
58
|
-
</notextile>
|
|
59
53
|
|
|
60
54
|
Before installing Buildr, please set the @JAVA_HOME@ environment variable to point to your JDK distribution. Next, use Ruby Gem to install Buildr:
|
|
61
55
|
|
|
62
|
-
<notextile>
|
|
63
56
|
{% highlight sh %}
|
|
64
57
|
$ sudo env JAVA_HOME=$JAVA_HOME gem install buildr
|
|
65
58
|
{% endhighlight %}
|
|
66
|
-
</notextile>
|
|
67
59
|
|
|
68
60
|
To upgrade to a new version or install a specific version:
|
|
69
61
|
|
|
70
|
-
<notextile>
|
|
71
62
|
{% highlight sh %}
|
|
72
63
|
$ sudo env JAVA_HOME=$JAVA_HOME gem update buildr
|
|
73
64
|
$ sudo env JAVA_HOME=$JAVA_HOME gem install buildr -v 1.3.4
|
|
74
65
|
{% endhighlight %}
|
|
75
|
-
</notextile>
|
|
76
66
|
|
|
77
67
|
|
|
78
68
|
|
|
@@ -88,36 +78,28 @@ OS X 10.4 (Tiger) includes an older version of Ruby that is not compatible with
|
|
|
88
78
|
|
|
89
79
|
We recommend you first upgrade to the latest version of Ruby gems:
|
|
90
80
|
|
|
91
|
-
<notextile>
|
|
92
81
|
{% highlight sh %}
|
|
93
82
|
$ sudo gem update --system
|
|
94
83
|
{% endhighlight %}
|
|
95
|
-
</notextile>
|
|
96
84
|
|
|
97
85
|
Before installing Buildr, please set the @JAVA_HOME@ environment variable to point to your JDK distribution:
|
|
98
86
|
|
|
99
|
-
<notextile>
|
|
100
87
|
{% highlight sh %}
|
|
101
88
|
$ export JAVA_HOME=/Library/Java/Home
|
|
102
89
|
{% endhighlight %}
|
|
103
|
-
</notextile>
|
|
104
90
|
|
|
105
91
|
To install Buildr:
|
|
106
92
|
|
|
107
|
-
<notextile>
|
|
108
93
|
{% highlight sh %}
|
|
109
94
|
$ sudo env JAVA_HOME=$JAVA_HOME gem install buildr
|
|
110
95
|
{% endhighlight %}
|
|
111
|
-
</notextile>
|
|
112
96
|
|
|
113
97
|
To upgrade to a new version or install a specific version:
|
|
114
98
|
|
|
115
|
-
<notextile>
|
|
116
99
|
{% highlight sh %}
|
|
117
100
|
$ sudo env JAVA_HOME=$JAVA_HOME gem update buildr
|
|
118
101
|
$ sudo env JAVA_HOME=$JAVA_HOME gem install buildr -v 1.3.4
|
|
119
102
|
{% endhighlight %}
|
|
120
|
-
</notextile>
|
|
121
103
|
|
|
122
104
|
|
|
123
105
|
h2(#windows). Installing on Windows
|
|
@@ -128,28 +110,22 @@ h2(#windows). Installing on Windows
|
|
|
128
110
|
|
|
129
111
|
*In details:* We recommend you first upgrade to the latest version of Ruby gems:
|
|
130
112
|
|
|
131
|
-
<notextile>
|
|
132
113
|
{% highlight sh %}
|
|
133
114
|
> gem update --system
|
|
134
115
|
{% endhighlight %}
|
|
135
|
-
</notextile>
|
|
136
116
|
|
|
137
117
|
Before installing Buildr, please set the @JAVA_HOME@ environment variable to point to your JDK distribution. Next, use Ruby Gem to install Buildr:
|
|
138
118
|
|
|
139
|
-
<notextile>
|
|
140
119
|
{% highlight sh %}
|
|
141
120
|
> gem install buildr
|
|
142
121
|
{% endhighlight %}
|
|
143
|
-
</notextile>
|
|
144
122
|
|
|
145
123
|
To upgrade to a new version or install a specific version:
|
|
146
124
|
|
|
147
|
-
<notextile>
|
|
148
125
|
{% highlight sh %}
|
|
149
126
|
> gem update buildr
|
|
150
127
|
> gem install buildr -v 1.3.4
|
|
151
128
|
{% endhighlight %}
|
|
152
|
-
</notextile>
|
|
153
129
|
|
|
154
130
|
|
|
155
131
|
h2(#jruby). Installing for JRuby
|
|
@@ -164,30 +140,24 @@ After uncompressing JRuby, update your @PATH@ to include both @java@ and @jruby@
|
|
|
164
140
|
|
|
165
141
|
For Linux and OS X:
|
|
166
142
|
|
|
167
|
-
<notextile>
|
|
168
143
|
{% highlight sh %}
|
|
169
144
|
$ export PATH=$PATH:[path to JRuby]/bin:$JAVA_HOME/bin
|
|
170
145
|
$ jruby -S gem install buildr
|
|
171
146
|
{% endhighlight %}
|
|
172
|
-
</notextile>
|
|
173
147
|
|
|
174
148
|
For Windows:
|
|
175
149
|
|
|
176
|
-
<notextile>
|
|
177
150
|
{% highlight sh %}
|
|
178
151
|
> set PATH=%PATH%;[path to JRuby]/bin;%JAVA_HOME%/bin
|
|
179
152
|
> jruby -S gem install buildr
|
|
180
153
|
{% endhighlight %}
|
|
181
|
-
</notextile>
|
|
182
154
|
|
|
183
155
|
To upgrade to a new version or install a specific version:
|
|
184
156
|
|
|
185
|
-
<notextile>
|
|
186
157
|
{% highlight sh %}
|
|
187
158
|
$ jruby -S gem update buildr
|
|
188
159
|
$ jruby -S gem install buildr -v 1.3.4
|
|
189
160
|
{% endhighlight %}
|
|
190
|
-
</notextile>
|
|
191
161
|
|
|
192
162
|
|
|
193
163
|
*Important: Running JRuby and Ruby side by side*
|
|
@@ -200,7 +170,6 @@ To work exclusively with JRuby, make sure it shows first on the path, for exampl
|
|
|
200
170
|
|
|
201
171
|
You can use JRuby and Ruby side by side, by running scripts with the @-S@ command line argument. For example:
|
|
202
172
|
|
|
203
|
-
<notextile>
|
|
204
173
|
{% highlight sh %}
|
|
205
174
|
$ # with Ruby
|
|
206
175
|
$ ruby -S gem install buildr
|
|
@@ -209,34 +178,10 @@ $ # with JRuby
|
|
|
209
178
|
$ jruby -S gem install buildr
|
|
210
179
|
$ jruby -S buildr
|
|
211
180
|
{% endhighlight %}
|
|
212
|
-
</notextile>
|
|
213
181
|
|
|
214
182
|
Run @buildr --version@ from the command line to find which version of Buildr you are using by default. If you see @(JRuby ...)@, Buildr is running on that version of JRuby.
|
|
215
183
|
|
|
216
184
|
|
|
217
|
-
h2(#conventions). Document Conventions
|
|
218
|
-
|
|
219
|
-
Lines that start with @$@ are command lines, for example:
|
|
220
|
-
|
|
221
|
-
<notextile>
|
|
222
|
-
{% highlight sh %}
|
|
223
|
-
$ # Run Buildr
|
|
224
|
-
$ buildr
|
|
225
|
-
{% endhighlight %}
|
|
226
|
-
</notextile>
|
|
227
|
-
|
|
228
|
-
Lines that start with @=>@ show output from the console or the result of a method, for example:
|
|
229
|
-
|
|
230
|
-
<notextile>
|
|
231
|
-
{% highlight sh %}
|
|
232
|
-
puts 'Hello world'
|
|
233
|
-
=> "Hello world"
|
|
234
|
-
{% endhighlight %}
|
|
235
|
-
</notextile>
|
|
236
|
-
|
|
237
|
-
And as you guessed, everything else is Buildfile Ruby or Java code. You can figure out which language is which.
|
|
238
|
-
|
|
239
|
-
|
|
240
185
|
h2(#running). Running Buildr
|
|
241
186
|
|
|
242
187
|
You need a *Buildfile*, a build script that tells Buildr all about the projects it's building, what they contain, what to produce, and so on. The Buildfile resides in the root directory of your project. We'll talk more about it in "the next chapter":projects.html. If you don't already have one, ask Buildr to create it by running @buildr@.
|
|
@@ -245,11 +190,9 @@ p(tip). You'll notice that Buildr creates a file called @buildfile@. It's case
|
|
|
245
190
|
|
|
246
191
|
You use Buildr by running the @buildr@ command:
|
|
247
192
|
|
|
248
|
-
<notextile>
|
|
249
193
|
{% highlight sh %}
|
|
250
194
|
$ buildr [options] [tasks] [name=value]
|
|
251
195
|
{% endhighlight %}
|
|
252
|
-
</notextile>
|
|
253
196
|
|
|
254
197
|
There are several options you can use, for a full list of options type @buildr --help@:
|
|
255
198
|
|
|
@@ -266,14 +209,12 @@ There are several options you can use, for a full list of options type @buildr -
|
|
|
266
209
|
|
|
267
210
|
You can tell Buildr to run specific tasks and the order to run them. For example:
|
|
268
211
|
|
|
269
|
-
<notextile>
|
|
270
212
|
{% highlight sh %}
|
|
271
213
|
# Clean and rebuild
|
|
272
214
|
buildr clean build
|
|
273
215
|
# Package and install
|
|
274
216
|
buildr install
|
|
275
217
|
{% endhighlight %}
|
|
276
|
-
</notextile>
|
|
277
218
|
|
|
278
219
|
If you don't specify a task, Buildr will run the "@build@ task":building.html, compiling source code and running test cases. Running a task may run other tasks as well, for example, running the @install@ task will also run @package@.
|
|
279
220
|
|
|
@@ -281,12 +222,10 @@ There are several "environment variables":settings_profiles.html#env_vars that l
|
|
|
281
222
|
|
|
282
223
|
For example:
|
|
283
224
|
|
|
284
|
-
<notextile>
|
|
285
225
|
{% highlight sh %}
|
|
286
226
|
$ export JAVA_OPTS='-Xms1g -Xmx1g'
|
|
287
227
|
$ buildr TEST=no
|
|
288
228
|
{% endhighlight %}
|
|
289
|
-
</notextile>
|
|
290
229
|
|
|
291
230
|
|
|
292
231
|
h2(#help). Help Tasks
|
|
@@ -295,15 +234,12 @@ Buildr includes a number of informative tasks. Currently that number stands at
|
|
|
295
234
|
|
|
296
235
|
To start with, type:
|
|
297
236
|
|
|
298
|
-
<notextile>
|
|
299
237
|
{% highlight sh %}
|
|
300
238
|
$ buildr help
|
|
301
239
|
{% endhighlight %}
|
|
302
|
-
</notextile>
|
|
303
240
|
|
|
304
241
|
You can list the name and description of all your projects using the @help:projects@ task. For example:
|
|
305
242
|
|
|
306
|
-
<notextile>
|
|
307
243
|
{% highlight sh %}
|
|
308
244
|
$ buildr help:projects
|
|
309
245
|
killer-app # Code. Build. ??? Profit!
|
|
@@ -311,7 +247,6 @@ killer-app:teh-api # Abstract classes and interfaces
|
|
|
311
247
|
killer-app:teh-impl # All those implementation details
|
|
312
248
|
killer-app:la-web # What our users see
|
|
313
249
|
{% endhighlight %}
|
|
314
|
-
</notextile>
|
|
315
250
|
|
|
316
251
|
You are, of course, describing your projects for the sake of those who will maintain your code, right? To describe a project, or a task, call the @desc@ method before the project or task definition.
|
|
317
252
|
|
data/doc/languages.textile
CHANGED
|
@@ -46,11 +46,9 @@ The JUnit test framework supports the following options:
|
|
|
46
46
|
|
|
47
47
|
For example, to pass properties to the test case:
|
|
48
48
|
|
|
49
|
-
<notextile>
|
|
50
49
|
{% highlight ruby %}
|
|
51
50
|
test.using :properties=>{ :currency=>'USD' }
|
|
52
51
|
{% endhighlight %}
|
|
53
|
-
</notextile>
|
|
54
52
|
|
|
55
53
|
There are benefits to running test cases in separate VMs. The default forking mode is @:once@, and you can change it by setting the @:fork@ option.
|
|
56
54
|
|
|
@@ -63,34 +61,28 @@ You can see your tests running in the console, and if any tests fail, Buildr wil
|
|
|
63
61
|
|
|
64
62
|
In addition, you can get a consolidated XML or HTML report by running the @junit:report@ task. For example:
|
|
65
63
|
|
|
66
|
-
<notextile>
|
|
67
64
|
{% highlight sh %}
|
|
68
65
|
$ buildr test junit:report test=all
|
|
69
66
|
$ firefox report/junit/html/index.html
|
|
70
67
|
{% endhighlight %}
|
|
71
|
-
</notextile>
|
|
72
68
|
|
|
73
69
|
The @junit:report@ task generates a report from all tests run so far. If you run tests in a couple of projects, it will generate a report only for these two projects. The example above runs tests in all the projects before generating the reports.
|
|
74
70
|
|
|
75
71
|
You can use the @build.yaml@ settings file to specify a particular version of JUnit or JMock. For example, to force your build to use JUnit version 4.4 and JMock 2.0:
|
|
76
72
|
|
|
77
|
-
<notextile>
|
|
78
73
|
{% highlight yaml %}
|
|
79
74
|
junit: 4.4
|
|
80
75
|
jmock: 2.0
|
|
81
76
|
{% endhighlight %}
|
|
82
|
-
</notextile>
|
|
83
77
|
|
|
84
78
|
|
|
85
79
|
h4. TestNG
|
|
86
80
|
|
|
87
81
|
You can use "TestNG":http://testng.org instead of JUnit. To select TestNG as the test framework, add this to your project:
|
|
88
82
|
|
|
89
|
-
<notextile>
|
|
90
83
|
{% highlight ruby %}
|
|
91
84
|
test.using :testng
|
|
92
85
|
{% endhighlight %}
|
|
93
|
-
</notextile>
|
|
94
86
|
|
|
95
87
|
Like all other options you can set with @test.using@, it affects the projects and all its sub-projects, so you only need to do this once at the top-most project to use TestNG throughout. You can also mix TestNG and JUnit by setting different projects to use different frameworks, but you can't mix both frameworks in the same project. (And yes, @test.using :junit@ will switch a project back to using JUnit)
|
|
96
88
|
|
|
@@ -104,11 +96,9 @@ The TestNG test framework supports the following options:
|
|
|
104
96
|
|
|
105
97
|
You can use the @build.yaml@ settings file to specify a particular version of TestNG, for example, to force your build to use TestNG 5.7:
|
|
106
98
|
|
|
107
|
-
<notextile>
|
|
108
99
|
{% highlight yaml %}
|
|
109
100
|
testng: 5.7
|
|
110
101
|
{% endhighlight %}
|
|
111
|
-
</notextile>
|
|
112
102
|
|
|
113
103
|
|
|
114
104
|
h4. JBehave
|
|
@@ -119,11 +109,9 @@ To use JBehave in your project you can select it with @test.using :jbehave@.
|
|
|
119
109
|
|
|
120
110
|
This framework will search for the following patterns under your project:
|
|
121
111
|
|
|
122
|
-
<notextile>
|
|
123
112
|
{% highlight text %}
|
|
124
113
|
src/spec/java/**/*Behaviour.java
|
|
125
114
|
{% endhighlight %}
|
|
126
|
-
</notextile>
|
|
127
115
|
|
|
128
116
|
Supports the following options:
|
|
129
117
|
|
|
@@ -133,42 +121,55 @@ Supports the following options:
|
|
|
133
121
|
|
|
134
122
|
You can use the @build.yaml@ settings file to specify a particular version of JBehave, for example, to force your build to use JBehave 1.0.1:
|
|
135
123
|
|
|
136
|
-
<notextile>
|
|
137
124
|
{% highlight yaml %}
|
|
138
125
|
jbehave: 1.0.1
|
|
139
126
|
{% endhighlight %}
|
|
140
|
-
</notextile>
|
|
141
127
|
|
|
142
128
|
|
|
143
129
|
h2(#scala). Scala
|
|
144
130
|
|
|
145
|
-
Before using Scala
|
|
131
|
+
Before using Scala, you must first @require@ the Scala compiler:
|
|
146
132
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
<notextile>
|
|
150
|
-
{% highlight sh %}
|
|
151
|
-
> set SCALA_HOME=C:\Path\To\Scala-2.7.3
|
|
133
|
+
{% highlight ruby %}
|
|
134
|
+
require 'buildr/scala'
|
|
152
135
|
{% endhighlight %}
|
|
153
|
-
</notextile>
|
|
154
136
|
|
|
155
|
-
|
|
137
|
+
By default, Buildr will attempt to use any version of Scala which is already
|
|
138
|
+
installed on your system. However, Buildr isn't *quite* smart enough to intuit
|
|
139
|
+
such things on its own, so for most cases, it requires the @SCALA_HOME@
|
|
140
|
+
environment variable to be set pointing to the root of the Scala installation
|
|
141
|
+
(e.g. @/usr/local/scala-2.7.5.final@). The only exception to this is if you have
|
|
142
|
+
installed Scala via "MacPorts":http://www.macports.org/ Buildr will look in the
|
|
143
|
+
@/opt/local/share/scala/@ directory *before* it uses the @SCALA_HOME@ envar.
|
|
144
|
+
|
|
145
|
+
However, if @SCALA_HOME@ is not set, or if it points to an invalid Scala
|
|
146
|
+
installation, then Buildr has a fallback option. The Scala compiler and standard
|
|
147
|
+
library are both available from the "Scala Tools repository":http://scala-tools.org/.
|
|
148
|
+
If no other Scala installation can be found, Buildr will download the appropriate
|
|
149
|
+
artifacts and use them instead of a full install. The only drawback to this
|
|
150
|
+
approach is the FSC compiler is *not* available when Scala has been downloaded
|
|
151
|
+
in this fashion.
|
|
152
|
+
|
|
153
|
+
When Scala is downloaded from the Maven2 repository, Buildr will attempt to use
|
|
154
|
+
the very latest version (starting from version 2.7.5). If you wish to override
|
|
155
|
+
this default, you will need to make use of the @artifact_ns@ construct *before*
|
|
156
|
+
you @require@ Scala support in your buildfile:
|
|
156
157
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
158
|
+
{% highlight ruby %}
|
|
159
|
+
artifact_ns['Buildr::Compiler::Scalac'].library = '2.7.5'
|
|
160
|
+
|
|
161
|
+
require 'buildr/scala'
|
|
160
162
|
{% endhighlight %}
|
|
161
|
-
</notextile>
|
|
162
163
|
|
|
163
|
-
|
|
164
|
+
This snippet tells Buildr to use exactly version 2.7.5 of Scala when it downloads
|
|
165
|
+
the JARs from Scala-Tools, regardless of what the latest version may be.
|
|
164
166
|
|
|
165
|
-
|
|
167
|
+
Regardless of how Scala has been obtained, you may determine the version in use
|
|
168
|
+
by querying the @Scala.version@ attribute:
|
|
166
169
|
|
|
167
|
-
<notextile>
|
|
168
170
|
{% highlight ruby %}
|
|
169
|
-
|
|
171
|
+
Scala.version # => '2.7.5'
|
|
170
172
|
{% endhighlight %}
|
|
171
|
-
</notextile>
|
|
172
173
|
|
|
173
174
|
h3. Compiling Scala
|
|
174
175
|
|
|
@@ -207,11 +208,9 @@ h3. Testing with Scala
|
|
|
207
208
|
|
|
208
209
|
Buildr supports two main Scala testing frameworks: "ScalaTest":http://www.artima.com/scalatest and "Specs":http://code.google.com/p/specs/. "ScalaCheck":http://code.google.com/p/scalacheck/ is also supported within the confines of either of these two frameworks. Thus, your Specs may use ScalaCheck properties, as may your ScalaTest suites.
|
|
209
210
|
|
|
210
|
-
<notextile>
|
|
211
211
|
{% highlight ruby %}
|
|
212
212
|
test.using(:scalatest)
|
|
213
213
|
{% endhighlight %}
|
|
214
|
-
</notextile>
|
|
215
214
|
|
|
216
215
|
h4. ScalaTest
|
|
217
216
|
|
|
@@ -221,7 +220,6 @@ Buildr automatically detects and runs tests that extend the @org.scalatest.Suite
|
|
|
221
220
|
|
|
222
221
|
A very simplistic test class might look like,
|
|
223
222
|
|
|
224
|
-
<notextile>
|
|
225
223
|
{% highlight scala %}
|
|
226
224
|
class MySuite extends org.scalatest.FunSuite {
|
|
227
225
|
test("addition") {
|
|
@@ -230,11 +228,9 @@ class MySuite extends org.scalatest.FunSuite {
|
|
|
230
228
|
}
|
|
231
229
|
}
|
|
232
230
|
{% endhighlight %}
|
|
233
|
-
</notextile>
|
|
234
231
|
|
|
235
232
|
You can also pass properties to your tests by doing @test.using :properties => { 'name'=>'value' }@, and by overriding the @Suite.runTests@ method in a manner similar to:
|
|
236
233
|
|
|
237
|
-
<notextile>
|
|
238
234
|
{% highlight scala %}
|
|
239
235
|
import org.scalatest._
|
|
240
236
|
|
|
@@ -255,7 +251,6 @@ class PropertyTestSuite extends FunSuite {
|
|
|
255
251
|
}
|
|
256
252
|
}
|
|
257
253
|
{% endhighlight %}
|
|
258
|
-
</notextile>
|
|
259
254
|
|
|
260
255
|
h4. Specs
|
|
261
256
|
|
|
@@ -265,7 +260,6 @@ Any objects which extend the @org.specs.Specification@ superclass will be automa
|
|
|
265
260
|
|
|
266
261
|
A simple specification might look like this:
|
|
267
262
|
|
|
268
|
-
<notextile>
|
|
269
263
|
{% highlight scala %}
|
|
270
264
|
import org.specs._
|
|
271
265
|
import org.specs.runner._
|
|
@@ -273,18 +267,33 @@ import org.specs.runner._
|
|
|
273
267
|
object StringSpecs extends Specification {
|
|
274
268
|
"empty string" should {
|
|
275
269
|
"have a zero length" in {
|
|
276
|
-
|
|
270
|
+
"".length mustBe 0
|
|
277
271
|
}
|
|
278
272
|
}
|
|
279
273
|
}
|
|
280
274
|
{% endhighlight %}
|
|
281
|
-
|
|
275
|
+
|
|
276
|
+
ScalaCheck is automatically added to the classpath when Specs is used. However, JMock, Mockito, CGlib and similar are _not_. This is to avoid downloading extraneous artifacts which are only used by a small percentage of specifications. To use Specs with Mockito (or any other library) in a Buildr project, simply add the appropriate dependencies to @test.with@:
|
|
277
|
+
|
|
278
|
+
{% highlight ruby %}
|
|
279
|
+
MOCKITO = 'org.mockito:mockito-all:jar:1.7'
|
|
280
|
+
CGLIB = 'cglib:cglib:jar:2.1_3'
|
|
281
|
+
ASM = 'asm:asm:jar:1.5.3'
|
|
282
|
+
OBJENESIS = 'org.objenesis:objenesis:jar:1.1'
|
|
283
|
+
|
|
284
|
+
define 'killer-app' do
|
|
285
|
+
...
|
|
286
|
+
|
|
287
|
+
test.with MOCKITO, CGLIB, ASM, OBJENESIS
|
|
288
|
+
end
|
|
289
|
+
{% endhighlight %}
|
|
290
|
+
|
|
291
|
+
The dependencies for Specs's optional features are defined "here":http://code.google.com/p/specs/wiki/RunningSpecs#Dependencies.
|
|
282
292
|
|
|
283
293
|
h4. ScalaCheck
|
|
284
294
|
|
|
285
295
|
You may use ScalaCheck inside ScalaTest- and Specs-inherited classes. Here is an example illustrating checks inside a ScalaTest suite,
|
|
286
296
|
|
|
287
|
-
<notextile>
|
|
288
297
|
{% highlight scala %}
|
|
289
298
|
import org.scalatest.prop.PropSuite
|
|
290
299
|
import org.scalacheck.Arbitrary._
|
|
@@ -305,7 +314,6 @@ class MySuite extends PropSuite {
|
|
|
305
314
|
)
|
|
306
315
|
}
|
|
307
316
|
{% endhighlight %}
|
|
308
|
-
</notextile>
|
|
309
317
|
|
|
310
318
|
|
|
311
319
|
h2(#groovy). Groovy
|
|
@@ -314,11 +322,9 @@ h3. Compiling Groovy
|
|
|
314
322
|
|
|
315
323
|
Before using the Groovy compiler, you must first require it on your buildfile:
|
|
316
324
|
|
|
317
|
-
<notextile>
|
|
318
325
|
{% highlight ruby %}
|
|
319
326
|
require 'buildr/java/groovyc'
|
|
320
327
|
{% endhighlight %}
|
|
321
|
-
</notextile>
|
|
322
328
|
|
|
323
329
|
Once loaded, the groovyc compiler will be automatically selected if any .groovy source files are found under @src/main/groovy@ directory, compiling them by default into the @target/classes@ directory.
|
|
324
330
|
|
|
@@ -359,12 +365,10 @@ To use this framework in your project you can select it with @test.using :easyb@
|
|
|
359
365
|
|
|
360
366
|
This framework will search for the following patterns under your project:
|
|
361
367
|
|
|
362
|
-
<notextile>
|
|
363
368
|
{% highlight text %}
|
|
364
369
|
src/spec/groovy/**/*Behavior.groovy
|
|
365
370
|
src/spec/groovy/**/*Story.groovy
|
|
366
371
|
{% endhighlight %}
|
|
367
|
-
</notextile>
|
|
368
372
|
|
|
369
373
|
Supports the following options:
|
|
370
374
|
|
|
@@ -388,11 +392,9 @@ p(tip). When not running on JRuby, Buildr will use the @JRUBY_HOME@ environment
|
|
|
388
392
|
|
|
389
393
|
You can use the @build.yaml@ settings file to specify a particular version of JRuby (defaults to @1.1.4@). For example:
|
|
390
394
|
|
|
391
|
-
<notextile>
|
|
392
395
|
{% highlight yaml %}
|
|
393
396
|
jruby: 1.1.3
|
|
394
397
|
{% endhighlight %}
|
|
395
|
-
</notextile>
|
|
396
398
|
|
|
397
399
|
h4. RSpec
|
|
398
400
|
|
|
@@ -402,11 +404,9 @@ To use this framework in your project you can select it with @test.using :rspec@
|
|
|
402
404
|
|
|
403
405
|
This framework will search for the following patterns under your project:
|
|
404
406
|
|
|
405
|
-
<notextile>
|
|
406
407
|
{% highlight text %}
|
|
407
408
|
src/spec/ruby/**/*_spec.rb
|
|
408
409
|
{% endhighlight %}
|
|
409
|
-
</notextile>
|
|
410
410
|
|
|
411
411
|
Supports the following options:
|
|
412
412
|
|
|
@@ -427,11 +427,9 @@ To use this framework in your project you can select it with @test.using :jtestr
|
|
|
427
427
|
|
|
428
428
|
You can use the @build.yaml@ settings file to specify a particular version of JtestR (defaults to @0.3.1@). For example:
|
|
429
429
|
|
|
430
|
-
<notextile>
|
|
431
430
|
{% highlight yaml %}
|
|
432
431
|
jtestr: 0.3.1
|
|
433
432
|
{% endhighlight %}
|
|
434
|
-
</notextile>
|
|
435
433
|
|
|
436
434
|
To customize TestNG/JUnit versions refer to their respective section.
|
|
437
435
|
|