assaf-buildr 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (163) hide show
  1. data/CHANGELOG +887 -0
  2. data/DISCLAIMER +7 -0
  3. data/LICENSE +176 -0
  4. data/NOTICE +26 -0
  5. data/README.rdoc +146 -0
  6. data/Rakefile +62 -0
  7. data/_buildr +38 -0
  8. data/addon/buildr/antlr.rb +65 -0
  9. data/addon/buildr/cobertura.rb +236 -0
  10. data/addon/buildr/emma.rb +238 -0
  11. data/addon/buildr/hibernate.rb +142 -0
  12. data/addon/buildr/javacc.rb +85 -0
  13. data/addon/buildr/jdepend.rb +60 -0
  14. data/addon/buildr/jetty.rb +248 -0
  15. data/addon/buildr/jibx.rb +86 -0
  16. data/addon/buildr/nailgun.rb +817 -0
  17. data/addon/buildr/openjpa.rb +90 -0
  18. data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
  19. data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
  20. data/addon/buildr/org/apache/buildr/BuildrNail.java +41 -0
  21. data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
  22. data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
  23. data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
  24. data/addon/buildr/org/apache/buildr/JettyWrapper.java +144 -0
  25. data/addon/buildr/xmlbeans.rb +93 -0
  26. data/bin/buildr +28 -0
  27. data/buildr.buildfile +53 -0
  28. data/buildr.gemspec +58 -0
  29. data/doc/css/default.css +228 -0
  30. data/doc/css/print.css +100 -0
  31. data/doc/css/syntax.css +52 -0
  32. data/doc/images/apache-incubator-logo.png +0 -0
  33. data/doc/images/buildr-hires.png +0 -0
  34. data/doc/images/buildr.png +0 -0
  35. data/doc/images/favicon.png +0 -0
  36. data/doc/images/growl-icon.tiff +0 -0
  37. data/doc/images/note.png +0 -0
  38. data/doc/images/project-structure.png +0 -0
  39. data/doc/images/tip.png +0 -0
  40. data/doc/images/zbuildr.tif +0 -0
  41. data/doc/pages/artifacts.textile +207 -0
  42. data/doc/pages/building.textile +240 -0
  43. data/doc/pages/contributing.textile +208 -0
  44. data/doc/pages/download.textile +62 -0
  45. data/doc/pages/extending.textile +175 -0
  46. data/doc/pages/getting_started.textile +273 -0
  47. data/doc/pages/index.textile +42 -0
  48. data/doc/pages/languages.textile +407 -0
  49. data/doc/pages/mailing_lists.textile +17 -0
  50. data/doc/pages/more_stuff.textile +286 -0
  51. data/doc/pages/packaging.textile +427 -0
  52. data/doc/pages/projects.textile +274 -0
  53. data/doc/pages/recipes.textile +103 -0
  54. data/doc/pages/settings_profiles.textile +274 -0
  55. data/doc/pages/testing.textile +212 -0
  56. data/doc/pages/troubleshooting.textile +103 -0
  57. data/doc/pages/whats_new.textile +323 -0
  58. data/doc/print.haml +51 -0
  59. data/doc/print.toc.yaml +29 -0
  60. data/doc/scripts/buildr-git.rb +412 -0
  61. data/doc/scripts/install-jruby.sh +44 -0
  62. data/doc/scripts/install-linux.sh +64 -0
  63. data/doc/scripts/install-osx.sh +52 -0
  64. data/doc/site.haml +56 -0
  65. data/doc/site.toc.yaml +47 -0
  66. data/etc/KEYS +151 -0
  67. data/etc/git-svn-authors +16 -0
  68. data/lib/buildr.rb +35 -0
  69. data/lib/buildr/core.rb +27 -0
  70. data/lib/buildr/core/application.rb +489 -0
  71. data/lib/buildr/core/application_cli.rb +139 -0
  72. data/lib/buildr/core/build.rb +311 -0
  73. data/lib/buildr/core/checks.rb +382 -0
  74. data/lib/buildr/core/common.rb +154 -0
  75. data/lib/buildr/core/compile.rb +596 -0
  76. data/lib/buildr/core/environment.rb +120 -0
  77. data/lib/buildr/core/filter.rb +362 -0
  78. data/lib/buildr/core/generate.rb +195 -0
  79. data/lib/buildr/core/help.rb +118 -0
  80. data/lib/buildr/core/progressbar.rb +156 -0
  81. data/lib/buildr/core/project.rb +892 -0
  82. data/lib/buildr/core/test.rb +715 -0
  83. data/lib/buildr/core/transports.rb +558 -0
  84. data/lib/buildr/core/util.rb +289 -0
  85. data/lib/buildr/groovy.rb +18 -0
  86. data/lib/buildr/groovy/bdd.rb +105 -0
  87. data/lib/buildr/groovy/compiler.rb +138 -0
  88. data/lib/buildr/ide.rb +19 -0
  89. data/lib/buildr/ide/eclipse.rb +212 -0
  90. data/lib/buildr/ide/idea.ipr.template +300 -0
  91. data/lib/buildr/ide/idea.rb +189 -0
  92. data/lib/buildr/ide/idea7x.ipr.template +290 -0
  93. data/lib/buildr/ide/idea7x.rb +210 -0
  94. data/lib/buildr/java.rb +23 -0
  95. data/lib/buildr/java/ant.rb +92 -0
  96. data/lib/buildr/java/bdd.rb +449 -0
  97. data/lib/buildr/java/commands.rb +211 -0
  98. data/lib/buildr/java/compiler.rb +348 -0
  99. data/lib/buildr/java/deprecated.rb +141 -0
  100. data/lib/buildr/java/jruby.rb +117 -0
  101. data/lib/buildr/java/jtestr_runner.rb.erb +116 -0
  102. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
  103. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +119 -0
  104. data/lib/buildr/java/packaging.rb +713 -0
  105. data/lib/buildr/java/pom.rb +178 -0
  106. data/lib/buildr/java/rjb.rb +155 -0
  107. data/lib/buildr/java/test_result.rb +308 -0
  108. data/lib/buildr/java/tests.rb +324 -0
  109. data/lib/buildr/java/version_requirement.rb +172 -0
  110. data/lib/buildr/packaging.rb +21 -0
  111. data/lib/buildr/packaging/artifact.rb +730 -0
  112. data/lib/buildr/packaging/artifact_namespace.rb +972 -0
  113. data/lib/buildr/packaging/artifact_search.rb +140 -0
  114. data/lib/buildr/packaging/gems.rb +102 -0
  115. data/lib/buildr/packaging/package.rb +233 -0
  116. data/lib/buildr/packaging/tar.rb +104 -0
  117. data/lib/buildr/packaging/zip.rb +722 -0
  118. data/lib/buildr/resources/buildr.icns +0 -0
  119. data/lib/buildr/scala.rb +19 -0
  120. data/lib/buildr/scala/compiler.rb +109 -0
  121. data/lib/buildr/scala/tests.rb +203 -0
  122. data/rakelib/apache.rake +191 -0
  123. data/rakelib/changelog.rake +57 -0
  124. data/rakelib/doc.rake +103 -0
  125. data/rakelib/package.rake +73 -0
  126. data/rakelib/release.rake +65 -0
  127. data/rakelib/rspec.rake +83 -0
  128. data/rakelib/rubyforge.rake +53 -0
  129. data/rakelib/scm.rake +49 -0
  130. data/rakelib/setup.rake +86 -0
  131. data/rakelib/stage.rake +48 -0
  132. data/spec/addon/cobertura_spec.rb +77 -0
  133. data/spec/addon/emma_spec.rb +120 -0
  134. data/spec/addon/test_coverage_spec.rb +255 -0
  135. data/spec/core/application_spec.rb +412 -0
  136. data/spec/core/artifact_namespace_spec.rb +646 -0
  137. data/spec/core/build_spec.rb +415 -0
  138. data/spec/core/checks_spec.rb +537 -0
  139. data/spec/core/common_spec.rb +664 -0
  140. data/spec/core/compile_spec.rb +566 -0
  141. data/spec/core/generate_spec.rb +33 -0
  142. data/spec/core/project_spec.rb +754 -0
  143. data/spec/core/test_spec.rb +1091 -0
  144. data/spec/core/transport_spec.rb +500 -0
  145. data/spec/groovy/bdd_spec.rb +80 -0
  146. data/spec/groovy/compiler_spec.rb +239 -0
  147. data/spec/ide/eclipse_spec.rb +243 -0
  148. data/spec/java/ant.rb +28 -0
  149. data/spec/java/bdd_spec.rb +358 -0
  150. data/spec/java/compiler_spec.rb +446 -0
  151. data/spec/java/java_spec.rb +88 -0
  152. data/spec/java/packaging_spec.rb +1103 -0
  153. data/spec/java/tests_spec.rb +466 -0
  154. data/spec/packaging/archive_spec.rb +503 -0
  155. data/spec/packaging/artifact_spec.rb +754 -0
  156. data/spec/packaging/packaging_helper.rb +63 -0
  157. data/spec/packaging/packaging_spec.rb +589 -0
  158. data/spec/sandbox.rb +137 -0
  159. data/spec/scala/compiler_spec.rb +228 -0
  160. data/spec/scala/tests_spec.rb +215 -0
  161. data/spec/spec_helpers.rb +304 -0
  162. data/spec/version_requirement_spec.rb +123 -0
  163. metadata +369 -0
