lib/backup/file_item/local.rb in encbs-0.2.1.beta1 vs lib/backup/file_item/local.rb in encbs-0.2.1.beta2

- old
+ new

@@ -9,20 +9,24 @@ @timeout = 0 end def create_directory_once *directories directories.each do |path| - FileUtils.mkdir_p(path) unless Dir.exists?(path) + FileUtils.mkdir_p(path) unless File.directory? path end end def create_file_once file, data data = data.read if data.is_a? File or data.is_a? StringIO - File.open(file, "wb").puts(data) unless File.exists?(file) + File.open(file, 'wb') do |f| + f.puts(data) + end unless File.exists?(file) end def read_file file - File.open(file, 'rb').read if File.exists? file + File.open(file, 'rb') do |f| + f.read + end if File.exists? file end def timeout= time end