buildr 1.3.5-x86-mswin32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (186) hide show
  1. data/CHANGELOG +998 -0
  2. data/LICENSE +176 -0
  3. data/NOTICE +26 -0
  4. data/README.rdoc +134 -0
  5. data/Rakefile +45 -0
  6. data/_buildr +29 -0
  7. data/_jbuildr +29 -0
  8. data/addon/buildr/antlr.rb +65 -0
  9. data/addon/buildr/cobertura.rb +22 -0
  10. data/addon/buildr/drb.rb +281 -0
  11. data/addon/buildr/emma.rb +22 -0
  12. data/addon/buildr/hibernate.rb +142 -0
  13. data/addon/buildr/javacc.rb +85 -0
  14. data/addon/buildr/jdepend.rb +60 -0
  15. data/addon/buildr/jetty.rb +248 -0
  16. data/addon/buildr/jibx.rb +86 -0
  17. data/addon/buildr/nailgun.rb +221 -0
  18. data/addon/buildr/openjpa.rb +90 -0
  19. data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
  20. data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
  21. data/addon/buildr/org/apache/buildr/BuildrNail.java +41 -0
  22. data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
  23. data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
  24. data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
  25. data/addon/buildr/org/apache/buildr/JettyWrapper.java +144 -0
  26. data/addon/buildr/xmlbeans.rb +93 -0
  27. data/bin/buildr +19 -0
  28. data/buildr.buildfile +58 -0
  29. data/buildr.gemspec +65 -0
  30. data/doc/_config.yml +1 -0
  31. data/doc/_layouts/default.html +88 -0
  32. data/doc/_layouts/preface.html +22 -0
  33. data/doc/artifacts.textile +211 -0
  34. data/doc/building.textile +244 -0
  35. data/doc/contributing.textile +252 -0
  36. data/doc/css/default.css +236 -0
  37. data/doc/css/print.css +101 -0
  38. data/doc/css/syntax.css +23 -0
  39. data/doc/download.textile +79 -0
  40. data/doc/extending.textile +186 -0
  41. data/doc/images/1442160941-frontcover.jpg +0 -0
  42. data/doc/images/asf-logo.gif +0 -0
  43. data/doc/images/asf-logo.png +0 -0
  44. data/doc/images/buildr-hires.png +0 -0
  45. data/doc/images/buildr.png +0 -0
  46. data/doc/images/favicon.png +0 -0
  47. data/doc/images/growl-icon.tiff +0 -0
  48. data/doc/images/note.png +0 -0
  49. data/doc/images/project-structure.png +0 -0
  50. data/doc/images/tip.png +0 -0
  51. data/doc/images/zbuildr.png +0 -0
  52. data/doc/images/zbuildr.tif +0 -0
  53. data/doc/index.textile +69 -0
  54. data/doc/installing.textile +266 -0
  55. data/doc/languages.textile +459 -0
  56. data/doc/mailing_lists.textile +25 -0
  57. data/doc/more_stuff.textile +457 -0
  58. data/doc/packaging.textile +430 -0
  59. data/doc/preface.textile +54 -0
  60. data/doc/projects.textile +271 -0
  61. data/doc/quick_start.textile +210 -0
  62. data/doc/scripts/buildr-git.rb +512 -0
  63. data/doc/scripts/gitflow.rb +296 -0
  64. data/doc/scripts/install-jruby.sh +44 -0
  65. data/doc/scripts/install-linux.sh +72 -0
  66. data/doc/scripts/install-osx.sh +52 -0
  67. data/doc/settings_profiles.textile +280 -0
  68. data/doc/testing.textile +222 -0
  69. data/etc/KEYS +151 -0
  70. data/lib/buildr.rb +36 -0
  71. data/lib/buildr/core.rb +35 -0
  72. data/lib/buildr/core/application.rb +656 -0
  73. data/lib/buildr/core/build.rb +452 -0
  74. data/lib/buildr/core/checks.rb +254 -0
  75. data/lib/buildr/core/common.rb +150 -0
  76. data/lib/buildr/core/compile.rb +608 -0
  77. data/lib/buildr/core/environment.rb +129 -0
  78. data/lib/buildr/core/filter.rb +362 -0
  79. data/lib/buildr/core/generate.rb +195 -0
  80. data/lib/buildr/core/help.rb +119 -0
  81. data/lib/buildr/core/osx.rb +46 -0
  82. data/lib/buildr/core/progressbar.rb +156 -0
  83. data/lib/buildr/core/project.rb +866 -0
  84. data/lib/buildr/core/shell.rb +198 -0
  85. data/lib/buildr/core/test.rb +723 -0
  86. data/lib/buildr/core/transports.rb +559 -0
  87. data/lib/buildr/core/util.rb +449 -0
  88. data/lib/buildr/groovy.rb +19 -0
  89. data/lib/buildr/groovy/bdd.rb +106 -0
  90. data/lib/buildr/groovy/compiler.rb +138 -0
  91. data/lib/buildr/groovy/shell.rb +48 -0
  92. data/lib/buildr/ide.rb +19 -0
  93. data/lib/buildr/ide/eclipse.rb +334 -0
  94. data/lib/buildr/ide/eclipse/java.rb +53 -0
  95. data/lib/buildr/ide/eclipse/plugin.rb +68 -0
  96. data/lib/buildr/ide/eclipse/scala.rb +66 -0
  97. data/lib/buildr/ide/idea.ipr.template +300 -0
  98. data/lib/buildr/ide/idea.rb +190 -0
  99. data/lib/buildr/ide/idea7x.ipr.template +290 -0
  100. data/lib/buildr/ide/idea7x.rb +212 -0
  101. data/lib/buildr/java.rb +23 -0
  102. data/lib/buildr/java/ant.rb +94 -0
  103. data/lib/buildr/java/bdd.rb +459 -0
  104. data/lib/buildr/java/cobertura.rb +274 -0
  105. data/lib/buildr/java/commands.rb +213 -0
  106. data/lib/buildr/java/compiler.rb +349 -0
  107. data/lib/buildr/java/deprecated.rb +141 -0
  108. data/lib/buildr/java/emma.rb +244 -0
  109. data/lib/buildr/java/jruby.rb +117 -0
  110. data/lib/buildr/java/jtestr_runner.rb.erb +116 -0
  111. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
  112. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +137 -0
  113. data/lib/buildr/java/packaging.rb +716 -0
  114. data/lib/buildr/java/pom.rb +174 -0
  115. data/lib/buildr/java/rjb.rb +155 -0
  116. data/lib/buildr/java/test_result.rb +353 -0
  117. data/lib/buildr/java/tests.rb +333 -0
  118. data/lib/buildr/java/version_requirement.rb +172 -0
  119. data/lib/buildr/packaging.rb +24 -0
  120. data/lib/buildr/packaging/archive.rb +488 -0
  121. data/lib/buildr/packaging/artifact.rb +749 -0
  122. data/lib/buildr/packaging/artifact_namespace.rb +972 -0
  123. data/lib/buildr/packaging/artifact_search.rb +140 -0
  124. data/lib/buildr/packaging/gems.rb +102 -0
  125. data/lib/buildr/packaging/package.rb +238 -0
  126. data/lib/buildr/packaging/tar.rb +186 -0
  127. data/lib/buildr/packaging/version_requirement.rb +172 -0
  128. data/lib/buildr/packaging/zip.rb +73 -0
  129. data/lib/buildr/packaging/ziptask.rb +316 -0
  130. data/lib/buildr/resources/buildr.icns +0 -0
  131. data/lib/buildr/scala.rb +25 -0
  132. data/lib/buildr/scala/bdd.rb +109 -0
  133. data/lib/buildr/scala/compiler.rb +195 -0
  134. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner$.class +0 -0
  135. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
  136. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.scala +35 -0
  137. data/lib/buildr/scala/shell.rb +55 -0
  138. data/lib/buildr/scala/tests.rb +157 -0
  139. data/lib/buildr/shell.rb +180 -0
  140. data/rakelib/checks.rake +57 -0
  141. data/rakelib/doc.rake +92 -0
  142. data/rakelib/jekylltask.rb +120 -0
  143. data/rakelib/package.rake +73 -0
  144. data/rakelib/release.rake +149 -0
  145. data/rakelib/rspec.rake +73 -0
  146. data/rakelib/setup.rake +54 -0
  147. data/rakelib/stage.rake +213 -0
  148. data/rakelib/stage.rake~ +213 -0
  149. data/spec/addon/drb_spec.rb +328 -0
  150. data/spec/core/application_spec.rb +502 -0
  151. data/spec/core/build_spec.rb +677 -0
  152. data/spec/core/checks_spec.rb +519 -0
  153. data/spec/core/common_spec.rb +670 -0
  154. data/spec/core/compile_spec.rb +583 -0
  155. data/spec/core/extension_spec.rb +93 -0
  156. data/spec/core/generate_spec.rb +33 -0
  157. data/spec/core/project_spec.rb +762 -0
  158. data/spec/core/test_spec.rb +1098 -0
  159. data/spec/core/transport_spec.rb +537 -0
  160. data/spec/core/util_spec.rb +67 -0
  161. data/spec/groovy/bdd_spec.rb +80 -0
  162. data/spec/groovy/compiler_spec.rb +240 -0
  163. data/spec/ide/eclipse_spec.rb +501 -0
  164. data/spec/ide/idea7x_spec.rb +84 -0
  165. data/spec/java/ant_spec.rb +33 -0
  166. data/spec/java/bdd_spec.rb +382 -0
  167. data/spec/java/cobertura_spec.rb +85 -0
  168. data/spec/java/compiler_spec.rb +446 -0
  169. data/spec/java/emma_spec.rb +119 -0
  170. data/spec/java/java_spec.rb +124 -0
  171. data/spec/java/packaging_spec.rb +1134 -0
  172. data/spec/java/test_coverage_helper.rb +257 -0
  173. data/spec/java/tests_spec.rb +493 -0
  174. data/spec/packaging/archive_spec.rb +527 -0
  175. data/spec/packaging/artifact_namespace_spec.rb +654 -0
  176. data/spec/packaging/artifact_spec.rb +795 -0
  177. data/spec/packaging/packaging_helper.rb +63 -0
  178. data/spec/packaging/packaging_spec.rb +684 -0
  179. data/spec/sandbox.rb +142 -0
  180. data/spec/scala/bdd_spec.rb +119 -0
  181. data/spec/scala/compiler_spec.rb +284 -0
  182. data/spec/scala/scala.rb +38 -0
  183. data/spec/scala/tests_spec.rb +261 -0
  184. data/spec/spec_helpers.rb +340 -0
  185. data/spec/version_requirement_spec.rb +129 -0
  186. metadata +383 -0
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
data/doc/index.textile ADDED
@@ -0,0 +1,69 @@
1
+ ---
2
+ layout: default
3
+ title: Apache Buildr
4
+ ---
5
+
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.
7
+
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
32
+
33
+ * A simple way to specify projects, and build large projects out of smaller sub-projects.
34
+ * Pre-canned tasks that require the least amount of configuration, keeping the build script DRY and simple.
35
+ * Compiling, copying and filtering resources, JUnit/TestNG test cases, APT source code generation, Javadoc and more.
36
+ * A dependency mechanism that only builds what has changed since the last release.
37
+ * A drop-in replacement for Maven 2.0, Buildr uses the same file layout, artifact specifications, local and remote repositories.
38
+ * All your Ant tasks are belong to us! Anything you can do with Ant, you can do with Buildr.
39
+ * No overhead for building "plugins" or configuration. Just write new tasks or functions.
40
+ * Buildr is Ruby all the way down. No one-off task is too demanding when you write code using variables, functions and objects.
41
+ * Simple way to upgrade to new versions.
42
+ * Did we mention fast?
43
+
44
+ So let's get started. You can "read the documentation online":quick_start.html, or "download the PDF":buildr.pdf.
45
+
46
+
47
+ h2(#news). What's New
48
+
49
+ New in Buildr 1.3.5:
50
+
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.
57
+
58
+ See the "CHANGELOG":CHANGELOG for full details.
59
+
60
+
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
64
+
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.
66
+
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.
@@ -0,0 +1,266 @@
1
+ ---
2
+ layout: default
3
+ title: Installing and Running
4
+ ---
5
+
6
+
7
+ *The easy way:* We recommend you pick the platform you want to run Buildr on and then follow the _easy way_ instructions for that platform. It could save you an hour or two struggling to install all the right dependencies.
8
+
9
+ "Installing Buildr for JRuby":#jruby is the same on all operating systems. Choose JRuby if you're working with Java 6 on OS X, developing with multiple JDKs, or just like JRuby better.
10
+
11
+ If you are running behind a proxy server, make sure the environment variable @HTTP_PROXY@ is set, as many of these steps require HTTP access.
12
+
13
+ <br>
14
+
15
+ *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.
16
+
17
+ 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.
18
+
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
+
21
+ h2(#linux). Installing on Linux
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@, @yum@ or @urpmi@) and upgrade to RubyGems 1.3.1 or later.
24
+
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
+
27
+ <br>
28
+
29
+ *In details:* 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).
30
+
31
+ On *RedHat/Fedora* you can use yum to install Ruby and RubyGems, and then upgrade to the most recent version of RubyGems:
32
+
33
+ {% highlight sh %}
34
+ $ sudo yum install ruby rubygems ruby-devel gcc
35
+ $ sudo gem update --system
36
+ {% endhighlight %}
37
+
38
+ On *Ubuntu* you have to install several packages:
39
+
40
+ {% highlight sh %}
41
+ $ sudo apt-get install ruby-full ruby1.8-dev libopenssl-ruby build-essential
42
+ {% endhighlight %}
43
+
44
+ The Debian package for @rubygems@ will not allow you to install Buildr, so you need to install RubyGems from source:
45
+
46
+ {% highlight sh %}
47
+ $ wget http://rubyforge.org/frs/download.php/45905/rubygems-1.3.1.tgz
48
+ $ tar xzf rubygems-1.3.1.tgz
49
+ $ cd rubygems-1.3.1
50
+ $ sudo ruby setup.rb
51
+ $ sudo ln -s /usr/bin/gem1.8 /usr/bin/gem
52
+ {% endhighlight %}
53
+
54
+ Before installing Buildr, please set the @JAVA_HOME@ environment variable to point to your JDK distribution. Next, use Ruby Gem to install Buildr:
55
+
56
+ {% highlight sh %}
57
+ $ sudo env JAVA_HOME=$JAVA_HOME gem install buildr
58
+ {% endhighlight %}
59
+
60
+ To upgrade to a new version or install a specific version:
61
+
62
+ {% highlight sh %}
63
+ $ sudo env JAVA_HOME=$JAVA_HOME gem update buildr
64
+ $ sudo env JAVA_HOME=$JAVA_HOME gem install buildr -v 1.3.4
65
+ {% endhighlight %}
66
+
67
+
68
+
69
+ h2(#osx). Installing on OS X
70
+
71
+ *The easy way:* Use this script to "install Buildr on OS X":scripts/install-osx.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 (using MacPorts/Fink) and upgrage RubyGems to 1.3.1 or later.
72
+
73
+ <br>
74
+
75
+ *In details:* OS X 10.5 (Leopard) comes with a recent version of Ruby 1.8.6. You do not need to install a different version of Ruby when running OS X 10.5.
76
+
77
+ OS X 10.4 (Tiger) includes an older version of Ruby that is not compatible with Buildr. You can 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/.
78
+
79
+ We recommend you first upgrade to the latest version of Ruby gems:
80
+
81
+ {% highlight sh %}
82
+ $ sudo gem update --system
83
+ {% endhighlight %}
84
+
85
+ Before installing Buildr, please set the @JAVA_HOME@ environment variable to point to your JDK distribution:
86
+
87
+ {% highlight sh %}
88
+ $ export JAVA_HOME=/Library/Java/Home
89
+ {% endhighlight %}
90
+
91
+ To install Buildr:
92
+
93
+ {% highlight sh %}
94
+ $ sudo env JAVA_HOME=$JAVA_HOME gem install buildr
95
+ {% endhighlight %}
96
+
97
+ To upgrade to a new version or install a specific version:
98
+
99
+ {% highlight sh %}
100
+ $ sudo env JAVA_HOME=$JAVA_HOME gem update buildr
101
+ $ sudo env JAVA_HOME=$JAVA_HOME gem install buildr -v 1.3.4
102
+ {% endhighlight %}
103
+
104
+
105
+ h2(#windows). Installing on Windows
106
+
107
+ *The easy way:* The easiest way to install Ruby is using the "one-click installer":http://rubyinstaller.rubyforge.org/. Once installed, set the @JAVA_HOME@ environment variable and run @gem install buildr@.
108
+
109
+ <br>
110
+
111
+ *In details:* We recommend you first upgrade to the latest version of Ruby gems:
112
+
113
+ {% highlight sh %}
114
+ > gem update --system
115
+ {% endhighlight %}
116
+
117
+ Before installing Buildr, please set the @JAVA_HOME@ environment variable to point to your JDK distribution. Next, use Ruby Gem to install Buildr:
118
+
119
+ {% highlight sh %}
120
+ > gem install buildr
121
+ {% endhighlight %}
122
+
123
+ To upgrade to a new version or install a specific version:
124
+
125
+ {% highlight sh %}
126
+ > gem update buildr
127
+ > gem install buildr -v 1.3.4
128
+ {% endhighlight %}
129
+
130
+
131
+ h2(#jruby). Installing for JRuby
132
+
133
+ *The easy way:* Use this bash script to "install Buildr on JRuby":scripts/install-jruby.sh. This script will install the most recent version of Buildr, or if already installed, upgrade to the most recent version. If necessary, it will also install JRuby 1.1.6 in @/opt/jruby@ and update the @PATH@ variable in @~/.bash_profile@ or @~/.profile@.
134
+
135
+ <br>
136
+
137
+ *In details:* If you don't already have JRuby 1.1.6 or later installed, you can download it from the "JRuby site":http://dist.codehaus.org/jruby/.
138
+
139
+ After uncompressing JRuby, update your @PATH@ to include both @java@ and @jruby@ executables.
140
+
141
+ For Linux and OS X:
142
+
143
+ {% highlight sh %}
144
+ $ export PATH=$PATH:[path to JRuby]/bin:$JAVA_HOME/bin
145
+ $ jruby -S gem install buildr
146
+ {% endhighlight %}
147
+
148
+ For Windows:
149
+
150
+ {% highlight sh %}
151
+ > set PATH=%PATH%;[path to JRuby]/bin;%JAVA_HOME%/bin
152
+ > jruby -S gem install buildr
153
+ {% endhighlight %}
154
+
155
+ To upgrade to a new version or install a specific version:
156
+
157
+ {% highlight sh %}
158
+ $ jruby -S gem update buildr
159
+ $ jruby -S gem install buildr -v 1.3.4
160
+ {% endhighlight %}
161
+
162
+
163
+ *Important: Running JRuby and Ruby side by side*
164
+
165
+ 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.
166
+
167
+ 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.
168
+
169
+ To work exclusively with JRuby, make sure it shows first on the path, for example, by setting @PATH=/opt/jruby/bin:$PATH@.
170
+
171
+ You can use JRuby and Ruby side by side, by running scripts with the @-S@ command line argument. For example:
172
+
173
+ {% highlight sh %}
174
+ $ # with Ruby
175
+ $ ruby -S gem install buildr
176
+ $ ruby -S buildr
177
+ $ # with JRuby
178
+ $ jruby -S gem install buildr
179
+ $ jruby -S buildr
180
+ {% endhighlight %}
181
+
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.
183
+
184
+
185
+ h2(#running). Running Buildr
186
+
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@.
188
+
189
+ 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@.
190
+
191
+ You use Buildr by running the @buildr@ command:
192
+
193
+ {% highlight sh %}
194
+ $ buildr [options] [tasks] [name=value]
195
+ {% endhighlight %}
196
+
197
+ There are several options you can use, for a full list of options type @buildr --help@:
198
+
199
+ |_. Option |_. Usage |
200
+ | @-f/--buildfile [file]@ | Specify the buildfile. |
201
+ | @-e/--environment [name]@ | Environment name (e.g. development, test, production). |
202
+ | @-h/--help@ | Display this help message. |
203
+ | @-n/--nosearch@ | Do not search parent directories for the buildfile. |
204
+ | @-q/--quiet@ | Do not log messages to standard output. |
205
+ | @-r/--require [file]@ | Require MODULE before executing buildfile. |
206
+ | @-t/--trace@ | Turn on invoke/execute tracing, enable full backtrace. |
207
+ | @-v/--version@ | Display the program version. |
208
+ | @-P/--prereqs@ | Display tasks and dependencies, then exit. |
209
+
210
+ You can tell Buildr to run specific tasks and the order to run them. For example:
211
+
212
+ {% highlight sh %}
213
+ # Clean and rebuild
214
+ buildr clean build
215
+ # Package and install
216
+ buildr install
217
+ {% endhighlight %}
218
+
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@.
220
+
221
+ There are several "environment variables":settings_profiles.html#env_vars 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.
222
+
223
+ For example:
224
+
225
+ {% highlight sh %}
226
+ $ export JAVA_OPTS='-Xms1g -Xmx1g'
227
+ $ buildr TEST=no
228
+ {% endhighlight %}
229
+
230
+
231
+ h2(#help). Help Tasks
232
+
233
+ 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@.
234
+
235
+ To start with, type:
236
+
237
+ {% highlight sh %}
238
+ $ buildr help
239
+ {% endhighlight %}
240
+
241
+ You can list the name and description of all your projects using the @help:projects@ task. For example:
242
+
243
+ {% highlight sh %}
244
+ $ buildr help:projects
245
+ killer-app # Code. Build. ??? Profit!
246
+ killer-app:teh-api # Abstract classes and interfaces
247
+ killer-app:teh-impl # All those implementation details
248
+ killer-app:la-web # What our users see
249
+ {% endhighlight %}
250
+
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.
252
+
253
+ So next let's talk about "projects":projects.html.
254
+
255
+
256
+ h2(#more). Learning More
257
+
258
+ *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_.
259
+
260
+ 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/.
261
+
262
+ *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.
263
+
264
+ *AntWrap* Buildr uses AntWrap, for configuring and running Ant tasks. You can learn more from the "Antwrap documentation":http://antwrap.rubyforge.org/.
265
+
266
+ *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.
@@ -0,0 +1,459 @@
1
+ ---
2
+ layout: default
3
+ title: Languages
4
+ ---
5
+
6
+
7
+ h2(#java). Java
8
+
9
+
10
+ h3. Compiling Java
11
+
12
+ 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.
13
+
14
+ 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@.
15
+
16
+ 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.
17
+
18
+ The Java compiler supports the following options:
19
+
20
+ |_. Option |_. Usage |
21
+ | @:debug@ | Generates bytecode with debugging information. You can also override this by setting the environment variable @debug@ to @off@. |
22
+ | @:deprecation@ | If true, shows deprecation messages. False by default. |
23
+ | @:lint@ | Defaults to false. Set this option to true to use all lint options, or specify a specific lint option (e.g. @:lint=>'cast'@). |
24
+ | @:other@ | Array of options passed to the compiler (e.g. @:other=>'-implicit:none'@). |
25
+ | @:source@ | Source code compatibility (e.g. '1.5'). |
26
+ | @:target@ | Bytecode compatibility (e.g. '1.4'). |
27
+ | @:warnings@ | Issue warnings when compiling. True when running in verbose mode. |
28
+
29
+
30
+ h3. Testing with Java
31
+
32
+ h4. JUnit
33
+
34
+ The default test framework for Java projects is "JUnit 4":http://www.junit.org.
35
+
36
+ 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@.
37
+
38
+ The JUnit test framework supports the following options:
39
+
40
+ |_. Option |_. Value |
41
+ | @:fork@ | VM forking, defaults to true. |
42
+ | @:clonevm@ | If true clone the VM each time it is forked. |
43
+ | @:properties@ | Hash of system properties available to the test case. |
44
+ | @:environment@ | Hash of environment variables available to the test case. |
45
+ | @:java_args@ | Arguments passed as is to the JVM. |
46
+
47
+ For example, to pass properties to the test case:
48
+
49
+ {% highlight ruby %}
50
+ test.using :properties=>{ :currency=>'USD' }
51
+ {% endhighlight %}
52
+
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.
54
+
55
+ |_. :fork=> |_. Behavior |
56
+ | @:once@ | Create one VM to run all test classes in the project, separate VMs for each project. |
57
+ | @:each@ | Create one VM for each test case class. Slow but provides the best isolation between test classes. |
58
+ | @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. |
59
+
60
+ 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.
61
+
62
+ In addition, you can get a consolidated XML or HTML report by running the @junit:report@ task. For example:
63
+
64
+ {% highlight sh %}
65
+ $ buildr test junit:report test=all
66
+ $ firefox report/junit/html/index.html
67
+ {% endhighlight %}
68
+
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.
70
+
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:
72
+
73
+ {% highlight yaml %}
74
+ junit: 4.4
75
+ jmock: 2.0
76
+ {% endhighlight %}
77
+
78
+
79
+ h4. TestNG
80
+
81
+ You can use "TestNG":http://testng.org instead of JUnit. To select TestNG as the test framework, add this to your project:
82
+
83
+ {% highlight ruby %}
84
+ test.using :testng
85
+ {% endhighlight %}
86
+
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)
88
+
89
+ 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.
90
+
91
+ The TestNG test framework supports the following options:
92
+
93
+ |_. Option |_. Value |
94
+ | @:properties@ | Hash of system properties available to the test case. |
95
+ | @:java_args@ | Arguments passed as is to the JVM. |
96
+
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:
98
+
99
+ {% highlight yaml %}
100
+ testng: 5.7
101
+ {% endhighlight %}
102
+
103
+
104
+ h4. JBehave
105
+
106
+ "JBehave":http://jbehave.org/ is a pure Java BDD framework, stories and behaviour specifications are written in the Java language.
107
+
108
+ To use JBehave in your project you can select it with @test.using :jbehave@.
109
+
110
+ This framework will search for the following patterns under your project:
111
+
112
+ {% highlight text %}
113
+ src/spec/java/**/*Behaviour.java
114
+ {% endhighlight %}
115
+
116
+ Supports the following options:
117
+
118
+ |_. Option |_. Value |
119
+ | @:properties@ | Hash of system properties available to the test case. |
120
+ | @:java_args@ | Arguments passed as is to the JVM. |
121
+
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:
123
+
124
+ {% highlight yaml %}
125
+ jbehave: 1.0.1
126
+ {% endhighlight %}
127
+
128
+
129
+ h2(#scala). Scala
130
+
131
+ Before using Scala, you must first @require@ the Scala compiler:
132
+
133
+ {% highlight ruby %}
134
+ require 'buildr/scala'
135
+ {% endhighlight %}
136
+
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:
157
+
158
+ {% highlight ruby %}
159
+ artifact_ns['Buildr::Compiler::Scalac'].library = '2.7.5'
160
+
161
+ require 'buildr/scala'
162
+ {% endhighlight %}
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.
166
+
167
+ Regardless of how Scala has been obtained, you may determine the version in use
168
+ by querying the @Scala.version@ attribute:
169
+
170
+ {% highlight ruby %}
171
+ Scala.version # => '2.7.5'
172
+ {% endhighlight %}
173
+
174
+ h3. Compiling Scala
175
+
176
+ 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.
177
+
178
+ Any Java source files found in the @src/main/java@ directory will be compiled using the Scala/Java joint compiler into the @target/classes@ directory. Both the Java and the Scala sources are compiled with an inclusive classpath, meaning that you may have a Java class which depends upon a Scala class which depends upon a Java class, all within the same project. The Java sources will be compiled with the same dependencies as the Scala sources with the addition of the @scala-library.jar@ file as required for Scala interop.
179
+
180
+ Note that you cannot use the Groovy *and* the Scala joint compilers in the same project. If both are required, the Groovy joint compiler will take precedence.
181
+ +
182
+ 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@. The joint compilation of Java sources may only be pointed at an alternative directory using the feature to redefine the @_(:src, :main, :java)@ path.
183
+
184
+ When using the Scala compiler, if you don't specify the packaging type, it defaults to JAR.
185
+
186
+ The Scala compiler supports the following options:
187
+
188
+ |_. Option |_. Usage |
189
+ | @:debug@ | Generates bytecode with debugging information. You can also override this by setting the environment variable @debug@ to @off@. |
190
+ | @:deprecation@ | If true, shows deprecation messages. False by default. |
191
+ | @:optimise@ | Generates faster bytecode by applying optimisations to the program. |
192
+ | @:other@ | Array of options passed to the compiler (e.g. @:other=>'-Xprint-types'@). |
193
+ | @:target@ | Bytecode compatibility (e.g. '1.4'). |
194
+ | @:warnings@ | Issue warnings when compiling. True when running in verbose mode. |
195
+ | @:javac@ | A hash of options passed to the @javac@ compiler verbatim. |
196
+
197
+ h4. Fast Scala Compiler
198
+
199
+ 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.
200
+
201
+ h4. Rebuild detection
202
+
203
+ 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.
204
+
205
+ 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.
206
+
207
+ h3. Testing with Scala
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.
210
+
211
+ {% highlight ruby %}
212
+ test.using(:scalatest)
213
+ {% endhighlight %}
214
+
215
+ h4. ScalaTest
216
+
217
+ ScalaTest support is activated automatically when there are any @.scala@ source files contained in the @src/test/scala@ directory. If you are not using this directory convention, you may force the test framework by using the @test.using :scalatest@ directive.
218
+
219
+ Buildr automatically detects and runs tests that extend the @org.scalatest.Suite@ interface.
220
+
221
+ A very simplistic test class might look like,
222
+
223
+ {% highlight scala %}
224
+ class MySuite extends org.scalatest.FunSuite {
225
+ test("addition") {
226
+ val sum = 1 + 1
227
+ assert(sum === 2)
228
+ }
229
+ }
230
+ {% endhighlight %}
231
+
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:
233
+
234
+ {% highlight scala %}
235
+ import org.scalatest._
236
+
237
+ class PropertyTestSuite extends FunSuite {
238
+ var properties = Map[String, Any]()
239
+
240
+ test("testProperty") {
241
+ assert(properties("name") === "value")
242
+ }
243
+
244
+ protected override def runTests(testName: Option[String],
245
+ reporter: Reporter, stopper: Stopper, includes: Set[String],
246
+ excludes: Set[String], properties: Map[String, Any])
247
+ {
248
+ this.properties = properties;
249
+ super.runTests(testName, reporter, stopper,
250
+ includes, excludes, properties)
251
+ }
252
+ }
253
+ {% endhighlight %}
254
+
255
+ h4. Specs
256
+
257
+ Specs is automatically selected whenever there are @.scala@ source files under the @src/spec/scala@ directory. It is also possible to force selection of the test framework by using the @test.using :specs@ directive. This can sometimes be useful when Scala sources may be found in *both* @src/test/scala@ and @src/spec/scala@. Normally in such cases, ScalaTest will have selection precedence, meaning that in case of a conflict between it and Specs, ScalaTest will be chosen.
258
+
259
+ Any objects which extend the @org.specs.Specification@ superclass will be automatically detected and run. Note that any *classes* which extend @Specification@ will also be invoked. As such classes will not have a @main@ method, such an invocation will raise an error.
260
+
261
+ A simple specification might look like this:
262
+
263
+ {% highlight scala %}
264
+ import org.specs._
265
+ import org.specs.runner._
266
+
267
+ object StringSpecs extends Specification {
268
+ "empty string" should {
269
+ "have a zero length" in {
270
+ "".length mustBe 0
271
+ }
272
+ }
273
+ }
274
+ {% endhighlight %}
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.
292
+
293
+ h4. ScalaCheck
294
+
295
+ You may use ScalaCheck inside ScalaTest- and Specs-inherited classes. Here is an example illustrating checks inside a ScalaTest suite,
296
+
297
+ {% highlight scala %}
298
+ import org.scalatest.prop.PropSuite
299
+ import org.scalacheck.Arbitrary._
300
+ import org.scalacheck.Prop._
301
+
302
+ class MySuite extends PropSuite {
303
+
304
+ test("list concatenation") {
305
+ val x = List(1, 2, 3)
306
+ val y = List(4, 5, 6)
307
+ assert(x ::: y === List(1, 2, 3, 4, 5, 6))
308
+ check((a: List[Int], b: List[Int]) => a.size + b.size == (a ::: b).size)
309
+ }
310
+
311
+ test(
312
+ "list concatenation using a test method",
313
+ (a: List[Int], b: List[Int]) => a.size + b.size == (a ::: b).size
314
+ )
315
+ }
316
+ {% endhighlight %}
317
+
318
+
319
+ h2(#groovy). Groovy
320
+
321
+ h3. Compiling Groovy
322
+
323
+ Before using the Groovy compiler, you must first require it on your buildfile:
324
+
325
+ {% highlight ruby %}
326
+ require 'buildr/java/groovyc'
327
+ {% endhighlight %}
328
+
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.
330
+
331
+ If the project has java sources in @src/main/java@ they will get compiled using the groovyc joint compiler.
332
+
333
+ Sources found in @src/test/groovy@ are compiled into the @target/test/classes@.
334
+
335
+ If you don't specify the packaging type, it defaults to JAR.
336
+
337
+ The Groovy compiler supports the following options:
338
+
339
+ |_. Option |_. Usage |
340
+ | @encoding@ | Encoding of source files. |
341
+ | @verbose@ | Asks the compiler for verbose output, true when running in verbose mode. |
342
+ | @fork@ | Whether to execute groovyc using a spawned instance of the JVM. Defaults to no. |
343
+ | @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@) |
344
+ | @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@) |
345
+ | @listfiles@ | Indicates whether the source files to be compiled will be listed. Defaults to no. |
346
+ | @stacktrace@ | If true each compile error message will contain a stacktrace. |
347
+ | @warnings@ | Issue warnings when compiling. True when running in verbose mode. |
348
+ | @debug@ | Generates bytecode with debugging information. Set from the debug environment variable/global option. |
349
+ | @deprecation@ | If true, shows deprecation messages. False by default. |
350
+ | @optimise@ | Generates faster bytecode by applying optimisations to the program. |
351
+ | @source@ | Source code compatibility. |
352
+ | @target@ | Bytecode compatibility. |
353
+ | @javac@ | Hash of options passed to the ant javac task. |
354
+
355
+
356
+ h3. Testing with Groovy
357
+
358
+ h4. EasyB
359
+
360
+ "EasyB":http://www.easyb.org/ is a BDD framework using "Groovy":http://groovy.codehaus.org/.
361
+
362
+ Specifications are written in the Groovy language, of course you get seamless Java integration as with all things groovy.
363
+
364
+ To use this framework in your project you can select it with @test.using :easyb@.
365
+
366
+ This framework will search for the following patterns under your project:
367
+
368
+ {% highlight text %}
369
+ src/spec/groovy/**/*Behavior.groovy
370
+ src/spec/groovy/**/*Story.groovy
371
+ {% endhighlight %}
372
+
373
+ Supports the following options:
374
+
375
+ |_. Option |_. Value |
376
+ | @:properties@ | Hash of system properties available to the test case. |
377
+ | @:java_args@ | Arguments passed as is to the JVM. |
378
+ | @:format@ | Report format, either @:txt@ or @:xml@ |
379
+
380
+
381
+ h2(#ruby). Ruby
382
+
383
+ h3. Testing with Ruby
384
+
385
+ Buildr provides integration with some ruby testing frameworks, allowing you to test your Java code with state of the art tools.
386
+
387
+ 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.
388
+
389
+ 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.
390
+
391
+ 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.
392
+
393
+ You can use the @build.yaml@ settings file to specify a particular version of JRuby (defaults to @1.1.4@). For example:
394
+
395
+ {% highlight yaml %}
396
+ jruby: 1.1.3
397
+ {% endhighlight %}
398
+
399
+ h4. RSpec
400
+
401
+ "RSpec":http://rspec.info/ is the de-facto BDD framework for ruby. It's the framework used to test Buildr itself.
402
+
403
+ To use this framework in your project you can select it with @test.using :rspec@.
404
+
405
+ This framework will search for the following patterns under your project:
406
+
407
+ {% highlight text %}
408
+ src/spec/ruby/**/*_spec.rb
409
+ {% endhighlight %}
410
+
411
+ Supports the following options:
412
+
413
+ |_. Option |_. Value |
414
+ | @: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 |
415
+ | @:requires@ | Array of ruby files to require before running the specs |
416
+ | @:format@ | Array of valid RSpec @--format@ option values. Defaults to html report on the @reports@ directory and text progress |
417
+ | @:output@ | File path to output dump. @false@ to supress output |
418
+ | @:fork@ | Run the tests on a new java vm. (enabled unless running on JRuby) |
419
+ | @:properties@ | Hash of system properties available to the test case. |
420
+ | @:java_args@ | Arguments passed as is to the JVM. (only when fork is enabled) |
421
+
422
+ h4. JtestR
423
+
424
+ "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.
425
+
426
+ To use this framework in your project you can select it with @test.using :jtestr@.
427
+
428
+ You can use the @build.yaml@ settings file to specify a particular version of JtestR (defaults to @0.3.1@). For example:
429
+
430
+ {% highlight yaml %}
431
+ jtestr: 0.3.1
432
+ {% endhighlight %}
433
+
434
+ To customize TestNG/JUnit versions refer to their respective section.
435
+
436
+ 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:
437
+
438
+ |_. Framework |_. Patterns |
439
+ | "RSpec":http://rspec.info | Files in @src/spec/ruby@ ending with @*_spec.rb@ or @*_story.rb@ |
440
+ | "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@ |
441
+ | "Expectations":http://expectations.rubyforge.org/ | Files in @src/spec/ruby@ ending with @*_expect.rb@ |
442
+ | "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@. |
443
+ | "TestNG":http://testng.org | Classes from @src/test/java@ annotated with @org.testng.annotations.Test@ |
444
+
445
+ 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.
446
+
447
+ 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.
448
+
449
+ Supports the following options:
450
+
451
+ |_. Option |_. Value |
452
+ | @:config@ | The JtestR config file to be loaded after being configured by Buildr. Defaults to @src/spec/ruby/jtestr_config.rb@. |
453
+ | @: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 |
454
+ | @:requires@ | Array of ruby files to require before running the specs |
455
+ | @:format@ | Array of valid RSpec @--format@ option values. Defaults to html report on the @reports@ directory and text progress |
456
+ | @:output@ | File path to output dump. @false@ to supress output |
457
+ | @:fork@ | Run the tests on a new java vm. (enabled unless running on JRuby) |
458
+ | @:properties@ | Hash of system properties available to the test case. (only when fork is enabled) |
459
+ | @:java_args@ | Arguments passed as is to the JVM. (only when fork is enabled) |