def open_for_write(path)
      dir = Pathname.new(path).dirname
      FileUtils.mkdir_p(dir) unless File.exist?(dir)
      File.open(path, 'w') do |f|
        yield f
      end
    end
def open_for_write(path)
      dir = Pathname.new(path).dirname
      FileUtils.mkdir_p(dir) unless File.exist?(dir)
      File.open(path, 'w') do |f|
        yield f
      end
    end
Convenience method to use when you want to write to a file, this takes
 care of ensuring that the directory exists prior to attempting to open
 the file