buildr 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. data/CHANGELOG +66 -4
  2. data/{README → README.rdoc} +29 -16
  3. data/Rakefile +16 -20
  4. data/_buildr +38 -0
  5. data/addon/buildr/cobertura.rb +49 -45
  6. data/addon/buildr/emma.rb +238 -0
  7. data/addon/buildr/jetty.rb +1 -1
  8. data/addon/buildr/nailgun.rb +585 -661
  9. data/{lib/buildr/java → addon/buildr}/org/apache/buildr/BuildrNail$Main.class +0 -0
  10. data/{lib/buildr/java → addon/buildr}/org/apache/buildr/BuildrNail.class +0 -0
  11. data/{lib/buildr/java → addon/buildr}/org/apache/buildr/BuildrNail.java +0 -0
  12. data/bin/buildr +9 -2
  13. data/buildr.buildfile +53 -0
  14. data/buildr.gemspec +21 -14
  15. data/doc/css/default.css +51 -48
  16. data/doc/css/print.css +60 -55
  17. data/doc/images/favicon.png +0 -0
  18. data/doc/images/growl-icon.tiff +0 -0
  19. data/doc/images/project-structure.png +0 -0
  20. data/doc/pages/artifacts.textile +46 -156
  21. data/doc/pages/building.textile +63 -323
  22. data/doc/pages/contributing.textile +112 -102
  23. data/doc/pages/download.textile +19 -27
  24. data/doc/pages/extending.textile +27 -81
  25. data/doc/pages/getting_started.textile +44 -119
  26. data/doc/pages/index.textile +26 -47
  27. data/doc/pages/languages.textile +407 -0
  28. data/doc/pages/more_stuff.textile +92 -173
  29. data/doc/pages/packaging.textile +71 -239
  30. data/doc/pages/projects.textile +58 -233
  31. data/doc/pages/recipes.textile +19 -43
  32. data/doc/pages/settings_profiles.textile +39 -104
  33. data/doc/pages/testing.textile +41 -304
  34. data/doc/pages/troubleshooting.textile +29 -47
  35. data/doc/pages/whats_new.textile +69 -167
  36. data/doc/print.haml +0 -1
  37. data/doc/print.toc.yaml +1 -0
  38. data/doc/scripts/buildr-git.rb +1 -1
  39. data/doc/site.haml +1 -0
  40. data/doc/site.toc.yaml +8 -5
  41. data/{KEYS → etc/KEYS} +0 -0
  42. data/etc/git-svn-authors +16 -0
  43. data/lib/buildr.rb +2 -5
  44. data/lib/buildr/core/application.rb +192 -98
  45. data/lib/buildr/core/build.rb +140 -91
  46. data/lib/buildr/core/checks.rb +5 -5
  47. data/lib/buildr/core/common.rb +1 -1
  48. data/lib/buildr/core/compile.rb +12 -10
  49. data/lib/buildr/core/filter.rb +151 -46
  50. data/lib/buildr/core/generate.rb +9 -9
  51. data/lib/buildr/core/progressbar.rb +1 -1
  52. data/lib/buildr/core/project.rb +8 -7
  53. data/lib/buildr/core/test.rb +51 -26
  54. data/lib/buildr/core/transports.rb +22 -38
  55. data/lib/buildr/core/util.rb +78 -26
  56. data/lib/buildr/groovy.rb +18 -0
  57. data/lib/buildr/groovy/bdd.rb +105 -0
  58. data/lib/buildr/groovy/compiler.rb +138 -0
  59. data/lib/buildr/ide/eclipse.rb +102 -71
  60. data/lib/buildr/ide/idea.rb +7 -12
  61. data/lib/buildr/ide/idea7x.rb +7 -8
  62. data/lib/buildr/java.rb +4 -7
  63. data/lib/buildr/java/ant.rb +26 -5
  64. data/lib/buildr/java/bdd.rb +449 -0
  65. data/lib/buildr/java/commands.rb +9 -9
  66. data/lib/buildr/java/{compilers.rb → compiler.rb} +8 -90
  67. data/lib/buildr/java/jruby.rb +29 -11
  68. data/lib/buildr/java/jtestr_runner.rb.erb +116 -0
  69. data/lib/buildr/java/packaging.rb +23 -16
  70. data/lib/buildr/java/pom.rb +1 -1
  71. data/lib/buildr/java/rjb.rb +21 -8
  72. data/lib/buildr/java/test_result.rb +308 -0
  73. data/lib/buildr/java/tests.rb +324 -0
  74. data/lib/buildr/packaging/artifact.rb +12 -11
  75. data/lib/buildr/packaging/artifact_namespace.rb +7 -4
  76. data/lib/buildr/packaging/gems.rb +3 -3
  77. data/lib/buildr/packaging/zip.rb +13 -10
  78. data/lib/buildr/resources/buildr.icns +0 -0
  79. data/lib/buildr/scala.rb +19 -0
  80. data/lib/buildr/scala/compiler.rb +109 -0
  81. data/lib/buildr/scala/tests.rb +203 -0
  82. data/rakelib/apache.rake +71 -45
  83. data/rakelib/doc.rake +2 -2
  84. data/rakelib/package.rake +3 -2
  85. data/rakelib/rspec.rake +23 -21
  86. data/rakelib/setup.rake +34 -9
  87. data/rakelib/stage.rake +4 -1
  88. data/spec/addon/cobertura_spec.rb +77 -0
  89. data/spec/addon/emma_spec.rb +120 -0
  90. data/spec/addon/test_coverage_spec.rb +255 -0
  91. data/spec/{application_spec.rb → core/application_spec.rb} +82 -4
  92. data/spec/{artifact_namespace_spec.rb → core/artifact_namespace_spec.rb} +12 -1
  93. data/spec/core/build_spec.rb +415 -0
  94. data/spec/{checks_spec.rb → core/checks_spec.rb} +2 -2
  95. data/spec/{common_spec.rb → core/common_spec.rb} +119 -30
  96. data/spec/{compile_spec.rb → core/compile_spec.rb} +17 -13
  97. data/spec/core/generate_spec.rb +33 -0
  98. data/spec/{project_spec.rb → core/project_spec.rb} +9 -6
  99. data/spec/{test_spec.rb → core/test_spec.rb} +222 -28
  100. data/spec/{transport_spec.rb → core/transport_spec.rb} +5 -9
  101. data/spec/groovy/bdd_spec.rb +80 -0
  102. data/spec/{groovy_compilers_spec.rb → groovy/compiler_spec.rb} +1 -1
  103. data/spec/ide/eclipse_spec.rb +243 -0
  104. data/spec/{java_spec.rb → java/ant.rb} +7 -17
  105. data/spec/java/bdd_spec.rb +358 -0
  106. data/spec/{java_compilers_spec.rb → java/compiler_spec.rb} +1 -1
  107. data/spec/java/java_spec.rb +88 -0
  108. data/spec/{java_packaging_spec.rb → java/packaging_spec.rb} +65 -4
  109. data/spec/{java_test_frameworks_spec.rb → java/tests_spec.rb} +31 -10
  110. data/spec/{archive_spec.rb → packaging/archive_spec.rb} +12 -2
  111. data/spec/{artifact_spec.rb → packaging/artifact_spec.rb} +12 -5
  112. data/spec/{packaging_helper.rb → packaging/packaging_helper.rb} +0 -0
  113. data/spec/{packaging_spec.rb → packaging/packaging_spec.rb} +1 -1
  114. data/spec/sandbox.rb +22 -5
  115. data/spec/{scala_compilers_spec.rb → scala/compiler_spec.rb} +1 -1
  116. data/spec/{scala_test_frameworks_spec.rb → scala/tests_spec.rb} +11 -12
  117. data/spec/spec_helpers.rb +38 -17
  118. metadata +103 -70
  119. data/lib/buildr/java/bdd_frameworks.rb +0 -265
  120. data/lib/buildr/java/groovyc.rb +0 -137
  121. data/lib/buildr/java/test_frameworks.rb +0 -450
  122. data/spec/build_spec.rb +0 -193
  123. data/spec/java_bdd_frameworks_spec.rb +0 -238
  124. data/spec/spec.opts +0 -6
