buildr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [2/3] buildr git commit: Documentation to packaging doc to document the new concatenate and transform methods
Date Mon, 31 Jul 2017 03:39:24 GMT
Documentation to packaging doc to document the new concatenate and transform methods


Branch: refs/heads/master
Commit: dbdcaa1bfc08d2c80ccb6eb61d9b13759c66f3e3
Parents: d08c7bc
Author: Antoine Toulme <>
Authored: Sun Jul 30 15:04:43 2017 -0700
Committer: Antoine Toulme <>
Committed: Sun Jul 30 15:04:43 2017 -0700

 doc/packaging.textile | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
diff --git a/doc/packaging.textile b/doc/packaging.textile
index 318a8c8..6ea599a 100644
--- a/doc/packaging.textile
+++ b/doc/packaging.textile
@@ -142,6 +142,8 @@ For example, when you use @package :jar@, under the hood it specifies
to include
 If you need to get rid of all the included files, call the @clean@ method. Some packaging
types default to adding various files and directories, for example, JAR packaging will include
all the compiled classes and resources.
+h2(#merging). Merging archives
 You can also merge two ZIP files together, expanding the content of one ZIP into the other.
 For example:
 {% highlight ruby %}
@@ -155,6 +157,25 @@ If you need to be more selective, you can apply the include/exclude pattern
to t
 {% endhighlight %}
+h3(#transforming). Transforming files while merging them
+You may need to have special treatment for files that you are merging from multiple locations.
+If you wish to concatenate the file contents, you can perform the following:
+{% highlight ruby %}
+package(:zip).merge(_(''), _('')).concatenate('META-INF/services/spring.providers')
+{% endhighlight %}
+If you need to transform the file contents to assemble the final output, you can work with
the @transform@ method.
+The transform method takes a block to process the contents of all the matching paths, as
the zip file is assembled.
+{% highlight ruby %}
+package(:zip).merge(_(''), _('')).transform('plugin.xml') do |plugin_xml_files|
+  return "<plugin>#{ {|xml| xml.match('<plugin>(.*)</plugin>')[1]}}</plugin>"
+{% endhighlight %}
 h2(#jar). Packaging JARs

View raw message