Use consistent handling of the filename in the write helper method. Ruby 2.0 raises...
authorPeter Donald <donaldp@apache.org>
Sat, 8 Jun 2013 23:05:18 +0000 (23:05 +0000)
committerPeter Donald <donaldp@apache.org>
Sat, 8 Jun 2013 23:05:18 +0000 (23:05 +0000)
git-svn-id: https://svn.apache.org/repos/asf/buildr/trunk@1491091 13f79535-47bb-0310-9956-ffa450edef68

lib/buildr/core/common.rb

index afb1eaa..5e2e634 100644 (file)
@@ -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