@@ -2,26 +2,18 @@ h1. Getting Started
2
2
 
3
3
  h2. Installing Buildr
4
4
 
5
- The installation instructions are slightly different for each operating system.
6
- Pick the one that best matches your operating system and target platform.
5
+ The installation instructions are slightly different for each operating system. Pick the one that best matches your operating system and target platform.
7
6
 
8
- The @gem install@ and @gem update@ commands install Buildr from a binary
9
- distribution provided through "RubyForge":http://rubyforge.org/projects/buildr.
10
- This distribution is maintained by contributors to this project, but is *not*
11
- an official Apache distribution. You can obtain the official Apache
12
- distribution files from the "download page":download.html.
7
+ 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.
13
8
 
14
- The current release of Buildr for Ruby may not work well with Java 6, only
15
- Java 1.5 or earlier. If you need to use Java 6, consider "Buildr for JRuby":#jruby.
9
+ The current release of Buildr for Ruby may not work well with Java 6, only Java 1.5 or earlier. If you need to use Java 6, consider "Buildr for JRuby":#jruby.
16
10
 
17
11
 
18
12
  h3. Linux
19
13
 
20
- To get started you will need a recent version of Ruby, Ruby Gems and build
21
- tools for compiling native libraries (@make@, @gcc@ and standard headers).
14
+ To get started you will need a recent version of Ruby, Ruby Gems and build tools for compiling native libraries (@make@, @gcc@ and standard headers).
22
15
 
23
- On *RedHat/Fedora* you can use yum to install Ruby and RubyGems, and then
24
- upgrade to the most recent version of RubyGems:
16
+ On *RedHat/Fedora* you can use yum to install Ruby and RubyGems, and then upgrade to the most recent version of RubyGems:
25
17
 
26
18
  {{{!sh
27
19
  $ sudo yum install ruby rubygems ruby-devel gcc
@@ -34,8 +26,7 @@ On *Ubuntu* you have to install several packages:
34
26
  $ sudo apt-get install ruby-full ruby1.8-dev libopenssl-ruby build-essential
35
27
  }}}
36
28
 
37
- The Debian package for @rubygems@ will not allow you to install Buildr, so you
38
- need to install RubyGems from source:
29
+ The Debian package for @rubygems@ will not allow you to install Buildr, so you need to install RubyGems from source:
39
30
 
40
31
  {{{!sh
41
32
  $ wget http://rubyforge.org/frs/download.php/38646/rubygems-1.2.0.tgz
@@ -45,8 +36,7 @@ $ sudo ruby setup.rb
45
36
  $ sudo ln -s /usr/bin/gem1.8 /usr/bin/gem
46
37
  }}}
47
38
 
48
- Before installing Buildr, please set the @JAVA_HOME@ environment variable to
49
- point to your JDK distribution. Next, use Ruby Gem to install Buildr:
39
+ Before installing Buildr, please set the @JAVA_HOME@ environment variable to point to your JDK distribution. Next, use Ruby Gem to install Buildr:
50
40
 
51
41
  {{{!sh
52
42
  $ sudo env JAVA_HOME=$JAVA_HOME gem install buildr
@@ -56,22 +46,15 @@ To upgrade to a new version or install a specific version:
56
46
 
57
47
  {{{!sh
58
48
  $ sudo env JAVA_HOME=$JAVA_HOME gem update buildr
59
- $ sudo env JAVA_HOME=$JAVA_HOME gem install buildr -v 1.3.0
49
+ $ sudo env JAVA_HOME=$JAVA_HOME gem install buildr -v 1.3.3
60
50
  }}}
61
51
 
62
- You can also use this script "to install Buildr on
63
- Linux":scripts/install-linux.sh. This script will install Buildr or if already
64
- installed, upgrade to a more recent version. It will also install Ruby 1.8.6
65
- if not already installed (using @yum@ or @apt-get@) and upgrage RubyGems to
66
- 1.0.1.
52
+ You can also use this script "to install Buildr on Linux":scripts/install-linux.sh. This script will install Buildr or if already installed, upgrade to a more recent version. It will also install Ruby 1.8.6 if not already installed (using @yum@ or @apt-get@) and upgrage RubyGems to 1.0.1.
67
53
 
68
54
 
69
- h3. OS/X
55
+ h3. OS X
70
56
 
71
- OS/X 10.5 (Leopard) comes with a recent version of Ruby 1.8.6. OS/X 10.4
72
- (Tiger) includes an older version of Ruby, we recommend you first install Ruby
73
- 1.8.6 using MacPorts (@sudo port install ruby rb-rubygems@), Fink or the
74
- "Ruby One-Click Installer for OS/X":http://rubyosx.rubyforge.org/.
57
+ OS X 10.5 (Leopard) comes with a recent version of Ruby 1.8.6. OS X 10.4 (Tiger) includes an older version of Ruby, we recommend you first install Ruby 1.8.6 using MacPorts (@sudo port install ruby rb-rubygems@), Fink or the "Ruby One-Click Installer for OS X":http://rubyosx.rubyforge.org/.
75
58
 
76
59
  We recommend you first upgrade to the latest version of Ruby gems:
77
60
 
@@ -79,8 +62,7 @@ We recommend you first upgrade to the latest version of Ruby gems:
79
62
  $ sudo gem update --system
80
63
  }}}
