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 2013/06/09 01:05:18 UTC

svn commit: r1491091 - /buildr/trunk/lib/buildr/core/common.rb

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