buildr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject svn commit: r1491091 - /buildr/trunk/lib/buildr/core/common.rb
Date Sat, 08 Jun 2013 23:05:18 GMT
Author: donaldp
Date: Sat Jun  8 23:05:18 2013
New Revision: 1491091

URL: http://svn.apache.org/r1491091
Log:
Use consistent handling of the filename in the write helper method. Ruby 2.0 raises an error
when passing a StringIO to File.dirname()

Modified:
    buildr/trunk/lib/buildr/core/common.rb

Modified: buildr/trunk/lib/buildr/core/common.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/common.rb?rev=1491091&r1=1491090&r2=1491091&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/common.rb (original)
+++ buildr/trunk/lib/buildr/core/common.rb Sat Jun  8 23:05:18 2013
@@ -46,9 +46,10 @@ module Buildr #:nodoc:
   # For example:
   #   write('README') { read('README').sub("${build}", Time.now) }
   def write(name, content = nil)
-    mkpath File.dirname(name)
+    filename = name.to_s
+    mkpath File.dirname(filename)
     content = yield if block_given?
-    File.open(name.to_s, 'wb') { |file| file.write content.to_s }
+    File.open(filename, 'wb') { |file| file.write content.to_s }
     content.to_s
   end
 



Mime
View raw message