81
64
 
82
- Before installing Buildr, please set the @JAVA_HOME@ environment variable to
83
- point to your JDK distribution:
65
+ Before installing Buildr, please set the @JAVA_HOME@ environment variable to point to your JDK distribution:
84
66
 
85
67
  {{{!sh
86
68
  $ export JAVA_HOME=/Library/Java/Home
@@ -96,20 +78,15 @@ To upgrade to a new version or install a specific version:
96
78
 
97
79
  {{{!sh
98
80
  $ sudo env JAVA_HOME=$JAVA_HOME gem update buildr
99
- $ sudo env JAVA_HOME=$JAVA_HOME gem install buildr -v 1.3.0
81
+ $ sudo env JAVA_HOME=$JAVA_HOME gem install buildr -v 1.3.3
100
82
  }}}
101
83
 
102
- You can also use this script "to install Buildr on
103
- OS/X":scripts/install-osx.sh. This script will install Buildr or if already
104
- installed, upgrade to a more recent version. It will also install Ruby 1.8.6
105
- if not already installed (using MacPorts) and upgrage RubyGems to 1.0.1.
84
+ You can also use this script "to install Buildr on OS X":scripts/install-osx.sh. This script will install Buildr or if already installed, upgrade to a more recent version. It will also install Ruby 1.8.6 if not already installed (using MacPorts) and upgrage RubyGems to 1.0.1.
106
85
 
107
86
 
108
87
  h3. Windows
109
88
 
110
- If you don't already have Ruby installed, now is the time to do it. The
111
- easiest way to install Ruby is using the "one-click
112
- installer":http://rubyinstaller.rubyforge.org/.
89
+ If you don't already have Ruby installed, now is the time to do it. The easiest way to install Ruby is using the "one-click installer":http://rubyinstaller.rubyforge.org/.
113
90
 
114
91
  We recommend you first upgrade to the latest version of Ruby gems:
115
92
 
@@ -117,35 +94,29 @@ We recommend you first upgrade to the latest version of Ruby gems:
117
94
  > gem update --system
118
95
  }}}
119
96
 
120
- Before installing Buildr, please set the @JAVA_HOME@ environment variable to
121
- point to your JDK distribution. Next, use Ruby Gem to install Buildr:
97
+ Before installing Buildr, please set the @JAVA_HOME@ environment variable to point to your JDK distribution. Next, use Ruby Gem to install Buildr:
122
98
 
123
99
  {{{!sh
124
100
  > gem install buildr
125
101
  }}}
126
102
 
127
- Buildr uses several libraries that include native extensions. During
128
- installation it will ask you to pick a platform for these libraries. By
129
- selecting @mswin32@ it will download and install pre-compiled DLLs for these
130
- extensions.
103
+ Buildr uses several libraries that include native extensions. During installation it will ask you to pick a platform for these libraries. By selecting @mswin32@ it will download and install pre-compiled DLLs for these extensions.
131
104
 
132
105
  To upgrade to a new version or install a specific version:
133
106
 
134
107
  {{{!sh
135
108
  > gem update buildr
136
- > gem install buildr -v 1.3.0
109
+ > gem install buildr -v 1.3.3
137
110
  }}}
138
111
 
139
112
 
140
113
  h3. JRuby
141
114
 
142
- If you don't already have JRuby 1.1 or later installed, you can download it
143
- from the "JRuby site":http://dist.codehaus.org/jruby/.
115
+ If you don't already have JRuby 1.1 or later installed, you can download it from the "JRuby site":http://dist.codehaus.org/jruby/.
144
116
 
145
- After uncompressing JRuby, update your @PATH@ to include both @java@ and @jruby@
146
- executables.
117
+ After uncompressing JRuby, update your @PATH@ to include both @java@ and @jruby@ executables.
147
118
 
148
- For Linux and OS/X:
119
+ For Linux and OS X:
149
120
 
150
121
  {{{!sh
151
122
  $ export PATH=$PATH:[path to JRuby]/bin:$JAVA_HOME/bin
@@ -163,32 +134,20 @@ To upgrade to a new version or install a specific version:
163
134
 
164
135
  {{{!sh
165
136
  $ jruby -S gem update buildr
166
- $ jruby -S gem install buildr -v 1.3.0
137
+ $ jruby -S gem install buildr -v 1.3.3
167
138
  }}}
168
139
 
169
- You can also use this script "to install Buildr on
170
- JRuby":scripts/install-jruby.sh. This script will install Buildr or if already
171
- installed, upgrade to a more recent version. If necessary, it will also
172
- install JRuby 1.1 in @/opt/jruby@ and update the @PATH@ variable in
173
- @~/.bash_profile@ or @~/.profile@.
140
+ You can also use this script "to install Buildr on JRuby":scripts/install-jruby.sh. This script will install Buildr or if already installed, upgrade to a more recent version. If necessary, it will also install JRuby 1.1 in @/opt/jruby@ and update the @PATH@ variable in @~/.bash_profile@ or @~/.profile@.
174
141
 
175
142
  *Important: Running JRuby and Ruby side by side*
176
143
 
177
- Ruby and JRuby maintain separate Gem repositories, and in fact install
178
- slightly different versions of the Buildr Gem (same functionality, different
179
- dependencies). Installing Buildr for Ruby does not install it for JRuby and
180
- vice versa.
144
+ Ruby and JRuby maintain separate Gem repositories, and in fact install slightly different versions of the Buildr Gem (same functionality, different dependencies). Installing Buildr for Ruby does not install it for JRuby and vice versa.
181
145
 
182
- If you have JRuby installed but not Ruby, the @gem@ and @buildr@ commands will
183
- use JRuby. If you have both JRuby and Ruby installed, follow the instructions
184
- below. To find out if you have Ruby installed (some operating systems include
185
- it by default), run @ruby --version@ from the command line.
146
+ If you have JRuby installed but not Ruby, the @gem@ and @buildr@ commands will use JRuby. If you have both JRuby and Ruby installed, follow the instructions below. To find out if you have Ruby installed (some operating systems include it by default), run @ruby --version@ from the command line.
186
147
 
187
- To work exclusively with JRuby, make sure it shows first on the path, for example,
188
- by setting @PATH=/opt/jruby/bin:$PATH@.
148
+ To work exclusively with JRuby, make sure it shows first on the path, for example, by setting @PATH=/opt/jruby/bin:$PATH@.
189
149
 
190
- You can use JRuby and Ruby side by side, by running scripts with the @-S@
191
- command line argument. For example:
150
+ You can use JRuby and Ruby side by side, by running scripts with the @-S@ command line argument. For example:
192
151
 
193
152
  {{{!
194
153
  $ # with Ruby
@@ -199,9 +158,7 @@ $ jruby -S gem install buildr
199
158
  $ jruby -S buildr
200
159
  }}}
201
160
 
202
- Run @buildr --version@ from the command line to find which version of Buildr
203
- you are using by default. If you see @(JRuby ...)@, Buildr is running on that
204
- version of JRuby.
161
+ 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.
205
162
 
206
163
 
207
164
  h2. Document Conventions
@@ -213,35 +170,26 @@ $ # Run Buildr
213
170
  $ buildr
214
171
  }}}