@@ -0,0 +1,208 @@
1
+ h1. Contributing
2
+
3
+ Buildr is a community effort, and we welcome all contributors. Here's your chance to get involved and help your fellow developers.
4
+
5
+ h2. Getting involved
6
+
7
+ All our discussions are done in the open, over "email":mailing_lists.html, and that would be the first place to look for answers, raise ideas, etc. For bug reports, issues and patches, "see below":#bugs_aka_issues.
8
+
9
+
10
+ h3. Mailing Lists
11
+
12
+ We run two mailing lists, the "buildr-user":http://mail-archives.apache.org/mod_mbox/incubator-buildr-user/ mailing list for developers working with Buildr, that would be you if you're using Buildr or interested in using it. There's the "buildr-dev":http://mail-archives.apache.org/mod_mbox/incubator-buildr-dev/ mailing list for talking about development of Buildr itself, and "commits":http://mail-archives.apache.org/mod_mbox/incubator-buildr-commits/ mailing list for following SVN commits and JIRA issues.
13
+
14
+ Check the "mailing lists":mailing_lists.html page for more information on subscribing, searching and posting to the mailing list.
15
+
16
+
17
+ h3. Bugs (aka Issues)
18
+
19
+ We really do try to keep bugs to a minimum, and anticipate everything you'll ever want to do with Buildr. We're also, not perfect. So you may have found a bug, or have an enhancement in mind, or better yet, a patch to contribute. Here's what you can do.
20
+
21
+ If it's a bug, enhancement or patch, add it to "JIRA":http://issues.apache.org/jira/browse/Buildr. For trivial stuff, that's good enough.
22
+
23
+ If it needs more attention, start a discussion over on the mailing list. We will still use JIRA to log the progress, but the mailing list is a better place for talking things through.
24
+
25
+ When reporting a bug, please tell us which version of Ruby, Buildr and Java you are using, and also which operating system you are on:
26
+
27
+ {{{!sh
28
+ $ ruby --version
29
+ $ buildr --version
30
+ $ java --version
31
+ }}}
32
+
33
+
34
+ h3. Community Wiki
35
+
36
+ Our community Wiki is available at "http://cwiki.apache.org/confluence/display/BUILDR/Index":http://cwiki.apache.org/confluence/display/BUILDR/Index.
37
+
38
+
39
+ h3. Contributing Code
40
+
41
+ Yes, please.
42
+
43
+ If you have a patch to submit, do it through "JIRA":http://issues.apache.org/jira/browse/Buildr. We want to make sure Apache gets the right to use your contribution, and the JIRA upload form includes a simple contribution agreement. Lawyer not included.
44
+
45
+ h4. The Perfect Patch
46
+
47
+ If you want to get your patch accepted quickly:
48
+
49
+ # Provide a good summary of the bug/fix. We use that to decide which issue we can do quickly, and also copy and paste it into the changelog.
50
+ # Provide short explanation of what failed, under what conditions, why, and what else could be affected by the change (when relevant). The helps us understand the problem and move on to the next step.
51
+ # Provide a patch with relevant specs, or a fix to incomplete/broken specs. First thing we have to do is replicate the problem, before applying the change, and then make sure the change fixes that problem. And we need to have those specs in there, they make sure we don't accidentally break it again in the future.
52
+ # Provide a patch with the fix/change itself. Keep it separate from the specs, so it's easy to apply them individually.
53
+
54
+ If you don't know how to fix it, but can at least write a spec for the correct behavior (which, obviously would fail), do just that. A spec is preferred to a fix.
55
+
56
+ h4. Working on a new feature?
57
+
58
+ If you want to work on a cool new feature, but not quite ready to submit a patch, there's still a way you can get the Buildr community involved. We're experimenting with using Git for that. You can use Git to maintain a fork of Buildr that can keep up with changes in the main branch (tip: use @git rebase@), while developing your own changes/features on it.
59
+
60
+ That way you can get other people involved, checking out the code, and eventually merge it back with the main branch. Check out the "Git section":#Git below and the post "Git forking for fun and profit":http://blog.labnotes.org/2008/04/30/git-forking-for-fun-and-profit/.
61
+
62
+
63
+ h2. Living on the edge
64
+
65
+ Did we mention Buildr is an open source project? In fact, when you install Buildr you get all the source code, documentation, test case and everything you need to use it, extend it and patch it. Have a look in your Gem directory.
66
+
67
+ h3. SVN
68
+
69
+ But if you want to work with the latest and greatest, you'll want to check out "Buildr from SVN":http://svn.apache.org/repos/asf/incubator/buildr:
70
+
71
+ {{{!sh
72
+ $ svn co http://svn.apache.org/repos/asf/incubator/buildr/trunk buildr
73
+ }}}
74
+
75
+ You can also browse the "Buildr repository":http://svn.apache.org/repos/asf/incubator/buildr.
76
+
77
+ h3. Git
78
+
79
+ Not a fan SVN? We understand. You can also grab a copy of "Buildr from GitHub":http://github.com/vic/buildr/tree/master:
80
+
81
+ {{{!sh
82
+ $ git clone git://github.com/vic/buildr.git
83
+ }}}
84
+
85
+ If you want to learn more about Git, you can start by watching Scott Chacon’s "Git presentation":http://en.oreilly.com/rails2008/public/asset/attachment/2816 (PDF), or any of the "Git screencasts":http://www.gitcasts.com/. For more, there's also the "Git Internals book":http://peepcode.com/products/git-internals-pdf.
86
+
87
+ And keep this "Git cheat sheet":http://ktown.kde.org/~zrusin/git/git-cheat-sheet-medium.png close at hand. Very useful.
88
+
89
+ *Note:* The GitHub repository is maintained by contributors to this project, but is *not* an official Apache repository. To obtain Buildr from the official Apache repository, consider using @git-svn@ instead.
90
+
91
+ h3. Working with Source Code
92
+
93
+ To install Buildr from the source directory:
94
+
95
+ {{{!sh
96
+ $ cd buildr
97
+ $ rake setup install
98
+ }}}
99
+
100
+ When using Buildr for JRuby:
101
+
102
+ {{{!sh
103
+ $ cd buildr
104
+ $ jruby -S rake setup install
105
+ }}}
106
+
107
+ The _setup_ task takes care of installing all the necessary dependencies used for building, testing and running Buildr. Once in a while we upgrade or add new dependencies, if you're experiencing a missing dependency, simply run @rake setup@ again.
108
+
109
+ The _install_ task creates a Gem in your working directory (_pkg/_) and install it in your local repository. Since Ruby Gems uses version numbers to detect new releases, if you installed Buildr this way and want to upgrade to the latest official release, you need to use @gem install buildr@ rather than @gem upgrade@.
110
+
111
+ Both _setup_ and _install_ tasks use the @sudo@ command on platforms that require it (i.e. not Windows), so there's no need to run @sudo rake@ when working with the Buildr source code.
112
+
113
+
114
+ h3. Using development build
115
+
116
+ Occasionally we'll make development builds from the current code in trunk/head. We appreciate if you can take the time to test those out and report any bugs. To install development builds, use the Gem repository at @people.apache.org/~assaf/buildr/snapshot@:
117
+
118
+ {{{!sh
119
+ gem source --add http://people.apache.org/~assaf/buildr/snapshot/
120
+ }}}
121
+
122
+ Since Ruby Gems uses version numbers to detect new releases, if you installed Buildr from a snapshot and want to upgrade to a newer snapshot or the latest official release, you need to use @gem install buildr@ rather than @gem upgrade@.
123
+
124
+ If you want to go back to using the RubyForge releases:
125
+
126
+ {{{!sh
127
+ gem source --remove http://people.apache.org/~assaf/buildr/snapshot/
128
+ gem install buildr
129
+ }}}
130
+
131
+
132
+ h2. Tested and Documented
133
+
134
+ Two things we definitely encourage!
135
+
136
+ h3. Testing/Specs
137
+
138
+ Obviously we won't turn down patches, but we'll love you even more if you include a test case. One that will fail without the patch, and run successfully with it. If not for our love, then think of the benefit to you: once we add that test case, we won't accidentally break that feature in the next release.
139
+
140
+ We test using "RSpec":http://rspec.info/, a Behavior-Driven Development test framework. The main difference between RSpec and xUnit is that RSpec helps you formulate test cases in terms of specifications: you describe how the code should behave, and run RSpec to make sure it matches that specification.
141
+
142
+ You can run an individual specifications using the @spec@ command, for example:
143
+
144
+ {{{!sh
145
+ $ spec spec/compiler_spec.rb
146
+ $ spec spec/compiler_spec.rb -l 409
147
+ }}}
148
+
149
+ The first command will run all the specifications in @compiler_spec@, the second command will run only the specification identified by line 409 of that file. You can use line numbers to point at a particular specification (lines starting with @it@), or set of specifications (lines starting with @describe@). You can also use the @-e@ command line option to name a particular specification.
150
+
151
+ To make sure your change did not break anything else, you can run all the specifications (be patient, we have a lot of these):
152
+
153
+ {{{!sh
154
+ $ rake spec
155
+ }}}
156
+
157
+ If you get any failures, you can use @rake failed@ to run only the failed specs, and repeat until there are no more failed specs to run. The list of failed specs is stored in the file _failed_.
158
+
159
+ We always @rake spec@ before making a release.
160
+
161
+ For full test coverage:
162
+
163
+ {{{!sh
164
+ $ rake coverage
165
+ }}}
166
+
167
+ Specification and coverage reports are HTML files you can view with a Web browser, look for them in the _reports_ directory. You can also check out the "RSpec report":specs.html and "test coverage":coverage/index.html we publish with each release.
168
+
169
+
170
+ h3. Documentation
171
+
172
+ Yes, we do make typos, spelling errors and sometimes we write things that don't make sense, so if you find a documentation bug, or want to help make the documentation even better, here's the way to do it.
173
+
174
+ For simple typos and quick fixes, just send a message to the mailing list or log an issue in JIRA.
175
+
176
+ If you end up rewriting a significant piece of text, or add new documentation (you rock!), send a patch. Making documentation patches is fairly easy. All the documentation is generated from text files in the @doc/pages@ directory, so all you need to do is check it out from SVN, edit, and @svn diff@ to create a patch.
177
+
178
+ We use "Textile":http://www.textism.com/tools/textile/ as the markup language, it takes all of a few minutes to learn, it's intuitive to use, and produces clean HTML. You can learn it all in a few minutes from the "Textile Reference Manual":http://redcloth.org/textile. Also check out the "Textile Quick Reference":http://hobix.com/textile/quick.html.
179
+
180
+ You can always check the documentation to see which conventions we use, and also a couple of extensions we have for styling source code (with syntax highlighting!) and handling footnotes. The table of contents is auto-generated form H1/H2 headers.
181
+
182
+ The tool we use for this is called Docter, which we developed specifically for Buildr, and use to create the Web site and printable PDF. If you want to try it out you'll need to first @gem install docter@. To generate a copy of the Web site, simple run @rake html@ .
183
+
184
+ If you're thinking of editing the docs, and using @rake html@ to see what the HTML looks like, you may want to try something simpler. Start by running the Docter Web server with @rake docter@ and then point your browser at @http://localhost:3000@. To see your edits, simply refresh the page.
185
+
186
+ Generating the PDF is a bit more tricky, we use the HTML in combination with print media CSS stylesheets and run them through the wonderful "PrinceXML":http://www.princexml.com/, so you'll need to install PrinceXML
187
+ first before you can @rake pdf@.
188
+
189
+
190
+ h2. Contributors
191
+
192
+ Here is the list of people who are actively working and committing on Buildr:
193
+
194
+ *"Assaf Arkin":http://labnotes.org* (assaf at apache.org)
195
+
196
+ *Alex Boisvert*
197
+
198
+ Came to Buildr as a refuge from the Maven Uncertainty Principle. Alex has been working mostly on the Scala integration and believes Ruby scripting is a great complement to statically typed languages.
199
+
200
+ *"Matthieu Riou":http://offthelip.org*
201
+
202
+ *Victor Hugo Borja* (vborja at apache.org)
203
+
204
+ Currently a Java Developer at "http://jwmsolutions.com":http://jwmsolutions.com, Victor has been enjoying and using Apache's software since 1999 when he started with Java, now he prefers programming Ruby and is happy to help on Apache's first ruby project.
205
+
206
+ *Lacton* (lacton at apache.org)
207
+
208
+ A test-infected developer since 2001, Lacton yearns for a development infrastructure that would shorten feedback loops so much that testing, building, refactoring and committing would feel as easy and natural as breathing air.
@@ -0,0 +1,62 @@
1
+ h1. Download
2
+
3
+
4
+ h2. Installing Buildr
5
+
6
+ The easiest way to install Buildr is using the fabulous RubyGems package manager. Of course, you will need either Ruby or JRuby, and we recommend upgrading to the most recent version of RubyGems. If this sounds foreign to you, don't worry. We'll show you how to install Buildr on Linux, OS X, Windows and JRuby in the "Getting Started guide":getting_started.html, we even provide automated installation scripts.
7
+
8
+ The *official Apache distribution* consists of the digitally signed binaries (gems) and source packages "available below":#binaries_and_source_code. To install these binaries, you must first download them to disk and then install them using the @gem install@ command (or @rake install@ for a source distribution).
9
+
10
+ In addition, contributors to this project maintain a separate distribution over on "RubyForge":http://rubyforge.org/projects/buildr. Using this distribution, you're able to install Buildr directly from the remote gem repository and to automatically upgrade when a new release comes out. The RubyForge distribution is *not* an official Apache distribution.
11
+
12
+ The source code is included in both source and binary distribution, the Gem distribution expands the source code into your local Gem repository. That's in addition to getting the source code directly from "SVN":http://svn.apache.org/repos/asf/incubator/buildr or "GitHub":http://github.com/vic/buildr/tree/master. Learn more about working with source code and "living on the edge":contributing.html#living_on_the_edge.
13
+
14
+
15
+ h2. Binaries and Source Code
16
+
17
+ h3. buildr 1.3.3-incubating (2008-10-08)
18
+
19
+ |_. Package |_. MD5 Checksum |_. PGP |
20
+ | "buildr-1.3.3-incubating.gem":http://www.apache.org/dist/incubator/buildr/1.3.3-incubating/buildr-1.3.3-incubating.gem | "7192dad45441630cbf07b85af5f9069a":http://www.apache.org/dist/incubator/buildr/1.3.3-incubating/buildr-1.3.3-incubating.gem.md5 | "Sig":http://www.apache.org/dist/incubator/buildr/1.3.3-incubating/buildr-1.3.3-incubating.gem.asc |
21
+ | "buildr-1.3.3-java-incubating.gem":http://www.apache.org/dist/incubator/buildr/1.3.3-incubating/buildr-1.3.3-java-incubating.gem | "71ad4f0f8bfa951fa129db67a06b608a":http://www.apache.org/dist/incubator/buildr/1.3.3-incubating/buildr-1.3.3-java-incubating.gem.md5 | "Sig":http://www.apache.org/dist/incubator/buildr/1.3.3-incubating/buildr-1.3.3-java-incubating.gem.asc |
22
+ | "buildr-1.3.3-incubating.tgz":http://www.apache.org/dist/incubator/buildr/1.3.3-incubating/buildr-1.3.3-incubating.tgz | "e5ee6fe5b86386520c91a9633d02814b":http://www.apache.org/dist/incubator/buildr/1.3.3-incubating/buildr-1.3.3-incubating.tgz.md5 | "Sig":http://www.apache.org/dist/incubator/buildr/1.3.3-incubating/buildr-1.3.3-incubating.tgz.asc |
23
+ | "buildr-1.3.3-incubating.zip":http://www.apache.org/dist/incubator/buildr/1.3.3-incubating/buildr-1.3.3-incubating.zip | "baab601fd46a877ee8e408891d68c842":http://www.apache.org/dist/incubator/buildr/1.3.3-incubating/buildr-1.3.3-incubating.zip.md5 | "Sig":http://www.apache.org/dist/incubator/buildr/1.3.3-incubating/buildr-1.3.3-incubating.zip.asc |
24
+
25
+ p>. ("Release signing keys":http://www.apache.org/dist/incubator/buildr/1.3.3-incubating/KEYS)
26
+
27
+
28
+ h3. buildr 1.3.2-incubating (2008-07-18)
29
+
30
+ |_. Package |_. MD5 Checksum |_. PGP |
31
+ | "buildr-1.3.2-incubating.gem":http://www.apache.org/dist/incubator/buildr/1.3.2-incubating/buildr-1.3.2-incubating.gem | "225504bc195334c4eb9d6dec814d9db1":http://www.apache.org/dist/incubator/buildr/1.3.2-incubating/buildr-1.3.2-incubating.gem.md5 | "Sig":http://www.apache.org/dist/incubator/buildr/1.3.2-incubating/buildr-1.3.2-incubating.gem.asc |
32
+ | "buildr-1.3.2-java-incubating.gem":http://www.apache.org/dist/incubator/buildr/1.3.2-incubating/buildr-1.3.2-java-incubating.gem | "d7d8394c7aed887987be0e813e1e4cee":http://www.apache.org/dist/incubator/buildr/1.3.2-incubating/buildr-1.3.2-java-incubating.gem.md5 | "Sig":http://www.apache.org/dist/incubator/buildr/1.3.2-incubating/buildr-1.3.2-java-incubating.gem.asc |
33
+ | "buildr-1.3.2-incubating.tgz":http://www.apache.org/dist/incubator/buildr/1.3.2-incubating/buildr-1.3.2-incubating.tgz | "611e97df1bc76382ecbe6b60e9340f2b":http://www.apache.org/dist/incubator/buildr/1.3.2-incubating/buildr-1.3.2-incubating.tgz.md5 | "Sig":http://www.apache.org/dist/incubator/buildr/1.3.2-incubating/buildr-1.3.2-incubating.tgz.asc |
34
+ | "buildr-1.3.2-incubating.zip":http://www.apache.org/dist/incubator/buildr/1.3.2-incubating/buildr-1.3.2-incubating.zip | "d65d20005f603338c0aedd4f17d0bc90":http://www.apache.org/dist/incubator/buildr/1.3.2-incubating/buildr-1.3.2-incubating.zip.md5 | "Sig":http://www.apache.org/dist/incubator/buildr/1.3.2-incubating/buildr-1.3.2-incubating.zip.asc |
35
+
36
+ p>. ("Release signing keys":http://www.apache.org/dist/incubator/buildr/1.3.2-incubating/KEYS)
37
+
38
+
39
+
40
+ h3. buildr 1.3.1-incubating (2008-05-19)
41
+
42
+ |_. Package |_. MD5 Checksum |_. PGP |
43
+ | "buildr-1.3.1-incubating.gem":http://www.apache.org/dist/incubator/buildr/1.3.1-incubating/buildr-1.3.1-incubating.gem | "476436429b9a6c4ed178009ba17dd724":http://www.apache.org/dist/incubator/buildr/1.3.1-incubating/buildr-1.3.1-incubating.gem.md5 | "Sig":http://www.apache.org/dist/incubator/buildr/1.3.1-incubating/buildr-1.3.1-incubating.gem.asc |
44
+ | "buildr-1.3.1-java-incubating.gem":http://www.apache.org/dist/incubator/buildr/1.3.1-incubating/buildr-1.3.1-java-incubating.gem | "7af37acc10621b18d4b870119c36d998":http://www.apache.org/dist/incubator/buildr/1.3.1-incubating/buildr-1.3.1-java-incubating.gem.md5 | "Sig":http://www.apache.org/dist/incubator/buildr/1.3.1-incubating/buildr-1.3.1-java-incubating.gem.asc |
45
+ | "buildr-1.3.1-incubating.tgz":http://www.apache.org/dist/incubator/buildr/1.3.1-incubating/buildr-1.3.1-incubating.tgz | "ad6694416fc2e6eb22ab1042dcc41411":http://www.apache.org/dist/incubator/buildr/1.3.1-incubating/buildr-1.3.1-incubating.tgz.md5 | "Sig":http://www.apache.org/dist/incubator/buildr/1.3.1-incubating/buildr-1.3.1-incubating.tgz.asc |
46
+ | "buildr-1.3.1-incubating.zip":http://www.apache.org/dist/incubator/buildr/1.3.1-incubating/buildr-1.3.1-incubating.zip | "0470349978b93e645ca2e9607e304ed1":http://www.apache.org/dist/incubator/buildr/1.3.1-incubating/buildr-1.3.1-incubating.zip.md5 | "Sig":http://www.apache.org/dist/incubator/buildr/1.3.1-incubating/buildr-1.3.1-incubating.zip.asc |
47
+
48
+ p>. ("Release signing keys":http://www.apache.org/dist/incubator/buildr/1.3.1-incubating/KEYS)
49
+
50
+
51
+ h3. buildr 1.3.0-incubating (2008-05-01)
52
+
53
+ |_. Package |_. MD5 Checksum |_. PGP |
54
+ | "buildr-1.3.0-incubating.gem":http://www.apache.org/dist/incubator/buildr/1.3.0-incubating/buildr-1.3.0-incubating.gem | "37758d0a8dabc570799b0a58d23d19f0":http://www.apache.org/dist/incubator/buildr/1.3.0-incubating/buildr-1.3.0-incubating.gem.md5 | "Sig":http://www.apache.org/dist/incubator/buildr/1.3.0-incubating/buildr-1.3.0-incubating.gem.asc |
55
+ | "buildr-1.3.0-java-incubating.gem":http://www.apache.org/dist/incubator/buildr/1.3.0-incubating/buildr-1.3.0-java-incubating.gem | "6a3a86740077f739c111514e0e2b9e06":http://www.apache.org/dist/incubator/buildr/1.3.0-incubating/buildr-1.3.0-java-incubating.gem.md5 | "Sig":http://www.apache.org/dist/incubator/buildr/1.3.0-incubating/buildr-1.3.0-java-incubating.gem.asc |
56
+ | "buildr-1.3.0-incubating.tgz":http://www.apache.org/dist/incubator/buildr/1.3.0-incubating/buildr-1.3.0-incubating.tgz | "acd84ad8c5031962e65b0036f3bc2e76":http://www.apache.org/dist/incubator/buildr/1.3.0-incubating/buildr-1.3.0-incubating.tgz.md5 | "Sig":http://www.apache.org/dist/incubator/buildr/1.3.0-incubating/buildr-1.3.0-incubating.tgz.asc |
57
+ | "buildr-1.3.0-incubating.zip":http://www.apache.org/dist/incubator/buildr/1.3.0-incubating/buildr-1.3.0-incubating.zip | "d85945f05efd0e512e6d769e3dd1cc98":http://www.apache.org/dist/incubator/buildr/1.3.0-incubating/buildr-1.3.0-incubating.zip.md5 | "Sig":http://www.apache.org/dist/incubator/buildr/1.3.0-incubating/buildr-1.3.0-incubating.zip.asc |
58
+
59
+ p>. ("Release signing keys":http://www.apache.org/dist/incubator/buildr/1.3.0-incubating/KEYS)
60
+
61
+
62
+ p(note). When downloading from files please check the "md5sum":http://www.apache.org/dev/release-signing#md5 and verify the "OpenPGP":http://www.apache.org/dev/release-signing#openpgp compatible signature from the main Apache site. This "KEYS":http://www.apache.org/dist/incubator/buildr/KEYS file contains the public keys used for signing releases. It is recommended that (when possible) a web of trust is used to confirm the identity of these keys. For more information, please see the "Apache Release FAQ":http://www.apache.org/dev/release.html.
@@ -0,0 +1,175 @@
1
+ h1. Extending Buildr
2
+
3
+ h2. Organizing Tasks
4
+
5
+ A couple of things we learned while working on Buildr. Being able to write your own Rake tasks is a very powerful feature. But if you find yourself doing the same thing over and over, you might also want to consider functions. They give you a lot more power and easy abstractions.
6
+
7
+ For example, we use OpenJPA in several projects. It's a very short task, but each time I have to go back to the OpenJPA documentation to figure out how to set the Ant MappingTool task, tell Ant how to define it. After the second time, you're recognizing a pattern and it's just easier to write a function that does all that for you.
8
+
9
+ Compare this:
10
+
11
+ {{{!ruby
12
+ file('derby.sql') do
13
+ REQUIRES = [
14
+ 'org.apache.openjpa:openjpa-all:jar:0.9.7-incubating',
15
+ 'commons-collections:commons-collections:jar:3.1',
16
+ . . .
17
+ 'net.sourceforge.serp:serp:jar:1.11.0' ]
18
+ ant('openjpa') do |ant|
19
+ ant.taskdef :name=>'mapping',
20
+ :classname=>'org.apache.openjpa.jdbc.ant.MappingToolTask',
21
+ :classpath=>REQUIRES.join(File::PATH_SEPARATOR)
22
+ ant.mapping :schemaAction=>'build', :sqlFile=>task.name,
23
+ :ignoreErrors=>true do
24
+ ant.config :propertiesFile=>_(:source, :main, :sql, 'derby.xml')
25
+ ant.classpath :path=>projects('store', 'utils' ).
26
+ flatten.map(&:to_s).join(File::PATH_SEPARATOR)
27
+ end
28
+ end
29
+ end
30
+ }}}
31
+
32
+ To this:
33
+
34
+ {{{!ruby
35
+ file('derby.sql') do
36
+ mapping_tool :action=>'build', :sql=>task.name,
37
+ :properties=>_(:source, :main, :sql, 'derby.xml'),
38
+ :classpath=>projects('store', 'utils')
39
+ end
40
+ }}}
41
+
42
+ I prefer the second. It's easier to look at the Buildfile and understand what it does. It's easier to maintain when you only have to look at the important information.
43
+
44
+ But just using functions is not always enough. You end up with a Buildfile containing a lot of code that clearly doesn't belong there. For starters, I recommend putting it in the @tasks@ directory. Write it into a file with a @.rake@ extension and place that in the @tasks@ directory next to the Buildfile. Buildr will automatically pick it up and load it for you.
45
+
46
+ If you want to share these pre-canned definitions between projects, you have a few more options. You can share the @tasks@ directory using SVN externals. Another mechanism with better version control is to package all these tasks, functions and modules into a "Gem":http://rubygems.org/ and require it from your Buildfile. You can run your own internal Gem server for that.
47
+
48
+ For individual task files, you can also use "Sake":http://errtheblog.com/post/6069 for system-wide Rake tasks deployment.
49
+
50
+
51
+ h2. Creating Extensions
52
+
53
+ The basic mechanism for extending projects in Buildr are Ruby modules. In fact, base features like compiling and testing are all developed in the form of modules, and then added to the core Project class.
54
+
55
+ A module defines instance methods that are then mixed into the project and become instance methods of the project. There are two general ways for extending projects. You can extend all projects by including the module in Project:
56
+
57
+ {{{!ruby
58
+ class Project
59
+ include MyExtension
60
+ end
61
+ }}}
62
+
63
+ You can also extend a given project instance and only that instance by extending it with the module:
64
+
65
+ {{{!ruby
66
+ define 'foo' do
67
+ extend MyExtension
68
+ end
69
+ }}}
70
+
71
+ Some extensions require tighter integration with the project, specifically for setting up tasks and properties, or for configuring tasks based on the project definition. You can do that by adding callbacks to the process.
72
+
73
+ The easiest way to add callbacks is by incorporating the Extension module in your own extension, and using the various class methods to define callback behavior.
74
+
75
+ |_. Method |_. Usage |
76
+ | @first_time@ | This block will be called once for any particular extension. You can use this to setup top-level and local tasks. |
77
+ | @before_define@ | This block is called once for the project with the project instance, right before running the project definition. You can use this to add tasks and set properties that will be used in the project definition. |
78
+ | @after_define@ | This block is called once for the project with the project instance, right after running the project definition. You can use this to do any post-processing that depends on the project definition. |
79
+
80
+ This example illustrates how to write a simple extension:
81
+
82
+ {{{!ruby
83
+ module LinesOfCode
84
+ include Extension
85
+
86
+ first_time do
87
+ # Define task not specific to any projet.
88
+ desc 'Count lines of code in current project'
89
+ Project.local_task('loc')
90
+ end
91
+
92
+ before_define do |project|
93
+ # Define the loc task for this particular project.
94
+ define_task 'loc' do |task|
95
+ lines = task.prerequisites.map { |path| Dir["#{path}/**/*"] }.flatten.uniq.
96
+ inject(0) { |total, file| total + File.readlines(file).count }
97
+ puts "Project #{project.name} has #{lines} lines of code"
98
+ end
99
+ end
100
+
101
+ after_define do |project|
102
+ # Now that we know all the source directories, add them.
103
+ task('loc'=>compile.sources + compile.test.sources)
104
+ end
105
+
106
+ # To use this method in your project:
107
+ # loc path_1, path_2
108
+ def loc(*paths)
109
+ task('loc'=>paths)
110
+ end
111
+
112
+ end
113
+
114
+ class Buildr::Project
115
+ include LinesOfCode
116
+ end
117
+ }}}
118
+
119
+
120
+ h2. Using Alternative Layouts
121
+
122
+ Buildr follows a common convention for project layouts: Java source files appear in @src/main/java@ and compile to @target/classes@, resources are copied over from @src/main/resources@ and so forth. Not all projects follow this convention, so it's now possible to specify an alternative project layout.
123
+
124
+ The default layout is available in @Layout.default@, and all projects inherit it. You can set @Layout.default@ to your own layout, or define a project with a given layout (recommended) by setting the @:layout@ property. Projects inherit the layout from their parent projects. For example:
125
+
126
+ {{{!ruby
127
+ define 'foo', :layout=>my_layout do
128
+ ...
129
+ end
130
+ }}}
131
+
132
+ A layout is an object that implements the @expand@ method. The easiest way to define a custom layout is to create a new @Layout@ object and specify mapping between names used by Buildr and actual paths within the project. For example:
133
+
134
+ {{{!ruby
135
+ my_layout = Layout.new
136
+ my_layout[:source, :main, :java] = 'java'
137
+ my_layout[:source, :main, :resources] = 'resources'
138
+ }}}
139
+
140
+ Partial expansion also works, so you can specify the above layout using:
141
+
142
+ {{{!ruby
143
+ my_layout = Layout.new
144
+ my_layout[:source, :main] = ''
145
+ }}}
146
+
147
+ If you need anything more complex, you can always subclass @Layout@ and add special handling in the @expand@ method, you'll find one such example in the API documentation.
148
+
149
+ The built-in tasks expand lists of symbols into relative paths, using the following convention:
150
+
151
+ |_. Path |_. Expands to |
152
+ | @:source, :main, <lang/usage>@ | Directory containing source files for a given language or usage, for example, @:java@, @:resources@, @:webapp@. |
153
+ | @:source, :test, <lang/usage>@ | Directory containing test files for a given language or usage, for example, @:java@, @:resources@. |
154
+ | @:target, :generated@ | Target directory for generated code (typically source code). |
155
+ | @:target, :main, <lang/usage>@ | Target directory for compiled code, for example, @:classes@, @:resources@. |
156
+ | @:target, :test, <lang/usage>@ | Target directory for compile test cases, for example, @:classes@, @:resources@. |
157
+ | @:reports, <framework/usage>@ | Target directory for generated reports, for example, @:junit@, @:coverage@. |
158
+
159
+ All tasks are encouraged to use the same convention, and whenever possible, we recommend using the project's @path_to@ method to expand a list of symbols into a path, or use the appropriate path when available. For example:
160
+
161
+ {{{!ruby
162
+ define 'bad' do
163
+ # This may not be the real target.
164
+ puts 'Compiling to ' + path_to('target/classes')
165
+ # This will break with different layouts.
166
+ package(:jar).include 'src/main/etc/*'
167
+ end
168
+
169
+ define 'good' do
170
+ # This is always the compiler's target.
171
+ puts 'Compiling to ' + compile.target.to_s
172
+ # This will work with different layouts.
173
+ package(:jar).include path_to(:source, :main, :etc, '*')
174
+ end
175
+ }}}
@@ -0,0 +1,273 @@
1
+ h1. Getting Started
2
+
3
+ h2. Installing Buildr
4
+
5
+ The installation instructions are slightly different for each operating system. Pick the one that best matches your operating system and target platform.
6
+
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.
8
+
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.
10
+
11
+
12
+ h3. Linux
13
+
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).
15
+
16
+ On *RedHat/Fedora* you can use yum to install Ruby and RubyGems, and then upgrade to the most recent version of RubyGems:
17
+
18
+ {{{!sh
19
+ $ sudo yum install ruby rubygems ruby-devel gcc
20
+ $ sudo gem update --system
21
+ }}}
22
+
23
+ On *Ubuntu* you have to install several packages:
24
+
25
+ {{{!sh
26
+ $ sudo apt-get install ruby-full ruby1.8-dev libopenssl-ruby build-essential
27
+ }}}
28
+
29
+ The Debian package for @rubygems@ will not allow you to install Buildr, so you need to install RubyGems from source:
30
+
31
+ {{{!sh
32
+ $ wget http://rubyforge.org/frs/download.php/38646/rubygems-1.2.0.tgz
33
+ $ tar xzf rubygems-1.2.0.tgz
34
+ $ cd rubygems-1.2.0
35
+ $ sudo ruby setup.rb
36
+ $ sudo ln -s /usr/bin/gem1.8 /usr/bin/gem
37
+ }}}
38
+
39
+ Before installing Buildr, please set the @JAVA_HOME@ environment variable to point to your JDK distribution. Next, use Ruby Gem to install Buildr:
40
+
41
+ {{{!sh
42
+ $ sudo env JAVA_HOME=$JAVA_HOME gem install buildr
43
+ }}}
44
+
45
+ To upgrade to a new version or install a specific version:
46
+
47
+ {{{!sh
48
+ $ sudo env JAVA_HOME=$JAVA_HOME gem update buildr
49
+ $ sudo env JAVA_HOME=$JAVA_HOME gem install buildr -v 1.3.3
50
+ }}}
51
+
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.
53
+
54
+
55
+ h3. OS X
56
+
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/.
58
+
59
+ We recommend you first upgrade to the latest version of Ruby gems:
60
+
61
+ {{{!sh
62
+ $ sudo gem update --system
63
+ }}}
64
+
65
+ Before installing Buildr, please set the @JAVA_HOME@ environment variable to point to your JDK distribution:
66
+
67
+ {{{!sh
68
+ $ export JAVA_HOME=/Library/Java/Home
69
+ }}}
70
+
71
+ To install Buildr:
72
+
73
+ {{{!sh
74
+ $ sudo env JAVA_HOME=$JAVA_HOME gem install buildr
75
+ }}}
76
+
77
+ To upgrade to a new version or install a specific version:
78
+
79
+ {{{!sh
80
+ $ sudo env JAVA_HOME=$JAVA_HOME gem update buildr
81
+ $ sudo env JAVA_HOME=$JAVA_HOME gem install buildr -v 1.3.3
82
+ }}}
83
+
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.
85
+
86
+
87
+ h3. Windows
88
+
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/.
90
+
91
+ We recommend you first upgrade to the latest version of Ruby gems:
92
+
93
+ {{{!sh
94
+ > gem update --system
95
+ }}}
96
+
97
+ Before installing Buildr, please set the @JAVA_HOME@ environment variable to point to your JDK distribution. Next, use Ruby Gem to install Buildr:
98
+
99
+ {{{!sh
100
+ > gem install buildr
101
+ }}}
102
+
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.
104
+
105
+ To upgrade to a new version or install a specific version:
106
+
107
+ {{{!sh
108
+ > gem update buildr
109
+ > gem install buildr -v 1.3.3
110
+ }}}
111
+
112
+
113
+ h3. JRuby
114
+
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/.
116
+
117
+ After uncompressing JRuby, update your @PATH@ to include both @java@ and @jruby@ executables.
118
+
119
+ For Linux and OS X:
120
+
121
+ {{{!sh
122
+ $ export PATH=$PATH:[path to JRuby]/bin:$JAVA_HOME/bin
123
+ $ jruby -S gem install buildr
124
+ }}}
125
+
126
+ For Windows:
127
+
128
+ {{{!sh
129
+ > set PATH=%PATH%;[path to JRuby]/bin;%JAVA_HOME%/bin
130
+ > jruby -S gem install buildr
131
+ }}}
132
+
133
+ To upgrade to a new version or install a specific version:
134
+
135
+ {{{!sh
136
+ $ jruby -S gem update buildr
137
+ $ jruby -S gem install buildr -v 1.3.3
138
+ }}}
139
+
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@.
141
+
142
+ *Important: Running JRuby and Ruby side by side*
143
+
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.
145
+
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.
147
+
148
+ To work exclusively with JRuby, make sure it shows first on the path, for example, by setting @PATH=/opt/jruby/bin:$PATH@.
149
+
150
+ You can use JRuby and Ruby side by side, by running scripts with the @-S@ command line argument. For example:
151
+
152
+ {{{!
153
+ $ # with Ruby
154
+ $ ruby -S gem install buildr
155
+ $ ruby -S buildr
156
+ $ # with JRuby
157
+ $ jruby -S gem install buildr
158
+ $ jruby -S buildr
159
+ }}}
160
+
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.
162
+
163
+
164
+ h2. Document Conventions
165
+
166
+ Lines that start with @$@ are command lines, for example:
167
+
168
+ {{{!sh
169
+ $ # Run Buildr
170
+ $ buildr
171
+ }}}
172
+
173
+ Lines that start with @=>@ show output from the console or the result of a method, for example:
174
+
175
+ {{{!sh
176
+ puts 'Hello world'
177
+ => "Hello world"
178
+ }}}
179
+
180
+ And as you guessed, everything else is Buildfile Ruby or Java code. You can figure out which language is which.
181
+
182
+
183
+
184
+ h2. Running Buildr
185
+
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:
187
+
188
+ {{{!sh
189
+ $ buildr
190
+ }}}
191
+
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@.
193
+
194
+ You use Buildr by running the @buildr@ command:
195
+
196
+ {{{!sh
197
+ $ buildr [options] [tasks] [name=value]
198
+ }}}
199
+
200
+ There are several options you can use, for a full list of options type:
201
+
202
+ {{{!sh
203
+ $ buildr --help
204
+ }}}
205
+
206
+ |_. Option |_. Usage |
207
+ | @-f/--buildfile [file]@ | Specify the buildfile. |
208
+ | @-e/--environment [name]@ | Environment name (e.g. development, test, production). |
209
+ | @-h/--help@ | Display this help message. |
210
+ | @-n/--nosearch@ | Do not search parent directories for the buildfile. |
211
+ | @-q/--quiet@ | Do not log messages to standard output. |
212
+ | @-r/--require [file]@ | Require MODULE before executing buildfile. |
213
+ | @-t/--trace@ | Turn on invoke/execute tracing, enable full backtrace. |
214
+ | @-v/--version@ | Display the program version. |
215
+ | @-P/--prereqs@ | Display tasks and dependencies, then exit. |
216
+
217
+ You can tell Buildr to run specific tasks and the order to run them. For example:
218
+
219
+ {{{!sh
220
+ # Clean and rebuild
221
+ buildr clean build
222
+ # Package and install
223
+ buildr install
224
+ }}}
225
+
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@.
227
+
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.
229
+
230
+ For example:
231
+
232
+ {{{!sh
233
+ $ export JAVA_OPTS='-Xms1g -Xmx1g'
234
+ $ buildr TEST=no
235
+ }}}
236
+
237
+
238
+ h2. Help Tasks
239
+
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@.
241
+
242
+ To start with, type:
243
+
244
+ {{{!sh
245
+ $ buildr help
246
+ }}}
247
+
248
+ You can list the name and description of all your projects using the @help:projects@ task. For example:
249
+
250
+ {{{!sh
251
+ $ buildr help:projects
252
+ killer-app # Code. Build. ??? Profit!
253
+ killer-app:teh-api # Abstract classes and interfaces
254
+ killer-app:teh-impl # All those implementation details
255
+ killer-app:la-web # What our users see
256
+ }}}
257
+
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.
259
+
260
+ So next let's talk about "projects":projects.html.
261
+
262
+
263
+ h2. Learning More
264
+
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_.
266
+
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/.
268
+
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.
270
+
271
+ *AntWrap* Buildr uses AntWrap, for configuring and running Ant tasks. You can learn more from the "Antwrap documentation":http://antwrap.rubyforge.org/.
272
+
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.