You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by do...@apache.org on 2012/12/16 03:37:36 UTC
svn commit: r1422456 - in /buildr/trunk: CHANGELOG
lib/buildr/packaging/artifact.rb
Author: donaldp
Date: Sun Dec 16 02:37:35 2012
New Revision: 1422456
URL: http://svn.apache.org/viewvc?rev=1422456&view=rev
Log:
Rework Artifact.content(value) method to accept a Proc that will be called before the artifact is written rather than requiring a string.
Modified:
buildr/trunk/CHANGELOG
buildr/trunk/lib/buildr/packaging/artifact.rb
Modified: buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=1422456&r1=1422455&r2=1422456&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Sun Dec 16 02:37:35 2012
@@ -1,4 +1,7 @@
1.4.10 (Pending)
+* Change: Rework Artifact.content(value) method to accept a Proc that
+ will be called before the artifact is written rather than
+ requiring a string.
* Added: Create a 'buildr/gpg' addon that signs and uploads signatures
when uploading artifacts. Inspired by a similar extension in
the Apache ODE project by Tammo van Lessen.
Modified: buildr/trunk/lib/buildr/packaging/artifact.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/packaging/artifact.rb?rev=1422456&r1=1422455&r2=1422456&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/packaging/artifact.rb (original)
+++ buildr/trunk/lib/buildr/packaging/artifact.rb Sun Dec 16 02:37:35 2012
@@ -372,6 +372,7 @@ module Buildr
# :call-seq:
# content(string) => self
+ # content(Proc) => self
#
# Use this when you want to install or upload an artifact from a given content, for example:
# readme = artifact('com.example:readme:txt:1.0').content(<<-EOF
@@ -379,9 +380,14 @@ module Buildr
# <<EOF
# install readme
#
- # If the argument is not a string, it will be converted to a string using to_s
+ # If the argument is a Proc the it will be called when the artifact is written out. If the result is not a proc
+ # and not a string, it will be converted to a string using to_s
def content(string = nil)
- return @content unless string
+ unless string
+ puts @content.class.name
+ @content = @content.call if @content.is_a?(Proc)
+ return @content
+ end
unless @content
enhance do