215
172
 
216
- Lines that start with @=>@ show output from the console or the result of a
217
- method, for example:
173
+ Lines that start with @=>@ show output from the console or the result of a method, for example:
218
174
 
219
175
  {{{!sh
220
176
  puts 'Hello world'
221
177
  => "Hello world"
222
178
  }}}
223
179
 
224
- And as you guessed, everything else is Buildfile Ruby or Java code. You can
225
- figure out which language is which.
180
+ And as you guessed, everything else is Buildfile Ruby or Java code. You can figure out which language is which.
226
181
 
227
182
 
228
183
 
229
184
  h2. Running Buildr
230
185
 
231
- You need a *Buildfile*, a build script that tells Buildr all about the projects
232
- it's building, what they contain, what to produce, and so on. The Buildfile
233
- resides in the root directory of your project. We'll talk more about it in
234
- "the next chapter":projects.html. If you don't already have one, ask Buildr to
235
- create it:
186
+ 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:
236
187
 
237
188
  {{{!sh
238
189
  $ buildr
239
190
  }}}
240
191
 
241
- p(tip). You'll notice that Buildr creates a file called @buildfile@. It's
242
- case sensitive, but Buildr will look for either @buildfile@ or @Buildfile@.
243
- You can also use @Rakefile@ or @rakefile@ for compatibility with previous
244
- versions of Buildr.
192
+ p(tip). You'll notice that Buildr creates a file called @buildfile@. It's case sensitive, but Buildr will look for either @buildfile@ or @Buildfile@.
245
193
 
246
194
  You use Buildr by running the @buildr@ command:
247
195
 
@@ -264,9 +212,9 @@ $ buildr --help
264
212
  | @-r/--require [file]@ | Require MODULE before executing buildfile. |
265
213
  | @-t/--trace@ | Turn on invoke/execute tracing, enable full backtrace. |
266
214
  | @-v/--version@ | Display the program version. |
215
+ | @-P/--prereqs@ | Display tasks and dependencies, then exit. |
267
216
 
268
- You can tell Buildr to run specific tasks and the order to run them. For
269
- example:
217
+ You can tell Buildr to run specific tasks and the order to run them. For example:
270
218
 
271
219
  {{{!sh
272
220
  # Clean and rebuild
@@ -275,15 +223,9 @@ buildr clean build
275
223
  buildr install
276
224
  }}}
277
225
 
278
- If you don't specify a task, Buildr will run the "@build@ task":building.html,
279
- compiling source code and running test cases. Running a task may run other
280
- tasks as well, for example, running the @install@ task will also run @package@.
226
+ 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@.
281
227
 
282
- There are several "environment
283
- variables":settings_profiles.html#environment_variables that let you control
284
- how Buildr works, for example, to skip test cases during a build, or specify
285
- options for the JVM. Depending on the variable, you may want to set it once in
286
- your environment, or set a different value each time you run Buildr.
228
+ There are several "environment variables":settings_profiles.html#environment_variables that let you control how Buildr works, for example, to skip test cases during a build, or specify options for the JVM. Depending on the variable, you may want to set it once in your environment, or set a different value each time you run Buildr.
287
229
 
288
230
  For example:
289
231
 
@@ -295,10 +237,7 @@ $ buildr TEST=no
295
237
 
296
238
  h2. Help Tasks
297
239
 
298
- Buildr includes a number of informative tasks. Currently that number stands at
299
- two, but we'll be adding more tasks in future releases. These tasks report
300
- information from the Buildfile, so you need one to run them. For more general
301
- help (version number, command line arguments, etc) use @buildr --help@.
240
+ Buildr includes a number of informative tasks. Currently that number stands at two, but we'll be adding more tasks in future releases. These tasks report information from the Buildfile, so you need one to run them. For more general help (version number, command line arguments, etc) use @buildr --help@.
302
241
 
303
242
  To start with, type:
304
243
 
@@ -306,8 +245,7 @@ To start with, type:
306
245
  $ buildr help
307
246
  }}}
308
247
 
309
- You can list the name and description of all your projects using the
310
- @help:projects@ task. For example:
248
+ You can list the name and description of all your projects using the @help:projects@ task. For example:
311
249
 
312
250
  {{{!sh
313
251
  $ buildr help:projects
@@ -317,32 +255,19 @@ killer-app:teh-impl # All those implementation details
317
255
  killer-app:la-web # What our users see
318
256
  }}}
319
257
 
320
- You are, of course, describing your projects for the sake of those who will
321
- maintain your code, right? To describe a project, or a task, call the @desc@
322
- method before the project or task definition.
258
+ 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.
323
259
 
324
260
  So next let's talk about "projects":projects.html.
325
261
 
326
262
 
327
263
  h2. Learning More
328
264
 
329
- *Ruby* It pays to pick up Ruby as a second (or first) programming language.
330
- It's fun, powerful and slightly addictive. If you're interested in learning
331
- Ruby the language, a good place to start is "Programming Ruby: The Pragmatic
332
- Programmer's Guide":http://www.pragprog.com/titles/ruby/programming-ruby,
333
- fondly known as the _Pickaxe book_.
265
+ *Ruby* It pays to pick up Ruby as a second (or first) programming language. It's fun, powerful and slightly addictive. If you're interested in learning Ruby the language, a good place to start is "Programming Ruby: The Pragmatic Programmer's Guide":http://www.pragprog.com/titles/ruby/programming-ruby, fondly known as the _Pickaxe book_.
334
266
 
