Use consistent handling of the filename in the write helper method. Ruby 2.0 raises an error when passing a StringIO to File.dirname()

git-svn-id: https://svn.apache.org/repos/asf/buildr/trunk@1491091 13f79535-47bb-0310-9956-ffa450edef68