lib/ruby-box/client.rb in ruby-box-1.9.2 vs lib/ruby-box/client.rb in ruby-box-1.9.3

- old
+ new

@@ -68,22 +68,22 @@ folder = new_folder end folder end - def upload_data(path, data) + def upload_data(path, data, overwrite=true) path = split_path(path) file_name = path.pop folder = create_folder(path.join('/')) - folder.upload_file(file_name, data) if folder + folder.upload_file(file_name, data, overwrite) if folder end - def upload_file(local_path, remote_path) + def upload_file(local_path, remote_path, overwrite=true) file_name = local_path.split('/').pop folder = create_folder( remote_path ) return unless folder ::File.open( local_path ) do |data| - folder.upload_file(file_name, data) + folder.upload_file(file_name, data, overwrite) end end def split_path(path) path.gsub!(/(^\/)|(\/$)/, '')