335
- For a quicker read (and much more humor), "Why’s (Poignant) Guide to
336
- Ruby":http://poignantguide.net/ruby/ is available online. More resources are
337
- listed on the "ruby-lang web site":http://www.ruby-lang.org/en/documentation/.
267
+ For a quicker read (and much more humor), "Why’s (Poignant) Guide to Ruby":http://poignantguide.net/ruby/ is available online. More resources are listed on the "ruby-lang web site":http://www.ruby-lang.org/en/documentation/.
338
268
 
339
- *Rake* Buildr is based on Rake, a Ruby build system that handles tasks and
340
- dependencies. Check out the "Rake documentation":http://docs.rubyrake.org/ for
341
- more information.
269
+ *Rake* Buildr is based on Rake, a Ruby build system that handles tasks and dependencies. Check out the "Rake documentation":http://docs.rubyrake.org/ for more information.
342
270
 
343
- *AntWrap* Buildr uses AntWrap, for configuring and running Ant tasks. You can
344
- learn more from the "Antwrap documentation":http://antwrap.rubyforge.org/.
271
+ *AntWrap* Buildr uses AntWrap, for configuring and running Ant tasks. You can learn more from the "Antwrap documentation":http://antwrap.rubyforge.org/.
345
272
 
346
- *YAML* Buildr uses YAML for its profiles. You can "learn more about YAML
347
- here":http://www.yaml.org, and use this handy "YAML quick
348
- reference":http://www.yaml.org/refcard.html.
273
+ *YAML* Buildr uses YAML for its profiles. You can "learn more about YAML here":http://www.yaml.org, and use this handy "YAML quick reference":http://www.yaml.org/refcard.html.
@@ -1,63 +1,42 @@
1
1
  h1. Welcome
2
2
 
3
- Buildr is a build system for Java applications. We wanted something that's
4
- simple and intuitive to use, so we only need to tell it what to do, and it
5
- takes care of the rest. But also something we can easily extend for those
6
- one-off tasks, with a language that's a joy to use. And of course, we wanted
7
- it to be fast, reliable and have outstanding dependency management.
3
+ h2. What is Buildr?
4
+
5
+ Buildr is a build system for Java applications. 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.
8
6
 
9
7
  Here's what we got:
10
8
 
11
- * A simple way to specify projects, and build large projects out of smaller
12
- sub-projects.
13
- * Pre-canned tasks that require the least amount of configuration, keeping the
14
- build script DRY and simple.
15
- * Compiling, copying and filtering resources, JUnit/TestNG test cases, APT
16
- source code generation, Javadoc and more.
17
- * A dependency mechanism that only builds what has changed since the last
18
- release.
19
- * A drop-in replacement for Maven 2.0, Buildr uses the same file layout,
20
- artifact specifications, local and remote repositories.
21
- * All your Ant tasks belong to us! Anything you can do with Ant, you can do
22
- with Buildr.
23
- * No overhead for building "plugins" or configuration. Just write new tasks or
24
- functions.
25
- * Buildr is Ruby all the way down. No one-off task is too demanding when you
26
- write code using variables, functions and objects.
9
+ * A simple way to specify projects, and build large projects out of smaller sub-projects.
10
+ * Pre-canned tasks that require the least amount of configuration, keeping the build script DRY and simple.
11
+ * Compiling, copying and filtering resources, JUnit/TestNG test cases, APT source code generation, Javadoc and more.
12
+ * A dependency mechanism that only builds what has changed since the last release.
13
+ * A drop-in replacement for Maven 2.0, Buildr uses the same file layout, artifact specifications, local and remote repositories.
14
+ * All your Ant tasks belong to us! Anything you can do with Ant, you can do with Buildr.
15
+ * No overhead for building "plugins" or configuration. Just write new tasks or functions.
16
+ * Buildr is Ruby all the way down. No one-off task is too demanding when you write code using variables, functions and objects.
27
17
  * Simple way to upgrade to new versions.
28
18
  * Did we mention fast?
29
19
 
20
+ So let's get started. You can "read the documentation online":getting_started.html, or "download the PDF":buildr.pdf.
21
+
30
22
 
31
23
  h2. News
32
24
 
33
- Check out "all that's new in Buildr 1.3.2":whats_new.html.
34
-
35
- * Buildr 1.3 now runs on JRuby 1.1
36
- * Support for building Scala projects
37
- * Support for building Groovy projects
38
- * EAR packages
39
- * Behaviour-Driven Development frameworks
40
- * Profiles
41
- * New API for accessing Java libraries
42
- * Alternative source layouts
43
- * More documentation
25
+ Check out "all that's new in Buildr 1.3.3":whats_new.html.
26
+
27
+ * Buildr 1.3 now runs on JRuby 1.1 and Ruby 1.8.6.
28
+ * Support for building Scala and Groovy projects.
29
+ * Behavior-Driven Development frameworks (RSpec, JBehave, etc).
30
+ * Profiles and build.yml settings file.
31
+ * New API for accessing Java libraries.
32
+ * More documentation.
44
33
  * Other features and bug fixes.
45
34
 
46
35
 
47
36
  h2. Notices
48
37
 
