buildr 1.3.4-java → 1.3.5-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. data/CHANGELOG +35 -0
  2. data/README.rdoc +1 -1
  3. data/Rakefile +3 -3
  4. data/buildr.buildfile +6 -1
  5. data/buildr.gemspec +10 -9
  6. data/doc/_config.yml +1 -0
  7. data/doc/_layouts/default.html +25 -19
  8. data/doc/artifacts.textile +0 -36
  9. data/doc/building.textile +0 -38
  10. data/doc/contributing.textile +51 -15
  11. data/doc/css/default.css +11 -4
  12. data/doc/css/print.css +32 -24
  13. data/doc/download.textile +33 -22
  14. data/doc/extending.textile +10 -20
  15. data/doc/images/1442160941-frontcover.jpg +0 -0
  16. data/doc/images/asf-logo.png +0 -0
  17. data/doc/images/note.png +0 -0
  18. data/doc/images/project-structure.png +0 -0
  19. data/doc/images/tip.png +0 -0
  20. data/doc/images/zbuildr.png +0 -0
  21. data/doc/index.textile +39 -17
  22. data/doc/{getting_started.textile → installing.textile} +3 -80
  23. data/doc/languages.textile +50 -52
  24. data/doc/more_stuff.textile +154 -62
  25. data/doc/packaging.textile +0 -82
  26. data/doc/preface.textile +41 -15
  27. data/doc/projects.textile +0 -18
  28. data/doc/quick_start.textile +210 -0
  29. data/doc/scripts/install-linux.sh +10 -2
  30. data/doc/settings_profiles.textile +1 -33
  31. data/doc/testing.textile +6 -32
  32. data/lib/buildr.rb +2 -1
  33. data/lib/buildr/core.rb +6 -0
  34. data/lib/buildr/core/application.rb +2 -5
  35. data/lib/buildr/core/build.rb +29 -19
  36. data/lib/buildr/core/compile.rb +22 -4
  37. data/lib/buildr/core/filter.rb +2 -4
  38. data/lib/buildr/core/project.rb +5 -4
  39. data/lib/buildr/core/shell.rb +198 -0
  40. data/lib/buildr/core/test.rb +2 -0
  41. data/lib/buildr/core/transports.rb +18 -19
  42. data/lib/buildr/core/util.rb +178 -9
  43. data/lib/buildr/groovy.rb +1 -0
  44. data/lib/buildr/groovy/bdd.rb +5 -5
  45. data/lib/buildr/groovy/shell.rb +48 -0
  46. data/lib/buildr/ide/eclipse.rb +148 -36
  47. data/lib/buildr/ide/eclipse/java.rb +53 -0
  48. data/lib/buildr/ide/eclipse/plugin.rb +68 -0
  49. data/lib/buildr/ide/eclipse/scala.rb +66 -0
  50. data/lib/buildr/java/bdd.rb +16 -8
  51. data/lib/buildr/java/cobertura.rb +44 -13
  52. data/lib/buildr/java/commands.rb +5 -3
  53. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
  54. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +18 -0
  55. data/lib/buildr/java/packaging.rb +2 -2
  56. data/lib/buildr/java/rjb.rb +1 -1
  57. data/lib/buildr/java/test_result.rb +48 -1
  58. data/lib/buildr/java/tests.rb +8 -5
  59. data/lib/buildr/packaging/artifact_namespace.rb +1 -1
  60. data/lib/buildr/packaging/package.rb +6 -2
  61. data/lib/buildr/packaging/zip.rb +10 -1
  62. data/lib/buildr/packaging/ziptask.rb +5 -2
  63. data/lib/buildr/scala.rb +1 -0
  64. data/lib/buildr/scala/bdd.rb +17 -8
  65. data/lib/buildr/scala/compiler.rb +66 -21
  66. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner$.class +0 -0
  67. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
  68. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.scala +35 -0
  69. data/lib/buildr/scala/shell.rb +55 -0
  70. data/lib/buildr/scala/tests.rb +6 -5
  71. data/lib/buildr/shell.rb +180 -0
  72. data/rakelib/doc.rake +2 -3
  73. data/rakelib/jekylltask.rb +42 -32
  74. data/rakelib/package.rake +4 -2
  75. data/rakelib/release.rake +8 -8
  76. data/rakelib/rspec.rake +3 -3
  77. data/rakelib/setup.rake +7 -1
  78. data/rakelib/stage.rake +9 -2
  79. data/rakelib/stage.rake~ +213 -0
  80. data/spec/core/application_spec.rb +84 -1
  81. data/spec/core/build_spec.rb +54 -2
  82. data/spec/core/common_spec.rb +1 -1
  83. data/spec/core/compile_spec.rb +2 -1
  84. data/spec/core/extension_spec.rb +93 -0
  85. data/spec/core/test_spec.rb +2 -2
  86. data/spec/core/transport_spec.rb +1 -1
  87. data/spec/groovy/bdd_spec.rb +6 -6
  88. data/spec/groovy/compiler_spec.rb +1 -0
  89. data/spec/ide/eclipse_spec.rb +262 -72
  90. data/spec/java/{ant.rb → ant_spec.rb} +0 -0
  91. data/spec/java/bdd_spec.rb +15 -0
  92. data/spec/java/cobertura_spec.rb +9 -1
  93. data/spec/java/emma_spec.rb +1 -1
  94. data/spec/java/java_spec.rb +26 -0
  95. data/spec/java/packaging_spec.rb +9 -7
  96. data/spec/java/{test_coverage_spec.rb → test_coverage_helper.rb} +6 -4
  97. data/spec/java/tests_spec.rb +22 -0
  98. data/spec/packaging/archive_spec.rb +14 -0
  99. data/spec/packaging/artifact_spec.rb +2 -2
  100. data/spec/packaging/packaging_spec.rb +97 -2
  101. data/spec/sandbox.rb +3 -1
  102. data/spec/scala/bdd_spec.rb +17 -48
  103. data/spec/scala/compiler_spec.rb +31 -2
  104. data/spec/scala/tests_spec.rb +1 -0
  105. data/spec/spec_helpers.rb +12 -0
  106. metadata +145 -148
