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
@@ -0,0 +1,244 @@
1
+ ---
2
+ layout: default
3
+ title: Building
4
+ ---
5
+
6
+
7
+ To remove any confusion, Buildr's build task is actually called @build@. It's also the default task that executes when you run @buildr@ without any task name.
8
+
9
+ The @build@ task runs two other tasks: @compile@ and its associated tasks (that would be, @resources@) and @test@ and its associated tasks (@test:compile@, @test:setup@ and friends). We'll talk about @compile@ more in this section, and @test@ later on. We'll also show you how to run @build@ without testing, not something we recommend, but a necessary feature.
10
+
11
+ Why @build@ and not @compile@? Some projects do more than just compiling. Other projects don't compile at all, but perform other build tasks, for example, creating a database schema or command line scripts. So we want you to get in the practice of running the @build@ task, and help you by making it the default task.
12
+
13
+
14
+ h2(#compiling). Compiling
15
+
16
+ Each project has its own @compile@ task you can invoke directly, by running @buildr compile@ or as part of another build task. (Yes, that @build@).
17
+
18
+ The @compile@ task looks for source files in well known directories, determines which compiler to use, and sets the target directory accordingly. For example, if it finds any Java source files in the @src/main/java@ directory, it selects the Javac compiler and generates bytecode in the @target/classes@ directories. If it finds Scala source files in the @src/main/scala@ directory it selects the Scalac compiler, and so forth.
19
+
20
+ A single project cannot use multiple compilers at the same time, hence you may prefer creating subprojects by programming language. Some compilers like Groovy's are joint-compilers, this means they can handle several languages. When the Groovy compiler is selected for a project, .groovy and .java files are compiled by groovyc.
21
+
22
+ Most often, that's just good enough and the only change you need to make is adding compile dependencies. You can use @compile.dependencies@ to get the array of dependency file tasks. For Java, each of these tasks points to a JAR or a directory containing Java classes, and the entire set of dependencies is passed to Javac as the classpath.
23
+
24
+ Buildr uses file tasks to handle dependencies, but here we're talking about the Rake dependency mechanism. It's a double entendre. It invokes these tasks before running the compiler. Some of these tasks will download JARs from remote repositories, others will create them by compiling and packaging from a different project. Using file task ensures all the dependencies exist before the compiler can use them.
25
+
26
+ An easier way to specify dependencies is by calling the @compile.with@ method. It takes a list of arguments and adds them to the dependency list. The @compile.with@ method is easier to use, it accepts several type of dependencies. You can use file names, file tasks, projects, artifacts specifications and even pass arrays of dependencies.
27
+
28
+ Most dependencies fall into the last three categories. When you pass a project to @compile.with@, it picks up all the packages created by that project. In doing so, it establishes an order of dependency between the two projects (see "Defining the Project":projects.html#defining). For example, if you make a change in project _teh-api_ and build _teh-impl_, Buildr will detect that change, recompile and package _teh-api_ before compiling _teh-impl_. You can also select a specific package using the @package@ or @packages@ methods (see "Packaging":packaging.html).
29
+
30
+ When you pass an artifact specification to @compile.with@, it creates an @Artifact@ task that will download that artifact from one of the remote repositories, install it in the local repository, and use it in your project. Rake's dependency mechanism is used here to make sure the artifact is downloaded once, when needed. Check the "Artifacts":artifacts.html section for more information about artifact specification and repositories.
31
+
32
+ For now let's just show a simple example:
33
+
34
+ {% highlight ruby %}
35
+ compile.with 'org.apache.axis2:axis2:jar:1.2',
36
+ 'org.apache.derby:derby:jar:10.1.2.1', projects('teh-api', 'teh-impl')
37
+ {% endhighlight %}
38
+
39
+ Passing arrays to @compile.with@ is just a convenient for handling multiple dependencies, we'll show more examples of that when we talk about "Artifacts":artifacts.html.
40
+
41
+ Likewise, the @compile@ task has an array of file tasks that point at the source directories you want to compile from. You can access that array by calling @compile.sources@. You can use @compile.from@ to add new source directories by passing a file name or a file task.
42
+
43
+ For example, let's run the APT tool on our annotated source code before compiling it:
44
+
45
+ {% highlight ruby %}
46
+ compile.from apt
47
+ {% endhighlight %}
48
+
49
+ When you call @apt@ on a project, it returns a file task that points to the @target/generated/apt@ directory. This file task executes by running APT, using the same list of source directories, dependencies and compiler options. It then generates new source files in the target directory. Calling @compile.from@ with that file task includes those additional source files in the list of compiled sources.
50
+
51
+ Here's another example:
52
+
53
+ {% highlight ruby %}
54
+ jjtree = jjtree(_('src/main/jjtree'), :in_package=>'com.acme')
55
+ compile.from javacc(jjtree, :in_package=>'com.acme'), jjtree
56
+ {% endhighlight %}
57
+
58
+ This time, the variable @jjtree@ is a file task that reads a JJTree source file from the @src/main/jjtree@ directory, and generates additional source files in the @target/generated/jjtree@ directory. The second line creates another file task that takes those source files, runs JavaCC on them, and generates yet more source files in @target/generated/javacc@. Finally, we include both sets of source files in addition to those already in @src/main/java@, and compile the lot.
59
+
60
+ The interesting thing about these two examples is how you're wiring file tasks together to create more complicated tasks, piping the output of one task into the inputs of another. Wiring tasks this way is the most common way to handle complex builds, and uses Rake's dependency mechanism to only run tasks when it detects a change to one of the source files.
61
+
62
+ You can also control the target directory. Use @compile.target@ to get the target directory file task. If you need to change the target directory, call the @compile.into@ method with the new path.
63
+
64
+ We use method pairs to give you finer control over the compiler, but also a way to easily configure it. Methods like @dependencies@ and @sources@ give you a live array you can manipulate, or iterate over. On the other hand, methods like @with@ and @from@ accept a wider set of arguments and clean them up for you. They also all return the same task you're calling, so you can chain methods together.
65
+
66
+ For example:
67
+
68
+ {% highlight ruby %}
69
+ compile.from('srcs').with('org.apache.axis2:axis2:jar:1.2').
70
+ into('classes').using(:target=>'1.4')
71
+ {% endhighlight %}
72
+
73
+ Buildr uses the method pair and method chaining idiom in many places to make your life easier without sacrificing flexibility.
74
+
75
+ Occasionally, you'll need to post-process the generated bytecode. Since you only want to do that after compiling, and let the compiler decide when to do that – only when changes require re-compiling – you'll want to extend the @compile@ task. You can do that by calling @compile@ with a block.
76
+
77
+ For example, to run the OpenJPA bytecode enhancer after compiling the source files:
78
+
79
+ {% highlight ruby %}
80
+ compile { open_jpa_enhance }
81
+ {% endhighlight %}
82
+
83
+ You can change various compile options by calling, you guessed, @compile.options@. For example, to set the compiler to VM compatibility with Java 1.5 and turn on all Lint messages:
84
+
85
+ {% highlight ruby %}
86
+ compile.options.target = '1.5'
87
+ compile.options.lint = 'all'
88
+ {% endhighlight %}
89
+
90
+ Or, if you want to chain methods together:
91
+
92
+ {% highlight ruby %}
93
+ compile.using :target=>'1.5', :lint=>'all'
94
+ {% endhighlight %}
95
+
96
+
97
+ Sub-projects inherit compile options from their parent project, so you only need to change these settings once in the top project. You can do so, even if the top project itself doesn't compile anything.
98
+
99
+ The options available to you depend on which compiler you are using for this particular project, obviously the options are not the same for Java and Flash. Two options are designed to work consistently across compilers.
100
+
101
+ Buildr turns the @warning@ option on by default, but turns it off when you run @buildr --silent@. It also sets the @debug@ option on, but turns it off when making a release. You can also control the @debug@ option from the command line, for example:
102
+
103
+ {% highlight ruby %}
104
+ # When calling buildr
105
+ $ buildr compile debug=off
106
+
107
+ # Once until we change the variable
108
+ $ export DEBUG=off
109
+ $ buildr compile
110
+ {% endhighlight %}
111
+
112
+ The default source and target directories, compiler settings and other options you can use depend on the specific language. You can find more information in the "Languages":languages.html section.
113
+
114
+
115
+ h2(#resources). Resources
116
+
117
+
118
+ The @compile@ task comes bundled with a @resources@ task. It copies files from the @src/main/resources@ directory into @target/resources@. Best used for copying files that you want to included in the generated code, like configuration files, i18n messages, images, etc.
119
+
120
+ The @resources@ task uses a filter that can change files as it copies them from source to destination. The most common use is by mapping values using a hash. For example, to substitute "${version}" for the project's version number and "${copyright}" for "Acme Inc (C) 2007" :
121
+
122
+ {% highlight ruby %}
123
+ resources.filter.using 'version'=>version,
124
+ 'copyright'=>'Acme Inc (C) 2007'
125
+ {% endhighlight %}
126
+
127
+ You can also use "profiles":settings_profiles.html#profiles to supply a name/value map that all @resources@ task should default to, by adding a @filter@ element to each of the profiles. The following examples shows a @profiles.yaml@ file that applies the same filter in development and test environments:
128
+
129
+ {% highlight yaml %}
130
+ filter: &alpha1
131
+ version: experimental
132
+ copyright: Acme Inc (C) 2007
133
+
134
+ development:
135
+ filter: *alpha1
136
+ test:
137
+ filter: *alpha1
138
+ {% endhighlight %}
139
+
140
+ You can specify a different format by passing it as the first argument. Supported formats include:
141
+
142
+ |_. Format |_. Usage |
143
+ | @:ant@ | Map from @key@ to value. |
144
+ | @:maven@ | Map from @${key}@ to value (default). |
145
+ | @:ruby@ | Map from @#{key}@ to value. |
146
+ | @Regexp@ | Map using the matched value of the regular expression (e.g. @/=(.*?)=/@). |
147
+
148
+ For example, using the @:ruby@ format instead of the default @:maven@ format:
149
+
150
+ {% highlight ruby %}
151
+ resources.filter.using :ruby, 'version'=>version,
152
+ 'copyright'=>'Acme Inc (C) 2007'
153
+ {% endhighlight %}
154
+
155
+ For more complicated mapping you can also pass a method or a proc. The filter will call it once for each file with the file name and content.
156
+
157
+ If you need to copy resource files from other directories, add these source directories by calling the @from@ method, for example:
158
+
159
+ {% highlight ruby %}
160
+ resources.from _('src/etc')
161
+ {% endhighlight %}
162
+
163
+ You can select to copy only specific files using common file matching patterns. For example, to include only HTML files:
164
+
165
+ {% highlight ruby %}
166
+ resources.include '*.html'
167
+ {% endhighlight %}
168
+
169
+ To include all files, except for files in the @scratch@ directory:
170
+
171
+ {% highlight ruby %}
172
+ resources.exclude 'scratch/*'
173
+ {% endhighlight %}
174
+
175
+ The filter always excludes the @CVS@ and @.svn@ directories, and all files ending with @.bak@ or @~@, so no need to worry about these.
176
+
177
+ A file pattern can match any file name or part of a file name using an asterisk (@*@). Double asterisk (@**@) matches directories recursively, for example, @'src/main/java/**/*.java'@. You can match any character using a question mark (@?@), or a set of characters using square brackets (@[]@), similar to regular expressions, for example, @'[Rr]eadme'@. You can also match from a set of names using curly braces (@{}@), for example, @'*.{html,css}'@.
178
+
179
+ You can use filters elsewhere. The @filter@ method creates a filter, the @into@ method sets the target directory, and @using@ specifies the mapping. Last, you call @run@ on the filter to activate it.
180
+
181
+ For example:
182
+
183
+ {% highlight ruby %}
184
+ filter('src/specs').into('target/specs').
185
+ using('version'=>version, 'created'=>Time.now).run
186
+ {% endhighlight %}
187
+
188
+ The @resources@ task is, in fact, just a wrapper around such a filter that automatically adds the @src/main/resources@ directory as one of the source directories.
189
+
190
+
191
+ h2(#more). More On Building
192
+
193
+ The @build@ task runs the @compile@ (and @resources@) tasks as prerequisites, followed by any actions you add to it, and completes by running the @test@ task. The @build@ task itself is a prerequisite to other tasks, for example, @package@ and @upload@.
194
+
195
+ You can extend the @build@ task in two ways. You can add more prerequisites that will execute before the task itself, or you can add actions that will execute as part of the task. Which one you choose is up to you, we'll show you how they differ in a second. If you call @build@ with a list of tasks, it adds these tasks as prerequisites. Call @build@ with a block, and it adds that block as an action. Again, a common idiom you'll see elsewhere in Buildr and Rake.
196
+
197
+ Let's look at a simple example. Say we want to generate a Derby database from an SQL file and include it in the ZIP package:
198
+
199
+ {% highlight ruby %}
200
+ db = Derby.create(_('target/derby/db')=>_('src/main/sql/derby.sql'))
201
+ package(:zip).include db
202
+ {% endhighlight %}
203
+
204
+ There's nothing fundamentally wrong with this code, if that's what you intend to do. But in practice, you don't always run the @package@ task during development, so you won't notice if something is wrong with this task when you build. For example, if it fails to generate the SQL file. In addition, the @package@ task runs after @build@, so you can't use the database in your test cases.
205
+
206
+ So let's refactor it. We're going to use the variable @db@ to reference the file task that creates the database, and make it a prerequisite of the @build@ task. And use that same variable again to include the database in the ZIP package:
207
+
208
+ {% highlight ruby %}
209
+ db = Derby.create(_('target/derby/db')=>_('src/main/sql/derby.sql'))
210
+ build db
211
+ package(:zip).include db
212
+ {% endhighlight %}
213
+
214
+ Much better. We're using the same task twice, but since we're using Rake here, it will only execute once. In fact, it will only execute if we don't already have a Derby database, or if it detects a change to the SQL file and needs to recreate the database.
215
+
216
+ p(tip). @Derby.create@ is not part of Buildr, you can get "derby.rake":http://svn.apache.org/repos/asf/ode/trunk/tasks/derby.rake here.
217
+
218
+ Here's another example. We want to copy some files over as part of the build, and apply a filter to them. This time, we're going to extend the @build@ task:
219
+
220
+ {% highlight ruby %}
221
+ build do
222
+ filter('src/specs').into('target/specs').
223
+ using('version'=>version, 'created'=>Time.now).run
224
+ end
225
+ {% endhighlight %}
226
+
227
+ The @build@ task is recursive, so running @buildr build@ picks the current project and runs its @build@ task, which in turn runs the @build@ task on each of its sub-projects. One @build@ task to rule them all.
228
+
229
+
230
+ h2(#cleaning). Cleaning
231
+
232
+ The @build@ task has an evil twin, the @clean@ task. It's the task you use to remove all the files created during the build, especially when you mess things up and want to start all over.
233
+
234
+ It basically erases the target directories, the one called @target@, and if you get creative and change the target directory for tasks like @compile@, it will also erase those. If you decide to generate files outside the target directory and want to cleanup after yourself, just extend the @clean@ task.
235
+
236
+ For example:
237
+
238
+ {% highlight ruby %}
239
+ clean { rm_rf _('staged') }
240
+ {% endhighlight %}
241
+
242
+ The @rm_rf@ method deletes the directory and all files in it. It's named after UNIX's infamous @rm -rf@. Use it wisely. This is also a good time to introduce you to @FileUtils@, a standard Ruby library that contains convenient methods for creating and deleting directories, copying and moving files, even comparing two files. They're all free of charge when you use Buildr.
243
+
244
+ Now let's "talk about the artifacts":artifacts.html we mentioned before.
@@ -0,0 +1,252 @@
1
+ ---
2
+ layout: default
3
+ title: Contributing
4
+ ---
5
+
6
+ Buildr is a community effort, and we welcome all contributors. Here's your chance to get involved and help your fellow developers.
7
+
8
+ h2(#involved). Getting involved
9
+
10
+ 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.
11
+
12
+
13
+ h2(#mailing_lists). Mailing Lists
14
+
15
+ We run two mailing lists, the "users":http://buildr.markmail.org/search/list:users mailing list for developers working with Buildr, that would be you if you're using Buildr or interested in using it. There's the "dev":http://buildr.markmail.org/search/list:dev mailing list for talking about development of Buildr itself. There's also "commits":http://buildr.markmail.org/search/list:commits mailing list for following SVN commits and JIRA issues.
16
+
17
+ Check the "mailing lists":mailing_lists.html page for more information on subscribing, searching and posting to the mailing list.
18
+
19
+
20
+ h2(#bugs). Bugs (aka Issues)
21
+
22
+ 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.
23
+
24
+ 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.
25
+
26
+ 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.
27
+
28
+ 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:
29
+
30
+ {% highlight sh %}
31
+ $ ruby --version
32
+ $ buildr --version
33
+ $ java --version
34
+ {% endhighlight %}
35
+
36
+
37
+ h2(#wiki). Community Wiki
38
+
39
+ "Our community Wiki":http://cwiki.apache.org/confluence/display/BUILDR/Index.
40
+
41
+
42
+ h2(#code). Contributing Code
43
+
44
+ Yes, please.
45
+
46
+ 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.
47
+
48
+ h3. The Perfect Patch
49
+
50
+ If you want to get your patch accepted quickly:
51
+
52
+ # 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.
53
+ # 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.
54
+ # 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.
55
+ # Provide a patch with the fix/change itself. Keep it separate from the specs, so it's easy to apply them individually.
56
+
57
+ 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.
58
+
59
+ h3. Working on a new feature?
60
+
61
+ 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.
62
+
63
+ 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/.
64
+
65
+
66
+ h2(#edge). Living on the edge
67
+
68
+ 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.
69
+
70
+ h3(#svn). SVN
71
+
72
+ 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/buildr:
73
+
74
+ {% highlight sh %}
75
+ $ svn co http://svn.apache.org/repos/asf/buildr/trunk buildr
76
+ {% endhighlight %}
77
+
78
+ You can also browse the "Buildr repository":http://svn.apache.org/repos/asf/buildr.
79
+
80
+ h3(#git). Git
81
+
82
+ Not a fan of SVN? We understand. You can also use the "official Apache Git clone.":http://git.apache.org This clone is maintained by the ASF and kept in sync with the SVN repository (though, in practice there may be some delay in cloning recent commits). Apache's Git hosting supports both git:// and http:// protocols (you should use git:// if at all possible as it is faster than http://):
83
+
84
+ {% highlight sh %}
85
+ $ git clone git://git.apache.org/buildr.git
86
+ # or...
87
+ $ git clone http://git.apache.org/buildr.git
88
+ {% endhighlight %}
89
+
90
+ 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.
91
+
92
+ And keep this "Git cheat sheet":http://ktown.kde.org/~zrusin/git/git-cheat-sheet-medium.png close at hand. Very useful.
93
+
94
+ h4. GitHub
95
+
96
+ You are also welcome to fork or clone the "Buildr repository on GitHub":http://github.com/apache/buildr. This repository is just an exact mirror of the official Apache Git clone referenced above (updated every 30 minutes). Some of the core committers also maintain their own forks of Buildr on GitHub, often containing experimental and in-progress development slated for eventual inclusion into the SVN. For reference, they are listed below:
97
+
98
+ * "Assaf Arkin":http://github.com/assaf/buildr
99
+ * "Victor Hugo Borja":http://github.com/vic/buildr
100
+ * "Daniel Spiewak":http://github.com/djspiewak/buildr
101
+
102
+ h3. Working with Source Code
103
+
104
+ To install Buildr from the source directory:
105
+
106
+ {% highlight sh %}
107
+ $ cd buildr
108
+ $ rake setup install
109
+ {% endhighlight %}
110
+
111
+ When using Buildr for JRuby:
112
+
113
+ {% highlight sh %}
114
+ $ cd buildr
115
+ $ jruby -S rake setup install
116
+ {% endhighlight %}
117
+
118
+ 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.
119
+
120
+ 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@.
121
+
122
+ 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.
123
+
124
+
125
+ h3. Using development build
126
+
127
+ 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@:
128
+
129
+ {% highlight sh %}
130
+ gem source --add http://people.apache.org/~assaf/buildr/snapshot/
131
+ {% endhighlight %}
132
+
133
+ 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@.
134
+
135
+ If you want to go back to using the RubyForge releases:
136
+
137
+ {% highlight sh %}
138
+ gem source --remove http://people.apache.org/~assaf/buildr/snapshot/
139
+ gem install buildr
140
+ {% endhighlight %}
141
+
142
+
143
+ h2(#testing). Tested and Documented
144
+
145
+ Two things we definitely encourage!
146
+
147
+ h3. Testing/Specs
148
+
149
+ 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.
150
+
151
+ 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.
152
+
153
+ You can run an individual specifications using the @spec@ command, for example:
154
+
155
+ {% highlight sh %}
156
+ $ spec spec/compiler_spec.rb
157
+ $ spec spec/compiler_spec.rb -l 409
158
+ {% endhighlight %}
159
+
160
+ 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.
161
+
162
+ To make sure your change did not break anything else, you can run all the specifications (be patient, we have a lot of these):
163
+
164
+ {% highlight sh %}
165
+ $ rake spec
166
+ {% endhighlight %}
167
+
168
+ 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_.
169
+
170
+ We always @rake spec@ before making a release.
171
+
172
+ For full test coverage:
173
+
174
+ {% highlight sh %}
175
+ $ rake coverage
176
+ {% endhighlight %}
177
+
178
+ 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.
179
+
180
+
181
+ h2(#docs). Documentation
182
+
183
+ 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.
184
+
185
+ For simple typos and quick fixes, just send a message to the mailing list or log an issue in JIRA.
186
+
187
+ 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 Git/SVN, edit, and @svn diff@ to create a patch.
188
+
189
+ 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.
190
+
191
+ Syntax highlighting handled by "Pygments":http://pygments.org. Use the special @highlight@ tag to separate code sample from the rest of the text and to tell Pygments which language to use. For example:
192
+
193
+ <notextile><pre>
194
+ &#123;&#37; highlight ruby &#37;&#125;
195
+ define 'project' do
196
+ # Just a sample
197
+ end
198
+ &#123;&#37; endhighlight &#37;&#125;
199
+ </pre></notextile>
200
+
201
+ Have a look at existing documentation to see writing conventions, specifically:
202
+
203
+ * Separate paragraphs with two newlines.
204
+ * Use one newline only if you need a &lt;br&gt; tag, otherwise, no newlines inside the paragraph.
205
+ * When creating a new page, don't forget the YAML premable at the top (Jekyll needs the page title and layout).
206
+ * The layout uses H1 to render the page title; only use H2 through H4 for the page content.
207
+ * Use H2 headers for the major page sections. Give each H2 header a unique ID so the table of contents can link to it.
208
+ * Separating sentences with two spaces, just a convenience when editing in a text editor using monospaced fonts.
209
+ * If in doubt, ask.
210
+
211
+ To go from Textile to HTML we use "Jekyll":http://github.com/mojombo/jekyll. You can use the @jekyll@ rake task to transform the files under @doc@ and create a copy of the Web site in the directory @_site@. For example:
212
+
213
+ {% highlight sh %}
214
+ $ rake jekyll
215
+ $ open _site/index.html
216
+ {% endhighlight %}
217
+
218
+ There is no live editing, but you can run @rake jekyll auto=true@, and when you update and save a Textile page it will regenerate the corresponding HTML page.
219
+
220
+ To go from HTML to PDF we use "PrinceXML":http://www.princexml.com/. The target file @buildr.pdf@ is generated by first running Jekyll and then merging the generated HTML pages into a single PDF document. For example:
221
+
222
+ {% highlight sh %}
223
+ $ rake buildr.pdf
224
+ $ open buildr.pdf
225
+ {% endhighlight %}
226
+
227
+
228
+ h2(#contributors). Contributors
229
+
230
+ Here is the list of people who are actively working and committing on Buildr:
231
+
232
+ *"Assaf Arkin":http://labnotes.org* (assaf at apache.org)
233
+
234
+ Started working on Buildr because Maven was too much pain and Rake wasn't enough. Assaf has been hanging around Apache since 1999, as founding contributor to XML Apache, Ode and Buildr. Assaf is also co-author of "Ruby In Practice":http://manning.com/mcanally/.
235
+
236
+ *Alex Boisvert*
237
+
238
+ 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.
239
+
240
+ *"Matthieu Riou":http://offthelip.org*
241
+
242
+ *Victor Hugo Borja* (vborja at apache.org)
243
+
244
+ 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.
245
+
246
+ *Lacton* (lacton at apache.org)
247
+
248
+ 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.
249
+
250
+ *"Daniel Spiewak":http://www.codecommit.com/blog* (djspiewak at apache.org)
251
+
252
+ Daniel originally came to Buildr in search of a Scala build tool which was better than Ant. He got more than he bargained for. Now, he works to advance Buildr as the absolute best tool for supporting Scala development.