49
- The Apache Software Foundation is a non-profit organization, consider
50
- "sponsoring":http://www.apache.org/foundation/sponsorship.html and check the
51
- "thanks":http://www.apache.org/foundation/thanks.html page.
52
-
53
- Apache Buildr is an effort undergoing incubation at The Apache Software
54
- Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of
55
- all newly accepted projects until a further review indicates that the
56
- infrastructure, communications, and decision making process have stabilized in
57
- a manner consistent with other successful ASF projects. While incubation status
58
- is not necessarily a reflection of the completeness or stability of the code,
59
- it does indicate that the project has yet to be fully endorsed by the ASF.
60
-
61
- "ColorCons":http://www.mouserunner.com/Spheres_ColoCons1_Free_Icons.html,
62
- copyright of Ken Saunders. "DejaVu fonts":http://dejavu.sourceforge.net,
63
- copyright of Bitstream, Inc.
38
+ 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.
39
+
40
+ Apache Buildr is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
41
+
42
+ "ColorCons":http://www.mouserunner.com/Spheres_ColoCons1_Free_Icons.html, copyright of Ken Saunders. "DejaVu fonts":http://dejavu.sourceforge.net, copyright of Bitstream, Inc.
@@ -0,0 +1,407 @@
1
+ h1. Languages
2
+
3
+
4
+ h2. Java
5
+
6
+
7
+ h3. Compiling Java
8
+
9
+ The Java compiler looks for source files in the project's @src/main/java@ directory, and defaults to compiling them into the @target/classes@ directory. It looks for test cases in the project's @src/test/java@ and defaults to compile them into the @target/test/classes@ directory.
10
+
11
+ If you point the @compile@ task at any other source directory, it will use the Java compiler if any of these directories contains files with the extension @.java@.
12
+
13
+ When using the Java compiler, if you don't specify the packaging type, it defaults to JAR. If you don't specify the test framework, it defaults to JUnit.
14
+
15
+ The Java compiler supports the following options:
16
+
17
+ |_. Option |_. Usage |
18
+ | @:debug@ | Generates bytecode with debugging information. You can also override this by setting the environment variable @debug@ to @off@. |
19
+ | @:deprecation@ | If true, shows deprecation messages. False by default. |
20
+ | @:lint@ | Defaults to false. Set this option to true to use all lint options, or specify a specific lint option (e.g. @:lint=>'cast'@). |
21
+ | @:other@ | Array of options passed to the compiler (e.g. @:other=>'-implicit:none'@). |
22
+ | @:source@ | Source code compatibility (e.g. '1.5'). |
23
+ | @:target@ | Bytecode compatibility (e.g. '1.4'). |
24
+ | @:warnings@ | Issue warnings when compiling. True when running in verbose mode. |
25
+
26
+
27
+ h3. Testing with Java
28
+
29
+ h4. JUnit
30
+
31
+ The default test framework for Java projects is "JUnit 4":http://www.junit.org.
32
+
33
+ When you use JUnit, the dependencies includes JUnit and "JMock":http://www.jmock.org, and Buildr picks up all test classes from the project by looking for classes that either subclass @junit.framework.TestCase@, include methods annotated with @org.junit.Test@, or test suites annotated with @org.org.junit.runner.RunWith@.
34
+
35
+ The JUnit test framework supports the following options:
36
+
37
+ |_. Option |_. Value |
38
+ | @:fork@ | VM forking, defaults to true. |
39
+ | @:clonevm@ | If true clone the VM each time it is forked. |
40
+ | @:properties@ | Hash of system properties available to the test case. |
41
+ | @:environment@ | Hash of environment variables available to the test case. |
42
+ | @:java_args@ | Arguments passed as is to the JVM. |
43
+
44
+ For example, to pass properties to the test case:
45
+
46
+ {{{!ruby
47
+ test.using :properties=>{ :currency=>'USD' }
48
+ }}}
49
+
50
+ 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.
51
+
52
+ |_. :fork=> |_. Behavior |
53
+ | @:once@ | Create one VM to run all test classes in the project, separate VMs for each project. |
54
+ | @:each@ | Create one VM for each test case class. Slow but provides the best isolation between test classes. |
55
+ | @false@ | Without forking, Buildr runs all test cases in a single VM. This option runs fastest, but at the risk of running out of memory and causing test cases to interfere with each other. |
56
+
57
+ You can see your tests running in the console, and if any tests fail, Buildr will show a list of the failed test classes. In addition, JUnit produces text and XML report files in the project's @reports/junit@ directory. You can use that to get around too-much-stuff-in-my-console, or when using an automated test system.
58
+
59
+ In addition, you can get a consolidated XML or HTML report by running the @junit:report@ task. For example:
60
+
61
+ {{{!sh
62
+ $ buildr test junit:report test=all
63
+ $ firefox report/junit/html/index.html
64
+ }}}
65
+
66
+ 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.
67
+
68
+ 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:
69
+
70
+ {{{!yaml
71
+ junit: 4.4
72
+ jmock: 2.0
73
+ }}}
74
+
75
+
76
+ h4. TestNG
77
+
78
+ You can use "TestNG":http://testng.org instead of JUnit. To select TestNG as the test framework, add this to your project:
79
+
80
+ {{{!ruby
81
+ test.using :testng
82
+ }}}
83
+
84
+ 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)
85
+
86
+ TestNG works much like JUnit, it gets included in the dependency list along with JMock, Buildr picks test classes that contain methods annotated with @org.testng.annotations.Test@, and generates test reports in the @reports/testng@ directory. At the moment we don't have consolidated HTML reports for TestNG.
87
+
88
+ The TestNG test framework supports the following options:
89
+
90
+ |_. Option |_. Value |
91
+ | @:properties@ | Hash of system properties available to the test case. |
92
+ | @:java_args@ | Arguments passed as is to the JVM. |
93
+
94
+ 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:
95
+
96
+ {{{!yaml
97
+ testng: 5.7
98
+ }}}
99
+
100
+
101
+ h4. JBehave
102
+
103
+ "JBehave":http://jbehave.org/ is a pure Java BDD framework, stories and behaviour specifications are written in the Java language.
104
+
105
+ To use JBehave in your project you can select it with @test.using :jbehave@.
106
+
107
+ This framework will search for the following patterns under your project:
108
+
109
+ {{{
110
+ src/spec/java/**/*Behaviour.java
111
+ }}}
112
+
113
+ Supports the following options:
114
+
115
+ |_. Option |_. Value |
116
+ | @:properties@ | Hash of system properties available to the test case. |
117
+ | @:java_args@ | Arguments passed as is to the JVM. |
118
+
119
+ 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:
120
+
121
+ {{{!yaml
122
+ jbehave: 1.0.1
123
+ }}}
124
+
125
+
126
+ h2. Scala
127
+
128
+ Before using Scala features, you must first set the @SCALA_HOME@ environment variable to point to the root of your Scala distribution.
129
+
130
+ On Windows:
131
+
132
+ {{{!sh
133
+ > set SCALA_HOME=C:\Path\To\Scala-2.7.1
134
+ }}}
135
+
136
+ On Linux and other Unix variants,
137
+
138
+ {{{!sh
139
+ > export SCALA_HOME=/path/to/scala-2.7.1
140
+ }}}
141
+
142
+ 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.
143
+
144
+ h3. Compiling Scala
145
+
146
+ The Scala compiler looks for source files in the project's @src/main/scala@ directory, and defaults to compiling them into the @target/classes@ directory. It looks for test cases in the project's @src/test/scala@ and defaults to compile them into the @target/test/classes@ directory.
147
+
148
+ If you point the @compile@ task at any other source directory, it will use the Scala compiler if any of these directories contains files with the extension @.scala@.
149
+
150
+ When using the Scala compiler, if you don't specify the packaging type, it defaults to JAR.
151
+
152
+ The Scala compiler supports the following options:
153
+
154
+ |_. Option |_. Usage |
155
+ | @:debug@ | Generates bytecode with debugging information. You can also override this by setting the environment variable @debug@ to @off@. |
156
+ | @:deprecation@ | If true, shows deprecation messages. False by default. |
157
+ | @:optimise@ | Generates faster bytecode by applying optimisations to the program. |
158
+ | @:other@ | Array of options passed to the compiler (e.g. @:other=>'-Xprint-types'@). |
159
+ | @:target@ | Bytecode compatibility (e.g. '1.4'). |
160
+ | @:warnings@ | Issue warnings when compiling. True when running in verbose mode. |
161
+
162
+ h4. Fast Scala Compiler
163
+
164
+ You may use @fsc@, the Fast Scala Compiler, which submits compilation jobs to a compilation daemon, by setting the environment variable @USE_FSC@ to @yes@. Note that @fsc@ _may_ cache class libraries -- don't forget to run @fsc -reset@ if you upgrade a library.
165
+
166
+ h4. Rebuild detection
167
+
168
+ The Scala compiler task assumes that each @.scala@ source file generates a corresponding @.class@ file under @target/classes@ (or @target/test/classses@ for tests). The source may generate more @.class@ files if it contains more than one class, object, trait or for anonymous functions and closures.
169
+
170
+ For example, @src/main/scala/com/example/MyClass.scala@ should generate at least @target/classes/com/example/MyClass.class@. If that it not the case, Buildr will always recompile your sources because it will assume this is a new source file that has never been compiled before.
171
+
172
+ h3. Testing with Scala
173
+
174
+ Buildr supports three Scala testing frameworks: "ScalaTest":http://www.artima.com/scalatest, "ScalaCheck":http://code.google.com/p/scalacheck/ and "Specs":http://code.google.com/p/specs/.
175
+
176
+ Scala testing is automatically enabled if you have any @.scala@ source files under @src/test/scala@. If you are not using this convention, you can explicit set the test framework by doing,
177
+
178
+ {{{!ruby
179
+ test.using(:scalatest)
180
+ }}}
181
+
182
+ The @:scalatest@ test framework handles ScalaTest, Specs and ScalaCheck therefore all 3 frameworks may be used within the same project.
183
+
184
+ h4. ScalaTest
185
+
186
+ Buildr automatically detects and runs tests that extend the @org.scalatest.Suite@ interface.
187
+
188
+ A very simplistic test class might look like,
189
+
190
+ {{{!scala
191
+ class MySuite extends org.scalatest.FunSuite {
192
+ test("addition") {
193
+ val sum = 1 + 1
194
+ assert(sum === 2)
195
+ }
196
+ }
197
+ }}}
198
+
199
+ 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:
200
+
201
+ {{{!scala
202
+ import org.scalatest._
203
+
204
+ class PropertyTestSuite extends FunSuite {
205
+ var properties = Map[String, Any]()
206
+
207
+ test("testProperty") {
208
+ assert(properties("name") === "value")
209
+ }
210
+
211
+ protected override def runTests(testName: Option[String],
212
+ reporter: Reporter, stopper: Stopper, includes: Set[String],
213
+ excludes: Set[String], properties: Map[String, Any])
214
+ {
215
+ this.properties = properties;
216
+ super.runTests(testName, reporter, stopper,
217
+ includes, excludes, properties)
218
+ }
219
+ }
220
+ }}}
221
+
222
+ h4. Specs
223
+
224
+ The @:scalatest@ framework currently recognizes specifications with class names ending with "Specs", e.g., org.example.StringSpecs.
225
+
226
+ A simple specification might look like this:
227
+
228
+ {{{!scala
229
+ import org.specs._
230
+ import org.specs.runner._
231
+
232
+ object StringSpecs extends Specification {
233
+ "empty string" should {
234
+ "have a zero length" in {
235
+ ("".length) mustEqual(0)
236
+ }
237
+ }
238
+ }
239
+ }}}
240
+
241
+ h4. ScalaCheck
242
+
243
+ You may use ScalaCheck inside ScalaTest- and Specs-inherited classes. Here is an example illustrating checks inside a ScalaTest suite,
244
+
245
+ {{{!scala
246
+ import org.scalatest.prop.PropSuite
247
+ import org.scalacheck.Arbitrary._
248
+ import org.scalacheck.Prop._
249
+
250
+ class MySuite extends PropSuite {
251
+
252
+ test("list concatenation") {
253
+ val x = List(1, 2, 3)
254
+ val y = List(4, 5, 6)
255
+ assert(x ::: y === List(1, 2, 3, 4, 5, 6))
256
+ check((a: List[Int], b: List[Int]) => a.size + b.size == (a ::: b).size)
257
+ }
258
+
259
+ test(
260
+ "list concatenation using a test method",
261
+ (a: List[Int], b: List[Int]) => a.size + b.size == (a ::: b).size
262
+ )
263
+ }
264
+ }}}
265
+
266
+
267
+ h2. Groovy
268
+
269
+ h3. Compiling Groovy
270
+
271
+ Before using the Groovy compiler, you must first require it on your buildfile:
272
+
273
+ {{{!ruby
274
+ require 'buildr/java/groovyc'
275
+ }}}
276
+
277
+ 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.
278
+
279
+ If the project has java sources in @src/main/java@ they will get compiled using the groovyc joint compiler.
280
+
281
+ Sources found in @src/test/groovy@ are compiled into the @target/test/classes@.
282
+
283
+ If you don't specify the packaging type, it defaults to JAR.
284
+
285
+ The Groovy compiler supports the following options:
286
+
287
+ |_. Option |_. Usage |
288
+ | @encoding@ | Encoding of source files. |
289
+ | @verbose@ | Asks the compiler for verbose output, true when running in verbose mode. |
290
+ | @fork@ | Whether to execute groovyc using a spawned instance of the JVM. Defaults to no. |
291
+ | @memoryInitialSize@ | The initial size of the memory for the underlying VM, if using fork mode, ignored otherwise. Defaults to the standard VM memory setting. (Examples: @83886080@, @81920k@, or @80m@) |
292
+ | @memoryMaximumSize@ | The maximum size of the memory for the underlying VM, if using fork mode, ignored otherwise. Defaults to the standard VM memory setting. (Examples: @83886080@, @81920k@, or @80m@) |
293
+ | @listfiles@ | Indicates whether the source files to be compiled will be listed. Defaults to no. |
294
+ | @stacktrace@ | If true each compile error message will contain a stacktrace. |
295
+ | @warnings@ | Issue warnings when compiling. True when running in verbose mode. |
296
+ | @debug@ | Generates bytecode with debugging information. Set from the debug environment variable/global option. |
297
+ | @deprecation@ | If true, shows deprecation messages. False by default. |
298
+ | @optimise@ | Generates faster bytecode by applying optimisations to the program. |
299
+ | @source@ | Source code compatibility. |
300
+ | @target@ | Bytecode compatibility. |
301
+ | @javac@ | Hash of options passed to the ant javac task. |
302
+
303
+
304
+ h3. Testing with Groovy
305
+
306
+ h4. EasyB
307
+
308
+ "EasyB":http://www.easyb.org/ is a BDD framework using "Groovy":http://groovy.codehaus.org/.
309
+
310
+ Specifications are written in the Groovy language, of course you get seamless Java integration as with all things groovy.
311
+
312
+ To use this framework in your project you can select it with @test.using :easyb@.
313
+
314
+ This framework will search for the following patterns under your project:
315
+
316
+ {{{
317
+ src/spec/groovy/**/*Behavior.groovy
318
+ src/spec/groovy/**/*Story.groovy
319
+ }}}
320
+
321
+ Supports the following options:
322
+
323
+ |_. Option |_. Value |
324
+ | @:properties@ | Hash of system properties available to the test case. |
325
+ | @:java_args@ | Arguments passed as is to the JVM. |
326
+ | @:format@ | Report format, either @:txt@ or @:xml@ |
327
+
328
+
329
+ h2. Ruby
330
+
331
+ h3. Testing with Ruby
332
+
333
+ Buildr provides integration with some ruby testing frameworks, allowing you to test your Java code with state of the art tools.
334
+
335
+ Testing code is written in "Ruby":http://www.ruby-lang.org/en/ language, and is run by using "JRuby":http://jruby.codehaus.org/.That means you have access to all your Java classes and any Java or Ruby tool out there.
336
+
337
+ Because of the use of JRuby, you will notice that running ruby tests is faster when running Buildr on JRuby, as in this case there's no need to run another JVM.
338
+
339
+ p(tip). When not running on JRuby, Buildr will use the @JRUBY_HOME@ environment variable to find the JRuby installation directory. If no @JRUBY_HOME@ is set or it points to an empty directory, Buildr will prompt you to either install JRuby manually or let it extract it for you.
340
+
341
+ You can use the @build.yaml@ settings file to specify a particular version of JRuby (defaults to @1.1.4@). For example:
342
+
343
+ {{{!yaml
344
+ jruby: 1.1.3
345
+ }}}
346
+
347
+ h4. RSpec
348
+
349
+ "RSpec":http://rspec.info/ is the de-facto BDD framework for ruby. It's the framework used to test Buildr itself.
350
+
351
+ To use this framework in your project you can select it with @test.using :rspec@.
352
+
353
+ This framework will search for the following patterns under your project:
354
+
355
+ {{{
356
+ src/spec/ruby/**/*_spec.rb
357
+ }}}
358
+
359
+ Supports the following options:
360
+
361
+ |_. Option |_. Value |
362
+ | @:gems@ | Hash of gems needed before running the tests. Keys are gem names, values are the required gem version. An example use of this option would be to require the ci_reporter gem to generate xml reports |
363
+ | @:requires@ | Array of ruby files to require before running the specs |
364
+ | @:format@ | Array of valid RSpec @--format@ option values. Defaults to html report on the @reports@ directory and text progress |
365
+ | @:output@ | File path to output dump. @false@ to supress output |
366
+ | @:fork@ | Run the tests on a new java vm. (enabled unless running on JRuby) |
367
+ | @:properties@ | Hash of system properties available to the test case. |
368
+ | @:java_args@ | Arguments passed as is to the JVM. (only when fork is enabled) |
369
+
370
+ h4. JtestR
371
+
372
+ "JtestR":http://jtestr.codehaus.org is a tool that makes it easier to test Java code with state of the art Ruby tools. Using JtestR you can describe your application behaviour using many testing frameworks at the same time.
373
+
374
+ To use this framework in your project you can select it with @test.using :jtestr@.
375
+
376
+ You can use the @build.yaml@ settings file to specify a particular version of JtestR (defaults to @0.3.1@). For example:
377
+
378
+ {{{!yaml
379
+ jtestr: 0.3.1
380
+ }}}
381
+
382
+ To customize TestNG/JUnit versions refer to their respective section.
383
+
384
+ When selected, Buildr will configure JtestR to use your project/testing classpath and will search for the following test patterns for each framework supported by JtestR:
385
+
386
+ |_. Framework |_. Patterns |
387
+ | "RSpec":http://rspec.info | Files in @src/spec/ruby@ ending with @*_spec.rb@ or @*_story.rb@ |
388
+ | "TestUnit":http://ruby-doc.org/stdlib/libdoc/test/unit/rdoc/classes/Test/Unit.html | Files in @src/spec/ruby@ ending with @*_test.rb@, @*Test.rb@ |
389
+ | "Expectations":http://expectations.rubyforge.org/ | Files in @src/spec/ruby@ ending with @*_expect.rb@ |
390
+ | "JUnit":http://www.junit.org | Classes from @src/test/java@ that either subclass @junit.framework.TestCase@, include methods annotated with @org.junit.Test@, or test suites annotated with @org.org.junit.runner.RunWith@. |
391
+ | "TestNG":http://testng.org | Classes from @src/test/java@ annotated with @org.testng.annotations.Test@ |
392
+
393
+ If you create a @src/spec/ruby/jtestr_config.rb@ file, it will be loaded by JtestR, just after being configured by Buildr, this way you can configure as described on "JtestR guide":http://jtestr.codehaus.org/Configuration.
394
+
395
+ p(tip). If you have a @jtestr_config.rb@ file, don't set @JtestR::result_handler@. Buildr uses its (@RSpecResultHandler@) so that it can know which tests succeeded/failed, this handler is capable of using RSpec formatter classes, so that you can obtain an html report or use a custom rspec formatter with @JtestR@. See the @format@ option.
396
+
397
+ Supports the following options:
398
+
399
+ |_. Option |_. Value |
400
+ | @:config@ | The JtestR config file to be loaded after being configured by Buildr. Defaults to @src/spec/ruby/jtestr_config.rb@. |
401
+ | @:gems@ | Hash of gems needed before running the tests. Keys are gem names, values are the required gem version. An example use of this option would be to require the ci_reporter gem to generate xml reports |
402
+ | @:requires@ | Array of ruby files to require before running the specs |
403
+ | @:format@ | Array of valid RSpec @--format@ option values. Defaults to html report on the @reports@ directory and text progress |
404
+ | @:output@ | File path to output dump. @false@ to supress output |
405
+ | @:fork@ | Run the tests on a new java vm. (enabled unless running on JRuby) |
406
+ | @:properties@ | Hash of system properties available to the test case. (only when fork is enabled) |
407
+ | @:java_args@ | Arguments passed as is to the JVM. (only when fork is enabled) |