Binary file
Binary file
Binary file
Binary file
@@ -1,13 +1,34 @@
1
1
  ---
2
2
  layout: default
3
- title: Welcome
3
+ title: Apache Buildr
4
4
  ---
5
5
 
6
- h2(#what_is_apache_buildr). What is Apache Buildr?
7
-
8
6
  Apache Buildr is a build system for Java-based applications, including support for Scala, Groovy and a growing number of JVM languages and tools. We wanted something that's simple and intuitive to use, so we only need to tell it what to do, and it takes care of the rest. But also something we can easily extend for those one-off tasks, with a language that's a joy to use. And of course, we wanted it to be fast, reliable and have outstanding dependency management.
9
7
 
10
- Here's what we got:
8
+
9
+ h2(#why). Why Buildr Rocks
10
+
11
+ "Daniel Spiewak":http://www.codecommit.com/blog:
12
+
13
+ bq. If you think about it, the question isn’t “Why use Buildr?”, it’s really “Why use anything else?” The advantages afforded by Buildr are so substantial, I really can’t see myself going with any other tool, at least not when I have a choice.
14
+
15
+ "Tristan Juricek":http://tristanhunt.com/:
16
+
17
+ bq. That’s still the strongest sell: it builds everything I need, and as I’ve needed more, I just got things working without a lot of fuss.
18
+
19
+ "Matthieu Riou":http://offthelip.org/:
20
+
21
+ bq. We used to rely on Ant, with a fairly extensive set of scripts. It worked but was expensive to maintain. The biggest mistake afterward was to migrate to Maven2. I could write pages of rants explaining all the problems we ran into and we still ended up with thousands of lines of XML.
22
+
23
+ "Martin Grotzke":http://www.javakaffee.de/blog/:
24
+
25
+ bq. The positive side effect for me as a java user is that I learn a little ruby, and that’s easy but lots of fun… :-)
26
+
27
+ "Ijonas Kisselbach":http://twitter.com/ijonas/statuses/4134103928:
28
+
29
+ bq. I've cleaned up & migrated the Vamosa build process from 768 lines of Ant build.xml to 28 lines of Buildr.
30
+
31
+ h2(#what). What You Get
11
32
 
12
33
  * A simple way to specify projects, and build large projects out of smaller sub-projects.
13
34
  * Pre-canned tasks that require the least amount of configuration, keeping the build script DRY and simple.
@@ -20,28 +41,29 @@ Here's what we got:
20
41
  * Simple way to upgrade to new versions.
21
42
  * Did we mention fast?
22
43
 
23
- So let's get started. You can "read the documentation online":getting_started.html, or "download the PDF":buildr.pdf.
44
+ So let's get started. You can "read the documentation online":quick_start.html, or "download the PDF":buildr.pdf.
24
45
 
25
46
 
26
- h2(#news). Project News
47
+ h2(#news). What's New
27
48
 
28
- New in Buildr 1.3.4:
49
+ New in Buildr 1.3.5:
29
50
 
30
- * We graduated from the Apache Incubator! This is our first release as a top-level Apache project: http://buildr.apache.org. New site, new mailing lists, SVN, Git, etc.
31
- * Support for Git version control system
32
- * Improved all-around Scala support, including joint Java-Scala compilation and upgraded to Scala 2.7.3 dependencies: ScalaSpecs 1.4.3, ScalaCheck 1.5 and ScalaTest 0.9.5
33
- * New 'artifacts:sources' task to download source code for artifact jars
34
- * Source code attachments for external dependencies in Eclipse and IDEA projects
35
- * Dependency upgrades such as Rake 0.8.4, Net-SSH 2.0.11, RSpec 1.2.2, JRuby 1.1.6.
36
- * Documentation now uses "Jekyll":http://github.com/mojombo/jekyll/ to generate web site and PDF document. This replaces Docter so less code to
37
- maintain and the same Textile/Liquid mechanism as when using Github pages.
38
- * And 20 or so bug fixes.
51
+ * Interactive shell (REPL) support, including BeanShell for Java projects
52
+ * Scala libraries are automatically downloaded if not availabe locally
53
+ * New 'cobertura:check' allows you to check for code coverage levels in your projects
54
+ * Eclipse task is configurable to support various types of natures, builders, etc.
55
+ * Dependency upgrades such as Net-SSH 2.0.15, JRuby 1.3.1, Rake 0.8.7, RSpec 1.2.8, easyb 0.9, TestNG 5.10
56
+ * And 15+ bug fixes.
39
57
 
40
58
  See the "CHANGELOG":CHANGELOG for full details.
41
59
 
42
60
 
43
- h2(#legal). Legal Notices
61
+ h2(#notices). Credits & Notices
62
+
63
+ !http://www.apache.org/images/asf-logo.gif(A project of the Apache Software Foundation)!:http://www.apache.org
44
64
 
45
65
  The Apache Software Foundation is a non-profit organization, consider "sponsoring":http://www.apache.org/foundation/sponsorship.html and check the "thanks":http://www.apache.org/foundation/thanks.html page.
46
66
 
47
67
  "ColorCons":http://www.mouserunner.com/Spheres_ColoCons1_Free_Icons.html, copyright of Ken Saunders. "DejaVu fonts":http://dejavu.sourceforge.net, copyright of Bitstream, Inc.
68
+
69
+ Community member quotes from a thread on "Stack Overflow":http://stackoverflow.com/questions/1015525/why-use-buildr-instead-of-ant-or-maven/1055864.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  layout: default
3
- title: Getting Started
3
+ title: Installing and Running
4
4
  ---
5
5
 
6
6
 
@@ -18,23 +18,11 @@ Older versions of RubyGems are all kind of fail. You want to avoid these unless
18
18
 
19
19
  The Ruby interpreter and JVM must use compatible architectures. For example, OS X comes with 32-bit version of Ruby, Java 1.5 in both 32-bit and 64-bit flavors, and 64-bit Java 6. As a result you can run Ruby with Java 1.5 (32-bit), but to use Java 6 you either need to build Ruby from source for 64-bit, or use "Buildr for JRuby":#jruby.
20
20
 
21
-
22
21
  h2(#linux). Installing on Linux
23
22
 
24
- *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 @yum@) and upgrade to RubyGems 1.3.1 or later.
25
-
26
- <br>
27
-
28
- *In details:* The @gem install@ and @gem update@ commands install Buildr from a binary distribution provided through "RubyForge":http://rubyforge.org/projects/buildr. This distribution is maintained by contributors to this project, but is *not* an official Apache distribution. You can obtain the official Apache distribution files from the "download page":download.html.
29
-
30
- Older versions of RubyGems are all kind of fail. You want to avoid these unless you have the patience to install each Buildr dependency manually. Get RubyGems 1.3.1 or later, and when using Debian packages (e.g. Ubuntu), make sure to get the unmolested RubyGems straight form the source.
31
-
32
- The Ruby interpreter and JVM must use compatible architectures. For example, OS X comes with 32-bit version of Ruby, Java 1.5 in both 32-bit and 64-bit flavors, and 64-bit Java 6. As a result you can run Ruby with Java 1.5 (32-bit), but to use Java 6 you either need to build Ruby from source for 64-bit, or use "Buildr for JRuby":#jruby.
33
-
34
-
35
- h2(#linux). Installing on Linux
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.
36
24
 
37
- *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 @yum@) and upgrade to RubyGems 1.3.1 or later.
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.
38
26
 
39
27
  <br>
40
28
 
@@ -42,24 +30,19 @@ h2(#linux). Installing on Linux
42
30
 
43
31
  On *RedHat/Fedora* you can use yum to install Ruby and RubyGems, and then upgrade to the most recent version of RubyGems:
44
32
 
45
- <notextile>
46
33
  {% highlight sh %}
47
34
  $ sudo yum install ruby rubygems ruby-devel gcc
48
35
  $ sudo gem update --system
49
36
  {% endhighlight %}
50
- </notextile>
51
37
 
52
38
  On *Ubuntu* you have to install several packages:
53
39
 
54
- <notextile>
55
40
  {% highlight sh %}
56
41
  $ sudo apt-get install ruby-full ruby1.8-dev libopenssl-ruby build-essential
57
42
  {% endhighlight %}
58
- </notextile>
59
43
 
60
44
  The Debian package for @rubygems@ will not allow you to install Buildr, so you need to install RubyGems from source:
61
45
 
62
- <notextile>
63
46
  {% highlight sh %}
64
47
  $ wget http://rubyforge.org/frs/download.php/45905/rubygems-1.3.1.tgz
65
48
  $ tar xzf rubygems-1.3.1.tgz
@@ -67,24 +50,19 @@ $ cd rubygems-1.3.1
67
50
  $ sudo ruby setup.rb
68
51
  $ sudo ln -s /usr/bin/gem1.8 /usr/bin/gem
69
52
  {% endhighlight %}
70
- </notextile>
71
53
 
72
54
  Before installing Buildr, please set the @JAVA_HOME@ environment variable to point to your JDK distribution. Next, use Ruby Gem to install Buildr:
73
55
 
74
- <notextile>
75
56
  {% highlight sh %}
76
57
  $ sudo env JAVA_HOME=$JAVA_HOME gem install buildr
77
58
  {% endhighlight %}
78
- </notextile>
79
59
 
80
60
  To upgrade to a new version or install a specific version:
81
61
 
82
- <notextile>
83
62
  {% highlight sh %}
84
63
  $ sudo env JAVA_HOME=$JAVA_HOME gem update buildr
85
64
  $ sudo env JAVA_HOME=$JAVA_HOME gem install buildr -v 1.3.4
86
65
  {% endhighlight %}
87
- </notextile>
88
66
 
89
67
 
90
68
 
@@ -100,36 +78,28 @@ OS X 10.4 (Tiger) includes an older version of Ruby that is not compatible with
100
78
 
101
79
  We recommend you first upgrade to the latest version of Ruby gems:
102
80
 
103
- <notextile>
104
81
  {% highlight sh %}
105
82
  $ sudo gem update --system
106
83
  {% endhighlight %}
107
- </notextile>
108
84
 
109
85
  Before installing Buildr, please set the @JAVA_HOME@ environment variable to point to your JDK distribution:
110
86
 
111
- <notextile>
112
87
  {% highlight sh %}
113
88
  $ export JAVA_HOME=/Library/Java/Home
114
89
  {% endhighlight %}
115
- </notextile>
116
90
 
117
91
  To install Buildr:
118
92
 
119
- <notextile>
120
93
  {% highlight sh %}
121
94
  $ sudo env JAVA_HOME=$JAVA_HOME gem install buildr
122
95
  {% endhighlight %}
123
- </notextile>
124
96
 
125
97
  To upgrade to a new version or install a specific version:
126
98
 
127
- <notextile>
128
99
  {% highlight sh %}
129
100
  $ sudo env JAVA_HOME=$JAVA_HOME gem update buildr
130
101
  $ sudo env JAVA_HOME=$JAVA_HOME gem install buildr -v 1.3.4
131
102
  {% endhighlight %}
132
- </notextile>
133
103
 
134
104
 
135
105
  h2(#windows). Installing on Windows
@@ -140,28 +110,22 @@ h2(#windows). Installing on Windows
140
110
 
141
111
  *In details:* We recommend you first upgrade to the latest version of Ruby gems:
142
112
 
143
- <notextile>
144
113
  {% highlight sh %}
145
114
  > gem update --system
146
115
  {% endhighlight %}
147
- </notextile>
148
116
 
149
117
  Before installing Buildr, please set the @JAVA_HOME@ environment variable to point to your JDK distribution. Next, use Ruby Gem to install Buildr:
150
118
 
151
- <notextile>
152
119
  {% highlight sh %}
153
120
  > gem install buildr
154
121
  {% endhighlight %}
155
- </notextile>
156
122
 
157
123
  To upgrade to a new version or install a specific version:
158
124
 
159
- <notextile>
160
125
  {% highlight sh %}
161
126
  > gem update buildr
162
127
  > gem install buildr -v 1.3.4
163
128
  {% endhighlight %}
164
- </notextile>
165
129
 
166
130
 
167
131
  h2(#jruby). Installing for JRuby
@@ -176,30 +140,24 @@ After uncompressing JRuby, update your @PATH@ to include both @java@ and @jruby@
176
140
 
177
141
  For Linux and OS X:
178
142
 
179
- <notextile>
180
143
  {% highlight sh %}
181
144
  $ export PATH=$PATH:[path to JRuby]/bin:$JAVA_HOME/bin
182
145
  $ jruby -S gem install buildr
183
146
  {% endhighlight %}
184
- </notextile>
185
147
 
186
148
  For Windows:
187
149
 
188
- <notextile>
189
150
  {% highlight sh %}
190
151
  > set PATH=%PATH%;[path to JRuby]/bin;%JAVA_HOME%/bin
191
152
  > jruby -S gem install buildr
192
153
  {% endhighlight %}
193
- </notextile>
194
154
 
195
155
  To upgrade to a new version or install a specific version:
196
156
 
197
- <notextile>
198
157
  {% highlight sh %}
199
158
  $ jruby -S gem update buildr
200
159
  $ jruby -S gem install buildr -v 1.3.4
201
160
  {% endhighlight %}
202
- </notextile>
203
161
 
204
162
 
205
163
  *Important: Running JRuby and Ruby side by side*
@@ -212,7 +170,6 @@ To work exclusively with JRuby, make sure it shows first on the path, for exampl
212
170
 
213
171
  You can use JRuby and Ruby side by side, by running scripts with the @-S@ command line argument. For example:
214
172
 
215
- <notextile>
216
173
  {% highlight sh %}
217
174
  $ # with Ruby
218
175
  $ ruby -S gem install buildr
@@ -221,34 +178,10 @@ $ # with JRuby
221
178
  $ jruby -S gem install buildr
222
179
  $ jruby -S buildr
223
180
  {% endhighlight %}
224
- </notextile>
225
181
 
226
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.
227
183
 
228
184
 
229
- h2(#conventions). Document Conventions
230
-
231
- Lines that start with @$@ are command lines, for example:
232
-
233
- <notextile>
234
- {% highlight sh %}
235
- $ # Run Buildr
236
- $ buildr
237
- {% endhighlight %}
238
- </notextile>
239
-
240
- Lines that start with @=>@ show output from the console or the result of a method, for example:
241
-
242
- <notextile>
243
- {% highlight sh %}
244
- puts 'Hello world'
245
- => "Hello world"
246
- {% endhighlight %}
247
- </notextile>
248
-
249
- And as you guessed, everything else is Buildfile Ruby or Java code. You can figure out which language is which.
250
-
251
-
252
185
  h2(#running). Running Buildr
253
186
 
254
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@.
@@ -257,11 +190,9 @@ p(tip). You'll notice that Buildr creates a file called @buildfile@. It's case
257
190
 
258
191
  You use Buildr by running the @buildr@ command:
259
192
 
260
- <notextile>
261
193
  {% highlight sh %}
262
194
  $ buildr [options] [tasks] [name=value]
263
195
  {% endhighlight %}
264
- </notextile>
265
196
 
266
197
  There are several options you can use, for a full list of options type @buildr --help@:
267
198
 
@@ -278,14 +209,12 @@ There are several options you can use, for a full list of options type @buildr -
278
209
 
279
210
  You can tell Buildr to run specific tasks and the order to run them. For example:
280
211
 
281
- <notextile>
282
212
  {% highlight sh %}
283
213
  # Clean and rebuild
284
214
  buildr clean build
285
215
  # Package and install
286
216
  buildr install
287
217
  {% endhighlight %}
288
- </notextile>
289
218
 
290
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@.
291
220
 
@@ -293,12 +222,10 @@ There are several "environment variables":settings_profiles.html#env_vars that l
293
222
 
294
223
  For example:
295
224
 
296
- <notextile>
297
225
  {% highlight sh %}
298
226
  $ export JAVA_OPTS='-Xms1g -Xmx1g'
299
227
  $ buildr TEST=no
300
228
  {% endhighlight %}
301
- </notextile>
302
229
 
303
230
 
304
231
  h2(#help). Help Tasks
@@ -307,15 +234,12 @@ Buildr includes a number of informative tasks. Currently that number stands at
307
234
 
308
235
  To start with, type:
309
236
 
310
- <notextile>
311
237
  {% highlight sh %}
312
238
  $ buildr help
313
239
  {% endhighlight %}
314
- </notextile>
315
240
 
316
241
  You can list the name and description of all your projects using the @help:projects@ task. For example:
317
242
 
318
- <notextile>
319
243
  {% highlight sh %}
320
244
  $ buildr help:projects
321
245
  killer-app # Code. Build. ??? Profit!
@@ -323,7 +247,6 @@ killer-app:teh-api # Abstract classes and interfaces
323
247
  killer-app:teh-impl # All those implementation details
324
248
  killer-app:la-web # What our users see
325
249
  {% endhighlight %}
326
- </notextile>
327
250
 
328
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.
329
252
 
@@ -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 features, you must first set the @SCALA_HOME@ environment variable to point to the root of your Scala distribution.
131
+ Before using Scala, you must first @require@ the Scala compiler:
146
132
 
147
- On Windows:
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
- On Linux and other Unix variants,
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
- <notextile>
158
- {% highlight sh %}
159
- > export SCALA_HOME=/path/to/scala-2.7.3
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
- The @SCALA_HOME@ base directory should be such that Scala core libraries are located directly under the "lib" subdirectory, and Scala scripts are under the "bin" directory. This step is not necessary if you installed Scala using MacPorts (OS X).
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
- You must also require the Scala compiler in your buildfile:
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
- require 'buildr/scala'
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
- ("".length) mustEqual(0)
270
+ "".length mustBe 0
277
271
  }
278
272
  }
279
273
  }
280
274
  {% endhighlight %}
281
- </notextile>
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